bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libtool is broken for 64-bit C++ libraries under OpenSolaris


From: Vadim Zeitlin
Subject: libtool is broken for 64-bit C++ libraries under OpenSolaris
Date: Fri, 20 Nov 2009 18:07:35 +0100

 Hello,
 
 It seems that it's impossible to use libtool for linking 64 bit shared C++
libraries under OpenSolaris. The problem is that libtool insists on using
"g++ -nostdlib" and adding the necessary CRT modules itself but it doesn't
do it correctly as can be seen in this example (wrapped for readability):

        % /bin/sh ../libtool --tag=CXX --mode=link g++ -m64 -O2 -Wl,-64 -o
        libfoo.la -rpath /usr/local/lib libfoo-bar.lo
        rm -fr  .libs/libfoo.so.0.0.0
        g++ -shared -nostdlib  /usr/lib/amd64/crti.o
        /usr/lib/amd64/values-Xa.o
        /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/amd64/crtbegin.o
        .libs/libfoo_bar.o -Wl,-R -Wl,/usr/sfw/lib -Wl,-R -Wl,/usr/sfw/lib
        -L/opt/flexlm/11.7.0/x64_sun10
        -L/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/amd64
        -L/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../amd64
        -L/lib/amd64 -L/usr/lib/amd64 /usr/sfw/lib/libstdc++.so
        -L/usr/sfw/lib -lm -lgcc_s_amd64
        /usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/amd64/crtend.o
        /usr/lib/amd64/crtn.o  -m64 -Wl,-64 -Wl,-h -Wl,libfoo.so.0 -o
        .libs/libfoo.so.0.0.0
        ld: fatal: file /usr/sfw/lib/libstdc++.so: wrong ELF class: ELFCLASS32
        ld: fatal: file processing errors. No output written to 
.libs/libfoo.so.0.0.0
        collect2: ld returned 1 exit status


 I think the error is pretty self-explanatory: libtool uses 32 bit
libstdc++ when it should have been using the 64 bit version at
/usr/lib/64/libstdcc++.so.6. Unfortunately it's not really clear how can it
detect that this is what it needs to do. I guess it could detect the
presence of -m64 (or -64 in linker options?) and do the right thing but it
would have been so much easier if it didn't use -nostdlib at all because
running the command manually without it (and without all explicit crt*.o
&c, of course) works just fine. Is there any way to force libtool to do the
sane thing instead of trying to be smart?


 I've initially found the problem with the (old) libtool 1.5.22 from the
standard package but it also seems to be still present in the latest git
version which I built manually:

        % uname -a
        SunOS machine_name 5.11 snv_111b i86pc i386 i86pc
        % pkg list SUNWlibtool
        NAME (PUBLISHER)                              VERSION         STATE     
 UFIX
        SUNWlibtool                                   1.5.22-0.111    installed 
 ----
        % libtool --version|head -n1
        libtool (GNU libtool 1.3130 2009-11-16) 2.2.7a
        

 Thanks in advance for any help,
VZ

Attachment: pgpKuvbA0x0e7.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]