If you are editing code that creates shared libraries, please be aware 
that the options -shared, -soname, --whole-archive and 
--no-whole-archive will NOT be acceptable on Solaris IF the Sun linker 
is used, but WILL be if the GNU linker is used.


People use both linkers on Solaris, so different options must be used 
when creating shared libraries.

The GNU linker options -shared, -soname, --whole-archive and 
--no-whole-archive  would need to be changed if the Sun linker is used 
on Solaris to -G, -h, -zallextract and -zdefaultextract respectively.

One line of code I looked at recently has this:

$(LINK_CXX) -fPIC -shared -Wl,-soname,lib`cat DIRNAME`.so -o lib`cat 
DIRNAME`.so $(OBJ) $(GMP_LIBDIR) $(GMP_LIB)


The -Wl, option to gcc or g++ passes whatever follows the comma directly 
to the linker. So in the above case, -soname gets passed to the linker, 
which will fail if the OS is Solaris AND the linker is the Sun one.

In scripts, it's easy to create an exception for Solaris with the Sun 
linker, by first checking if the  OS is Solaris (uname returns 'SunOS') 
and checking if the linker (ld) outputs 'GNU' if called with the option 
'--version'

The following is one bit of example code, changes the -soname option to 
a -h using sed.

Obviously different things are appropriate in shell scrips, make files 
and python scripts. But if you can try to create variable names for the 
options it would help.

If you build a package which creates shared   libraries, perhaps you 
make me aware of it, then I see if it breaks on Solaris.

Dave



if [ `uname` = "Darwin" ]; then
    echo "64 bit MacIntel"
    CFLAGS="-O3 -g -m64 -fPIC -L."; export CFLAGS
    LDFLAGS="-m64 "; export LDFLAGS
    cp patches/makemakefile.py src/makemakefile.py
elif [ `uname` = "SunOS" -a "`ld  --version  2>&1  | grep GNU`" = ""  ]; 
then
    # Change -soname to -h if the Sun linker is used.
    sed 's/-soname/-h/g' src/makemakefile.py > /tmp/makemakefile.py.$$
    mv /tmp/makemakefile.py.$$ src/makemakefile.py
    CFLAGS="-fPIC -O3 -L."; export CFLAGS
    LDFLAGS=""; export LDFLAGS
else
    CFLAGS="-fPIC -O3 -L."; export CFLAGS
    LDFLAGS=""; export LDFLAGS
fi

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to