I've noticed on several occasions people reporting issues when Sage includes a 
library which the system has. This causes conflicts with the linker, and can 
result in messages which sometimes include:

"(possible multiple inclusion of the same file)"

Readline is one such example, but is by no means unique. This has code specific 
to Suse, as Sage's conflicts with the readline in Suse.

#################Readline code for Suse Linux ##############
# First we check for OpenSUSE 11.1 since bash is linked dynamically with a
# readline that breaks when we build Sage's readline, so we work around this
# for now.

if [ -f /etc/SuSE-release ]; then
     if [ `grep 11.1 /etc/SuSE-release > /dev/null; echo $?` -eq 0 ]; then
         echo "OpenSUSE 11.1 detected"
         if [ -d /usr/include/readline/ ]; then
############################################################

On OpenSolaris, gnutls does not build easily

http://trac.sagemath.org/sage_trac/ticket/7387

due to what I believe are conflicts between libgrcypt and libgpg in Solaris, 
and 
those in Sage. The linker complains:

ld: fatal: recording name conflict: file 
/export/home/drkirkby/sage-4.2/local/lib/libgpg-error.so' and file 
/usr/lib/libgpg-error.so' provide identical dependency names: libgpg-error.so.0 
(possible multiple inclusion of the same file)

I can get around that, by deleting the following 5 set of files.

     * SAGE_LOCAL/include/gcrypt-module.h
     * SAGE_LOCAL/include/gpg-error.h
     * SAGE_LOCAL/include/gcrypt.h
     * SAGE_LOCAL/lib/libgcrypt*
     * SAGE_LOCAL/lib/libgpg*

I believe there are other examples too, where libraries in Sage are causing 
conflicts with libraries in the system.

I asked on the gcc-help about how to resolve this.

http://archives.free.net.ph/thread/20091215.122311.bf804bb1.en.html

This is one reply:

#############################################################
 >where problems arise if a library included in Sage is installed on the system
 >too.

Of cause they do! It's simply wrong to use and install libraries that
the system already supplies. A sane software package detects the
libraries installed in the system and only compiles/installs those
that are missing. If distributed in compiled form, the only sane way
is to statically link in the libraries to avoid clashes with system
supplied ones.

 >Is there a way to specify that only the first copy of the library is linked, 
 >and
 >not any other copies gcc might find? Readline is not the only library where
 >issues have arisen (OpenSSL libraries on OpenSolaris is another example).

AFAIK there is no way.

Philipp
##########################################################

Of course, that is not a lot of help if one needs a never version of a library 
in Sage, to what the system has, so I asked about that issue. This is the 
response.


################ From gcc-help ###########################
 >What could you do if the system supplies a library, but it's not the latest
 >release, and you need the latest?

Either explicitely link in the static version of said library or
install the dynamic library somewhere else and link it in by passing
the path to ld via -L and then adding said library to the users
LD_LIBRARY_PATH.

Philipp
###########################################################


This got me thinking about an issue I once had with Mathematica using excessive 
CPU time, and how Casper Dik, a really **** hot Sun employee solved it for me.

http://www.g8wrb.org/mathematica/

Essentially Sun had made a change in a library in the Solaris kernel, and 
change 
a minimum timeout permitted from 1 ms to 1 us. Wolfram Research had selected 
the 
minimum timeout (rather than 1 ms), and so this caused serious issues with 
Mathematica on slower computers, as something kept timing out, so basically 
computing something as simple as 1+1, returned 2 quickly, but pegged the CPU at 
100% forever.

Casper solved this for me, by posting a bit of C code which was a revised 
version of the code in the Solaris kernel. I compiled that, made a shared 
library, then used LD_PRELOAD_64 (or its 32-bit counterpart LD_PRELOAD), to 
load 
that library in preference to the one in the kernel.


I can't help but feel there perhaps needs to be some changes in the way 
libraries are built in Sage, as hacks like copying system libraries over Sage 
libraries, or deleting Sage libraries, are really just hacks. It would be nice 
to find a way around this problem, so that there is never any conflict with 
libraries.

I'm amazed the problems are not more frequent than what they are, which makes 
me 
think my understanding of the problem is not complete.

Dave

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

Reply via email to