#272 Building fails on Solaris 10 w/ GCC 64bit

open-accepted
Josh Coalson
4
2007-07-26
2007-05-20
laurent
No

When building FLAC 1.1.4 on Solaris 10 using Solaris' GCC 3.4.3, the build fails with the following error:

g++ -shared -nostdlib /usr/lib/amd64/crti.o /usr/lib/amd64/values-Xa.o /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/amd64/crtbegin.o .libs/metadata.o .libs/stream_decoder.o .libs/stream_encoder.o -Wl,-R -Wl,/home/francis/download/ScummVM/dec/flac-1.1.4/src/libFLAC/.libs -Wl,-R -Wl,/usr/sfw/lib -Wl,-R -Wl,/usr/local/lib -Wl,-R -Wl,/usr/sfw/lib ../libFLAC/.libs/libFLAC.so -L/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/amd64 -L/usr/sfw/lib/gcc/i386-pc-solaris2.10/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.10/3.4.3/amd64/crtend.o /usr/lib/amd64/crtn.o -m64 -march=opteron -Wl,-h -Wl,libFLAC++.so.6 -o .libs/libFLAC++.so.6.0.1
ld: fatal: file /usr/sfw/lib/libstdc++.so: wrong ELF class: ELFCLASS32
ld: fatal: File processing errors. No output written to .libs/libFLAC++.so.6.0.1collect2: ld returned 1 exit status
gmake[3]: *** [libFLAC++.la] Error 1

It comes from the parameter -Wl,/usr/sfw/lib, which contains the 32 bit version of the libs: the wrong /usr/sfw/lib/libstdc++.so is found there.

However, I can't find where this parameter comes from.

The configure command was:

CFLAGS='-m64 -march=opteron -O3' \ CXXFLAGS='-m64 -march=opteron -O3' \ ./configure --disable-static \ --disable-asm-optimizations

Building 32 bit (without the -m64 option), there's no error.
FLAC 1.1.2 builds fine with the same options, but I've noticed the generated libtool script is quite different.

Any idea?

Discussion

  • Josh Coalson
    Josh Coalson
    2007-05-28

    • assigned_to: nobody --> jcoalson
    • status: open --> open-accepted
     
  • Josh Coalson
    Josh Coalson
    2007-07-26

    Logged In: YES
    user_id=78173
    Originator: NO

    hmm, no idea, and I don't have such a machine to try and debug this with...

     
  • Josh Coalson
    Josh Coalson
    2007-07-26

    • priority: 5 --> 4
     
  • laurent
    laurent
    2007-07-30

    Logged In: YES
    user_id=1447460
    Originator: YES

    Would it help if I could provide access to such a system?

     
  • Josh Coalson
    Josh Coalson
    2007-07-31

    Logged In: YES
    user_id=78173
    Originator: NO

    yes, thanks, I'll send you an email offline...

     
  • Logged In: NO

    Did you get my answer to your email? Just wondering, since I didn't get the SSH key I asked you for?

     
  • laurent
    laurent
    2008-09-06

    Logged In: YES
    user_id=1447460
    Originator: YES

    I finally understands a bit better what's going on. It seems to be a libtool limitation in the case of Solaris, where the integrated GCC doesn't behave as usual.

    In configure, there is this line, which is only used for GCC:
    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`

    The sys_lib_search_path_spec value is then set in libtool, and it's used to look for libstdc++.la or .so.
    However, the output of gcc -print-search-dirs is this:
    libraries: =/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/:/usr/lib/gcc/i386-pc-solaris2.10/3.4.3/:/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../../i386-pc-solaris2.10/lib/i386-pc-solaris2.10/3.4.3/:/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../../i386-pc-solaris2.10/lib/:/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../i386-pc-solaris2.10/3.4.3/:/usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../../:/lib/i386-pc-solaris2.10/3.4.3/:/lib/:/usr/lib/i386-pc-solaris2.10/3.4.3/:/usr/lib/

    Which means that only directories containing 32 bit libraries are searched (on Solaris, the 64 bit versions are in lib/64).
    So libtool ends up using /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/../../..//libstdc++.la, which points to the 32 bit, not 64 bit libstdc++.

    I don't really see a clean solution here. I modified it to something harmless in the solaris*) part lower, and it now builds. I can't say if the bug is in libtool or in the Solaris' special GCC.