Porters,

I would like to propose that we make useshrplib='false' default for darwin to resolve prebinding woes.

I said "update_prebinding -root /" should resolve the problem but only temporarily. perl is in fact not prebind. This is what is actually happning.

% env DYLD_PREBIND_DEBUG=1 /usr/local/bin/perl -e 1
dyld: perl: prebinding disabled because library: /usr/local/lib/perl5/5.8.0/darwin-thread-multi-64int/CORE/ libperl.dylib got slid
dyld: in notify_prebinding_agent() determined the system shared regions are NOT used
dyld: 2 two-level prebound libraries used out of 3

At this stage no "/usr/libexec/fix_prebinding: /usr/local/bin/perl couldn't be prebound in the past, and probably can't be prebound now." is issued. But as time goes by and more system gets used, "dyld: 2 two-level prebound libraries used out of 3" stops working and the (in)?famous fix_prebinding warning starts appearing in your /var/log/system.log.


When you attempt to compile perl with -prebind switch, however, this is what happens
DYLD_LIBRARY_PATH=/Users/dankogai/work/perl-5.8.0 cc -prebind -o miniperl \
miniperlmain.o opmini.o libperl.dylib -lm -lc
cc: unrecognized option `-prebind_allow_overlap'
ld: warning multiple definitions of symbol _Perl_listkids
opmini.o definition of _Perl_listkids in section (__TEXT,__text)
[lots of similar ld warnings to follow]

So it does not work in practice. But when you turn off useshrplib, prebinding works beautifully.
To test that for yourself, just Configure with


-Dldflags='-prebind' -Dlddflags='-bundle -undefined dynamic_lookup' -Uuseshrplib

And the change? Significant! See this

Reference: bundled version
% time /usr/bin/perl -le 'for (1..$ARGV[0]){system $ARGV[1], qw(-e 1)}' 1000 /usr/bin/perl5.6.0
1.560u 4.680s 0:07.46 83.6% 0+0k 0+0io 0pf+0w

-Duseshrplib
% time /usr/bin/perl -le 'for (1..$ARGV[0]){system $ARGV[1], qw(-e 1)}' 1000 /usr/local/bin/perl
21.490u 8.690s 0:33.22 90.8% 0+0k 0+1io 0pf+0w

-Uuseshrplib and prebinding
%time /usr/bin/perl -le 'for (1..$ARGV[0]){system $ARGV[1], qw(-e 1)}' 1000 /usr/local/bin/perl
2.190u 5.810s 0:10.42 76.7% 0+0k 0+0io 0pf+0w

As we all know many systems now support -Duseshrplib but not many make it a default.


% egrep "useshrplib='?true'?" hints/*.sh
hints/bsdos.sh:        useshrplib='true'
hints/darwin.sh:useshrplib='true';
hints/openbsd.sh:               useshrplib=true
hints/os2.sh:    useshrplib='true'
hints/os390.sh:    '') useshrplib='true' ;;
hints/rhapsody.sh:useshrplib='true';
hints/svr5.sh:  useshrplib='true'

and those listed usually make useshrplib=true conditionally. It seems only darwin makes it unconditionally true.


shared libperl save disk space and memory ONLY WHEN you have many apps liked to libperl. In most cases, however, you have only perl itself and mod_perl. So I suggest that we make useshrplib="false" for darwin.

I know you all know but XS are still dynamically loaded. So there is not much point for -D useshrplib.

Dan the Man too Tired of Unprebindable Camels




Reply via email to