Opened 2 weeks ago

Last modified 2 weeks ago

#71142 assigned defect

perl5.36 @5.36.3_1 does not build on PPC Tiger, Mac OS X 10.4.11, because ld gets invoked with -rpath

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: mojca (Mojca Miklavec)
Priority: Normal Milestone:
Component: ports Version: 2.10.2
Keywords: tiger Cc: evanmiller (Evan Miller)
Port: perl5.36

Description

make[1]: Entering directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_perl5/perl5.36/work/perl-5.36.3/cpan/DB_File'
/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_perl5/perl5.36/work/perl-5.36.3/cpan/DB_File/../../miniperl "-I../../lib" -MExtUtils::Command::MM -e 'cp_nonempty' -- DB_File.bs ../../lib/auto/DB_File/DB_File.bs 644
rm -f ../../lib/auto/DB_File/DB_File.bundle
LD_RUN_PATH="/opt/local/lib/db48" env MACOSX_DEPLOYMENT_TARGET=10.3 /opt/local/bin/gcc-apple-4.2 -Wl,-rpath,"/opt/local/lib/db48" -bundle -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc  version.o DB_File.o  -o ../../lib/auto/DB_File/DB_File.bundle  \
   -L/opt/local/lib/db48 -ldb   \
  
ld: -rpath can only be used when targeting Mac OS X 10.5 or later
collect2: ld returned 1 exit status
make[1]: *** [../../lib/auto/DB_File/DB_File.bundle] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_perl5/perl5.36/work/perl-5.36.3/cpan/DB_File'
Unsuccessful make(cpan/DB_File): code=512 at make_ext.pl line 584.
make: *** [lib/auto/DB_File/DB_File.bundle] Error 25
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_perl5/perl5.36/work/perl-5.36.3'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_perl5/perl5.36/work/perl-5.36.3" && /usr/bin/make -w all 
Exit code: 2
Error: Failed to build perl5.36: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_perl5/perl5.36/main.log for details.

Attachments (1)

main.log (192.6 KB) - added by ballapete (Peter "Pete" Dyballa) 2 weeks ago.
Main.log from PPC Tiger, Mac OS X 10.4.11

Download all attachments as: .zip

Change History (3)

Changed 2 weeks ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Tiger, Mac OS X 10.4.11

comment:1 Changed 2 weeks ago by ryandesign (Ryan Carsten Schmidt)

Cc: evanmiller added; mojca@… removed
Keywords: ppc removed
Owner: set to mojca
Status: newassigned

-rpath also gets used on my macOS 12 system.

There's probably no need for -rpath to be used here because the libraries we install with MacPorts don't use @rpath-based install names.

Fixing it so it doesn't use -rpath, at least on systems not supporting it, is probably the solution.

The first place -rpath is mentioned in your log is:

:info:build LD_RUN_PATH="/opt/local/lib/db48" env MACOSX_DEPLOYMENT_TARGET=10.3 /opt/local/bin/gcc-apple-4.2 -Wl,-rpath,"/opt/local/lib/db48" -bundle -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc  version.o DB_File.o  -o ../../lib/auto/DB_File/DB_File.bundle  \
:info:build    -L/opt/local/lib/db48 -ldb   \
:info:build   
:info:build ld: -rpath can only be used when targeting Mac OS X 10.5 or later

I believe this comes from a bundled version of MakeMaker. The MakeMaker changelog entry for 7.63_06 Wed 3 Nov 01:24:05 GMT 2021 says:

https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/blob/30ec33570146ca3f87d0be1db182e62297febf90/Changes#L95-L98

  • Add -rpath when compiling XS modules on macOS

This is the upstream commit that implemented that change:

https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/commit/1960b01c504e60a49c972b1186466539112aa7ff

And for MakeMaker 7.65_02 Fri 22 Jul 13:44:57 BST 2022 it says:

https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/blob/30ec33570146ca3f87d0be1db182e62297febf90/Changes#L53-L56

  • Don't use rpath for macOS <= 10.4

This is the upstream commit for that fix:

https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/commit/9b425120d4eb1d32b198ba0c0b2520b917c06c7a

We backported the fix to the p5-extutils-makemaker port:

[6317ad906d418d01b608c47e13c2ea4783764874/macports-ports]

but perhaps not to the versions of MakeMaker bundled with Perl.

Perl 5.36.3 bundles MakeMaker 7.64 so it does not have this fix.

The fix appears to base the decision of whether to add -rpath on whether the running OS version is ≥ 10.5, which is not correct; it should have been based on the deployment target. However, it's better than no fix.

comment:2 Changed 2 weeks ago by ballapete (Peter "Pete" Dyballa)

On my old PPC Tiger and Leopard systems I have -rpath in these files:

pete 235 /\  nice find /Volumes/Tiger/opt/local/lib/perl5 /Volumes/Tiger/System/Library/Perl -type f -exec ggrep -n -e -rpath {} /dev/null \;
/Volumes/Tiger/opt/local/lib/perl5/5.34/ExtUtils/Liblist/Kid.pm:72:        if ( $thislib =~ s/^(-[LR]|-Wl,-R|-Wl,-rpath,)// ) {    # save path flag type
/Volumes/Tiger/opt/local/lib/perl5/5.34/ExtUtils/MM_Unix.pm:1053:                       qq{-rpath "$self->{LD_RUN_PATH}"} : '';
/Volumes/Tiger/opt/local/lib/perl5/5.34/ExtUtils/MakeMaker.pm:3367:  PERL_MM_OPT='CCFLAGS="-Wl,-rpath -Wl,/foo/bar/lib" LIBS="-lwibble -lwobble"'
/Volumes/Tiger/opt/local/lib/perl5/5.34/darwin-thread-multi-2level/Config.pod:8284:as -R F<$archlibexp/C<CORE>> (Solaris) or -Wl,-rpath
/Volumes/Tiger/opt/local/lib/perl5/5.38/ExtUtils/Liblist/Kid.pm:77:        if ( $thislib =~ s/^(-[LR]|-Wl,-R|-Wl,-rpath,)// ) {    # save path flag type
/Volumes/Tiger/opt/local/lib/perl5/5.38/ExtUtils/MM_Unix.pm:1059:            $ldrun = qq{-rpath "$self->{LD_RUN_PATH}"};
/Volumes/Tiger/opt/local/lib/perl5/5.38/ExtUtils/MM_Unix.pm:1062:            # both clang and gcc support -Wl,-rpath, but only clang supports
/Volumes/Tiger/opt/local/lib/perl5/5.38/ExtUtils/MM_Unix.pm:1063:            # -rpath so by using -Wl,-rpath we avoid having to check for the
/Volumes/Tiger/opt/local/lib/perl5/5.38/ExtUtils/MM_Unix.pm:1065:            $ldrun = qq{-Wl,-rpath,"$self->{LD_RUN_PATH}"};
/Volumes/Tiger/opt/local/lib/perl5/5.38/ExtUtils/MakeMaker.pm:3356:  PERL_MM_OPT='CCFLAGS="-Wl,-rpath -Wl,/foo/bar/lib" LIBS="-lwibble -lwobble"'
/Volumes/Tiger/opt/local/lib/perl5/5.38/darwin-thread-multi-2level/Config.pod:8478:as -R F<$archlibexp/C<CORE>> (Solaris) or -Wl,-rpath
/Volumes/Tiger/System/Library/Perl/5.8.6/ExtUtils/MM_Unix.pm:1111:                       qq{-rpath "$self->{LD_RUN_PATH}"} : '';
/Volumes/Tiger/System/Library/Perl/5.8.6/darwin-thread-multi-2level/Config.pod:6769:as -R F<$archlibexp/C<CORE>> (Solaris) or -Wl,-rpath
pete 236 /\  !!:gs:Tiger:Leopard:
/Volumes/Leopard/opt/local/lib/perl5/5.34/ExtUtils/Liblist/Kid.pm:72:        if ( $thislib =~ s/^(-[LR]|-Wl,-R|-Wl,-rpath,)// ) {    # save path flag type
/Volumes/Leopard/opt/local/lib/perl5/5.34/ExtUtils/MM_Unix.pm:1053:                       qq{-rpath "$self->{LD_RUN_PATH}"} : '';
/Volumes/Leopard/opt/local/lib/perl5/5.34/ExtUtils/MakeMaker.pm:3367:  PERL_MM_OPT='CCFLAGS="-Wl,-rpath -Wl,/foo/bar/lib" LIBS="-lwibble -lwobble"'
/Volumes/Leopard/opt/local/lib/perl5/5.34/darwin-thread-multi-2level/Config.pod:8284:as -R F<$archlibexp/C<CORE>> (Solaris) or -Wl,-rpath
/Volumes/Leopard/System/Library/Perl/5.8.8/ExtUtils/MM_Unix.pm:919:                       qq{-rpath "$self->{LD_RUN_PATH}"} : '';
/Volumes/Leopard/System/Library/Perl/5.8.8/darwin-thread-multi-2level/Config.pod:6884:as -R F<$archlibexp/C<CORE>> (Solaris) or -Wl,-rpath

In Kid.pm obviously a substitution takes place, in MakeMaker.pm it's part of documentation, and in MM_Unix.pm IRIX is addressed – except for Perl 5.38, installed only on Tiger:

1058         if ( $Is{IRIX} ) {
1059             $ldrun = qq{-rpath "$self->{LD_RUN_PATH}"};
1060         }
1061         elsif ( $^O eq 'darwin' && $Is{AppleRPath} ) {
1062             # both clang and gcc support -Wl,-rpath, but only clang supports
1063             # -rpath so by using -Wl,-rpath we avoid having to check for the
1064             # type of compiler
1065             $ldrun = qq{-Wl,-rpath,"$self->{LD_RUN_PATH}"};
1066         }

Apple's versions are OK.

Note: See TracTickets for help on using tickets.