Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with doing a 'make test' to install perl modules in to SciPDL #3

Closed
karlglazebrook opened this issue Jan 4, 2025 · 1 comment

Comments

@karlglazebrook
Copy link
Member

karlglazebrook commented Jan 4, 2025

If you try compiling and installing your own perl module on top of SciPDL you will likely run in to this error with make test:

% perl Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Simple
Writing MYMETA.yml and MYMETA.json
% make 
cp Simple.pm blib/lib/Simple.pm
Running Mkbootstrap for Simple ()
chmod 644 "Simple.bs"
"/Applications/PDL/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Simple.bs blib/arch/auto/Simple/Simple.bs 644
"/Applications/PDL/bin/perl" "/Applications/PDL/lib/perl5/5.38.2/ExtUtils/xsubpp"  -typemap '/Applications/PDL/lib/perl5/5.38.2/ExtUtils/typemap'  Simple.xs > Simple.xsc
Please specify prototyping behavior for Simple.xs (see perlxs manual)
mv Simple.xsc Simple.c
gcc -c   -fno-common -DPERL_DARWIN -mmacosx-version-min=14.5 -DNO_POSIX_2008_LOCALE -fwrapv -fno-strict-aliasing -fstack-protector-strong -I/usr/local/include -I/opt/local/include -Wno-error=implicit-function-declaration -O3   -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\"  "-I/Applications/PDL/lib/perl5/5.38.2/darwin-2level/CORE"   Simple.c
rm -f blib/arch/auto/Simple/Simple.bundle
gcc  -mmacosx-version-min=14.5 -bundle -undefined dynamic_lookup -L/opt/local/lib -fstack-protector-strong  Simple.o  -o blib/arch/auto/Simple/Simple.bundle  \
	      \
	  
chmod 755 blib/arch/auto/Simple/Simple.bundle
% make test
"/Applications/PDL/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Simple.bs blib/arch/auto/Simple/Simple.bs 644
PERL_DL_NONLAZY=1 "/Applications/PDL/bin/perl" "-Iblib/lib" "-Iblib/arch" test.pl
1..1
Can't load 'blib/arch/auto/Simple/Simple.bundle' for module Simple: dlopen(blib/arch/auto/Simple/Simple.bundle, 0x0002): tried: 'blib/arch/auto/Simple/Simple.bundle' (relative path not allowed in hardened program), '/System/Volumes/Preboot/Cryptexes/OSblib/arch/auto/Simple/Simple.bundle' (no such file), '/Applications/PDL/bin/blib/arch/auto/Simple/Simple.bundle' (no such file), '/usr/local/gfortran/lib/gcc/aarch64-apple-darwin23/14.2.0/blib/arch/auto/Simple/Simple.bundle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/gfortran/lib/gcc/aarch64-apple-darwin23/14.2.0/blib/arch/auto/Simple/Simple.bundle' (no such file), '/usr/local/gfortran/lib/blib/arch/auto/Simple/Simple.bundle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/gfortran/lib/blib/arch/auto/Simple/Simple.bundle' (no such file), '/Applications/PDL/bin/blib/arch/auto/Simple/Simple.bundle' (no such file), '/usr/local/gfortran/lib/gcc/aarch64-apple-darwin23/14.2.0/blib/arch/auto/Simple/Simple.bundle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/gfortran/lib/gcc/aarch64-apple-darwin23/14.2.0/blib/arch/auto/Simple/Simple.bundle' (no such file), '/usr/local/gfortran/lib/blib/arch/auto/Simple/Simple.bundle' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/gfortran/lib/blib/arch/auto/Simple/Simple.bundle' (no such file), '/usr/lib/blib/arch/auto/Simple/Simple.bundle' (no such file, not in dyld cache), 'blib/arch/auto/Simple/Simple.bundle' (relative path not allowed in hardened program) at /Applications/PDL/lib/perl5/5.38.2/darwin-2level/DynaLoader.pm line 210.
 at test.pl line 11.
Compilation failed in require at test.pl line 11.
BEGIN failed--compilation aborted at test.pl line 11.
not ok 1
make: *** [test_dynamic] Error 2
@karlglazebrook
Copy link
Member Author

This is a feature unfortunately, because to notarise the distribution I need to harden the perl runtime and this precludes using relative paths as in make test. Hence the error 'relative path not allowed in hardened program)'.

Note make install will still work and then you can run the test script. Or you can do:

% perl  -I$(pwd)/blib/lib -I$(pwd)/blib/arch test.pl 
1..1
ok 1

If you are compiling lots of modules and this griefs you, you can permanently remove the hardening of the perl binary by resigning it generically like this:

xattr -d com.apple.quarantine /Applications/PDL/bin/perl
codesign -f -s -   /Applications/PDL/bin/perl

And then everything will just work as expected. Make sure you trust the perl binary!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant