Subject: Re: Error installing libtool from pkgsrc on 1.4.2 sparc
To: Devin L. Ganger <dlganger@earthlink.net>
From: Eduardo Horvath <eeh@turbolinux.com>
List: netbsd-help
Date: 08/14/2000 08:52:19
On Sun, 13 Aug 2000, Devin L. Ganger wrote:

> Hello.
> 
> I was trying to install slrn-0.9.6.2 on my shiny new NetBSD 1.4.2
> install via pkgsrc (downloaded on 11 Aug 2000, 0558 PST), and ran into
> problems compiling some of the dependencies (slrn 0.9.6.2 depends on
> slang-1.4.1, and slang depends on libtool-1.3.5).
> 
> Specifically, libtool-1.3.5 is bombing out on the following:
> 
> updating cache .././config.cache
> creating ./config.status
> /bin/sh ./libtool --mode=compile
> cc -DHAVE_CONFIG_H -I. -I. -I.     -O2 -c ltdl.c
> mkdir .libs
> cc -DHAVE_CONFIG_H -I. -I. -I. -O2 -c ltdl.c  -fPIC -DPIC -o
> .libs/ltdl.lo
> cc -DHAVE_CONFIG_H -I. -I. -I. -O2 -c ltdl.c -o ltdl.o >/dev/null 2>&1
> mv -f .libs/ltdl.lo ltdl.lo
> /bin/sh ./libtool --mode=link
> cc  -O2 -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/
> lib -o libltdl.la -rpath /usr/pkg/lib -version-info 1:2:1 ltdl.lo
> rm -fr .libs/libltdl.la .libs/libltdl.* .libs/libltdl.*
> cc -shared -o .libs/libltdl.so.1.2
>  ltdl.lo   -Wl,-R/usr/pkg/lib -Wl,-R/usr/pkg/lib
> ld: ltdl.lo: illegal reloc type mix
> collect2: ld returned 1 exit status
> *** Error code 1
> 
> I have no clue what could be causing this.  This is a fresh install of
> NetBSD 1.4.2 sparc, done on 11 Aug 2000, via miniroot and ftp.  I've
> included the dmesg output and the full error output from the initial
> make-install command for slrn, in the hopes they'll give some clues.

I'm not certain this information will be of much help.

The problem you are seeing is due to conflicts between code that is
compiled with different PIC models.  Apparently the a.out toolchains
cannot link files that are compiled with -fpic with files that are
compiled with -fPIC.  There may be similar conflicts with code that
compiled absolute (not -fpic nor -fPIC).  

It appears that ltdl.lo is being compiled with -fPIC.  Then the command:

cc -shared -o .libs/libltdl.so.1.2 ltdl.lo   -Wl,-R/usr/pkg/lib
-Wl,-R/usr/pkg/lib

is being used to create the shared library.  Try running that with `-v' to
see what the linker is really getting.  I suspect it is trying to link the
shared library against libc.so.  AFAIK libc.so is compiled -fpic.

So you can try:

1) compile ltdl.lo with -fpic instead of -fPIC

2) issue the linker command by hand so it doesn't try to pull in libc.so

I think that pulling in additional libraries to generate a shared library
is probably incorrect.

Eduardo Horvath