myld/OS X link failure

myld/OS X link failure

am 29.05.2004 18:22:04 von Nicholas Clark

I was trying to build DBD::mysql from source using the system perl on OS X,
and with no arguments to Makefile.PL it fails at link time with the very
descriptive:

LD_RUN_PATH="/sw/lib/mysql:/usr/lib" /usr/bin/perl myld MACOSX_DEPLOYMENT_TARGET=10.3 cc -bundle -undefined dynamic_lookup -L/usr/local/lib dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.bundle -L/sw/lib/mysql -lmysqlclient -lz -lm -L/sw/lib
make: *** [blib/arch/auto/DBD/mysql/mysql.bundle] Error 1

Researching this in your mail archive I find that --nocatchstderr works round
the problem, as suggested in: http://lists.mysql.com/perl/2826

The bug is that the generated myld script doesn't correctly catch the
case where system() fails and returns -1, hence myld.stderr is still
of zero size, hence this if clause is not true:

if (-f "myld.stderr" && !-z _) {

hence $contents is still '', and so

if ($retval) {
print STDERR $contents;
exit 1;
}

prints nothing.

myld would be far more robust if it catered for system() failing.

The actual cause of system failing (the original bug) is that $ARGV[0]
is 'MACOSX_DEPLOYMENT_TARGET=10.3', which system is trying to execute as
the shell command. I'm not sure if Apple are "correct" to have something other
than a plain command name as their linker, but they've done so:

$ /usr/bin/perl -V:ld
ld='MACOSX_DEPLOYMENT_TARGET=10.3 cc';


So I figure that it's something that probably ought to be catered for.
The default in makefiles is that the command string is passed to /bin/sh,
so is there any reason why myld should not be changed to system("@ARGV") ?

Nicholas Clark

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org