[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug with shared libs, Solaris Workshop
From: |
Jeff Squyres |
Subject: |
Bug with shared libs, Solaris Workshop |
Date: |
Mon, 28 Mar 2005 21:29:32 -0500 |
Greetings. I have noticed a problem with building shared libraries
with the native Solaris Workshop compilers in 64 bit mode:
- Solaris 2.8
- Libtool 1.5.14
- Workshop 6 update 2 C 5.3 Patch 111679-14 2004/02/20
The problem seems to be when combining convenience libraries into an
overall library. I have a toy Automake-based project that builds 2
convenience libraries and combines them into 1, and then tries to link
a toy executable against it.
Libtool seems to be passing wrong arguments to ld to create the 1
shared library from the 2 convenience libraries. Here's the configure
command that I used with my toy AM project:
-----
$ ./configure CC=cc CXX=CC CFLAGS=-xarch=v9 CXXFLAGS=-xarch=v9
--disable-static --enable-shared
-----
Here's the libtool command that AM issues when it tries to combine the
two convenience libraries into the upper-level library:
-----
/bin/bash ../libtool --tag=CC --mode=link cc -xarch=v9 -o
liblt_pgi_c.la -rpath /usr/local/lib one/liblt_pgi_c_one.la
two/liblt_pgi_c_two.la
-----
Libtool then turns that into:
------
/usr/ccs/bin/ld -G -h liblt_pgi_c.so.0 -o .libs/liblt_pgi_c.so.0.0.0
-Wl,-z -Wl,allextract one/.libs/liblt_pgi_c_one.a
two/.libs/liblt_pgi_c_two.a -Wl,-z -Wl,defaultextract -lc
------
ld emits 4 warnings about "illegal option -- W", and then gives a usage
message for ld (note that I'm not sure what happened to -xarch=v9,
although that's somewhat irrelevant -- see below). The correct syntax
appears to be:
-----
/usr/ccs/bin/ld -G -h liblt_pgi_c.so.0 -o .libs/liblt_pgi_c.so.0.0.0
-64 -z allextract one/.libs/liblt_pgi_c_one.a
two/.libs/liblt_pgi_c_two.a -z defaultextract -lc
-----
The changes are:
1. Eliminate the -Wl, prefixes (which makes sense -- we're invoking the
linker directly, so "-Wl," isn't necessary)
2. Change -xarch=v9 into -64
--> Note that there are a few variations of -xarch -- possible values
are "v9", "v9a", or "v9b". To the linker, they all transform into -64
(the distinctions between the three are only meaningful to the
compiler).
I see that LT has support for 64 bit builds on Solaris, and I know that
this used to work in the past. So I don't know if something changed in
the Solaris ld to make this not work or if something else changed. But
as it stands now, convenience libraries for shared libraries don't
work.
Hopefully the information provided above is enough to fix the current
problems. Please let me know if I can provide any further information.
Thanks!
--
{+} Jeff Squyres
{+} address@hidden
{+} http://www.lam-mpi.org/
- Bug with shared libs, Solaris Workshop,
Jeff Squyres <=