Subject: ld confusion
To: netbsd-help <netbsd-help@netbsd.org>
From: James K.Lowden <jklowden@speakeasy.org>
List: netbsd-help
Date: 05/23/2002 21:34:58
Hello everyone, 

I'm trying to install perl's DBD::mysql driver (database/p5-DBD-mysql) on
my 1.4.2 generic box.  It won't build with the patch, and it won't run
without it.  I'm not sure if I have a problem with ld, perl, or the perl
script, and I'd be very glad for any perls of wisdom.  

patch/patch-aa looks like this:

+    } elsif ($Config::Config{'osname'} eq 'netbsd') {
+       # We need to link with -Wl,-R if we're on NetBSD
+       $linkwith = "-Wl,-R$libdir";

I don't understand and can't find a -W anything for ld in info.  

The build breaks with the patch:

rm -f ../blib/arch/auto/DBD/mysql/mysql.so
LD_RUN_PATH="/usr/pkg/lib/mysql:/usr/lib" ld  -Bshareable  -R/usr/pkg/lib
-L/usr/pkg/lib dbdimp.o  mysql.o -L/usr/pkg/lib/mysql
-Wl,-R/usr/pkg/lib/mysql -o ../blib/arch/auto/DBD/mysql/mysql.so  
-L/usr/pkg/lib/perl5/5.6.1/i386-netbsd/CORE
-R/usr/pkg/lib/perl5/5.6.1/i386-netbsd/CORE -lperl -L/usr/pkg/lib/mysql
-lmysqlclient -lm -lz  
ld: invalid command option `-Wl,-R/usr/pkg/lib/mysql'

Thinking the patch may mumble n/a for 1.4.2, I renamed it, make clean;
make install.  All goes well.  Then, running the script (not mine; I'm
seeing if I can get LXR to run on my webserver), perl complains:

/usr/libexec/ld.so: perl: libmysqlclient.so.10.0: No such file or
directory

Even though that looks like a lie to me:

# ls -l /usr/pkg/lib/*my*
total 546
-rw-r--r--  1 root  wheel  128970 May 23 20:23 libmysqlclient.a
-rwxr-xr-x  1 root  wheel     777 May 23 20:23 libmysqlclient.la
-rwxr-xr-x  1 root  wheel  128259 May 23 20:23 libmysqlclient.so.10.0

I tried running "ldconfig" all by itself to rescan or whatever it does, no
joy.  

What to do, please, O wise ones?

Many thanks, 

--jkl