Subject: Re: ld confusion
To: James K.Lowden <jklowden@speakeasy.org>
From: David S. <davids@idiom.com>
List: netbsd-help
Date: 05/23/2002 19:07:18
>
> 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'
"-Wl" isn't an 'ld' option, it's a 'cc' option (from gcc(1)):
-Wl,option
Pass option as an option to the linker. If option
contains commas, it is split into multiple options
at the commas.
You'd use it something like
cc -o my_prog my_prog.o -Wl,-R/usr/pkg/lib/mysql -L/usr/pkglib/mysql \
-lmysqlclient ...
In your "ld ..." command above, try replacing "-Wl,-R/usr/pkg/lib/mysql"
with "-R/usr/pkg/lib/mysql".
David S.
>