libtool-patches
[Top][All Lists]
Advanced

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

libtool wants to link C++ code with GCC


From: Guillaume Cottenceau
Subject: libtool wants to link C++ code with GCC
Date: 15 May 2002 14:16:39 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

As we're moving the Mandrake distro to gcc-3.1, a bug in libtool
is now important enough to need a patch.

In "link" mode, even if the Makefile passes the "c++" command to
libtool, libtool insists on using "gcc" as the command for
linkage, instead of "c++". With older versions of gcc, this
didn't lead to a problem, but with g++-3.1, some special code
(apparently regarding exceptions handling) is in the way. If one
links a dynamic library containing C++ with libtool, it will
generate the .so file correctly; there after, when trying to load
it, the linker will report the following error:

/path/to/library: undefined symbol: __gxx_personality_v0


To sum up, currently the following command:

        /bin/sh ./libtool --mode=link c++ ...

leads to:

        gcc -shared ...


I'm using the following patch in our libtool package to fix the
problem. Since I'm a sucker in shell scripting, I've used perl to
remove the leading element of a string; for our distribution it's
not a problem since perl is a member of our "base system".


--- ./ltmain.in.gege    2001-09-11 01:40:18.000000000 +0200
+++ ./ltmain.in 2002-05-15 13:32:16.000000000 +0200
@@ -205,6 +205,17 @@
   exit 1
 fi
 
+# Mandrake: (gc) It's bad to link C++ code with GCC, so we need to use the 
compiler name if provided
+if test "$mode" = link && test -n "$archive_cmds" && test -x "/usr/bin/perl"; 
then
+    case $nonopt in
+    *cc | *++ | gcc* | *-gcc* | egcs*)
+           archive_cmds=`echo $archive_cmds | perl -pe 's/^\S+\s+//'`
+           archive_cmds="$nonopt $archive_cmds"
+           archive_expsym_cmds=`echo $archive_expsym_cmds | perl -pe 
's/^\S+\s+//'`
+           archive_expsym_cmds="$nonopt $archive_expsym_cmds"
+    esac
+fi
+
 # If this variable is set in any of the actions, the command in it
 # will be execed at the end.  This prevents here-documents from being
 # left over by shells.
--- ./ltmain.sh.gege    2002-05-15 13:33:49.000000000 +0200
+++ ./ltmain.sh 2002-05-15 13:36:53.000000000 +0200
@@ -207,6 +207,17 @@
   exit 1
 fi
 
+# Mandrake: (gc) It's bad to link C++ code with GCC, so we need to use the 
compiler name if provided
+if test "$mode" = link && test -n "$archive_cmds" && test -x "/usr/bin/perl"; 
then
+    case $nonopt in
+    *cc | *++ | gcc* | *-gcc* | egcs*)
+           archive_cmds=`echo $archive_cmds | perl -pe 's/^\S+\s+//'`
+           archive_cmds="$nonopt $archive_cmds"
+           archive_expsym_cmds=`echo $archive_expsym_cmds | perl -pe 
's/^\S+\s+//'`
+           archive_expsym_cmds="$nonopt $archive_expsym_cmds"
+    esac
+fi
+
 # If this variable is set in any of the actions, the command in it
 # will be execed at the end.  This prevents here-documents from being
 # left over by shells.



-- 
Guillaume Cottenceau - http://people.mandrakesoft.com/~gc/



reply via email to

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