Fix issue where the incorrect version of the library#18
Fix issue where the incorrect version of the library#18timlegge wants to merge 2 commits intocpan-authors:masterfrom
Conversation
timlegge
commented
Feb 16, 2026
or headers could be found either by the Devel::CheckLib
or by the Module itself.
Devel::CheckLib uses $Config{ccflags} which has the -I from Perl
which is not wanted when attempting to Compile the test check_lib
function against libsodium. Since /usr/local/include was first on
the command line the non-alien header files were found.
https://rt.cpan.org/Ticket/Display.html?id=173214
In addition we need to set the MakeMaker INC and LIBS explicitly
to ensure the Alien version is used.
Being explicit will also be needed for the option to use a non-Alien
version of the Library
|
@plicease Any chance you could take a look at this? |
Makefile.PL
Outdated
| $xsbuild{"LIBS"} = [ $alien_libs ]; | ||
| $xsbuild{"CCFLAGS"} = $alien_cflags; | ||
| $xsbuild{"INC"} = $alien_include; |
There was a problem hiding this comment.
This shouldn't be necessary, and will in fact probably break some configurations. mm_args2 should correctly order the includes so that the Alien include directories preceed the ones that are configured during Perl build time (like -I/usr/local/include). Setting CCFLAGS without the configured $Config{ccflags} will break any Perl that rely on them.
There was a problem hiding this comment.
@plicease That makes sense and I can change. Do you have any thoughts on the need to use use Mock::Config ccflags because of the way Devel::CheckLib uses $Config{ccflags} ?
There was a problem hiding this comment.
I'm not 100% sure, I think you want to pass the include path in as incpath and remove -I from the cflags passed into ccflags (both as passed into Devel::CheckLib), that I think should get the correct ordering of flags, but maybe it would be good for ABW to have a method to generate the correct arguments for Devel::CheckLib similar to what it does for EUMM since it is complicated, and difficult to get right.
There was a problem hiding this comment.
If we can reproduce the error (maybe in a docker container) I might be able to enhance ABW to do this.
There was a problem hiding this comment.
I have a VM that has the issue. FreeBSD and an older version of libsodium installed. I will look at how to duplicate the issue on something easier to deal with...
There was a problem hiding this comment.
@plicease So, it took some time but I was able to create a Docker image that can reproduce the issue. I assume pushing it to docker hub would be the best way to get it to you?
There was a problem hiding this comment.
I pushed it to Docker hub: It is available as
timlegge/crypt-nacl-sodium
Essentially it is a custom build Alpine 3.0 32-bit image with perlbrew perl 5.16.3 and libsodium 0.4.5 which replicates the versions that were present in the free BSD smoker where I saw the issue.
The only custom item was the option passed to perbrew to add the same -I as FreeBSD:
perlbrew install perl-5.16.3 -A ccflags=\"-I/usr/local/include\" --notest --thread --multi
The image has a clone of https://github.com/timlegge/crypt-nacl-sodium.git with the libs branch checked out. So this works:
cd /root/crypt-nacl-sodium
perl Makefile.PL
make test
and this fails:
cd /root/crypt-nacl-sodium
git checkout master
perl Makefile.PL
make realclean
perl Makefile.PL
make test