[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Trouble linking c++ programs
From: |
Matthew Wilcox |
Subject: |
Trouble linking c++ programs |
Date: |
Fri, 16 Nov 2001 18:44:12 +0000 |
User-agent: |
Mutt/1.2.5i |
when trying the final link step, libtool always uses the C compiler, even
if the C++ compiler was specified on the command line. This is a problem
with gcc 2.96 and later since libstdc++ gets included if you link with g++
but not if you link with gcc. Here's an example from libdb3:
address@hidden:~/debian/db3/db3-3.2.9/build-tree/db-3.2.9/build_unix$ /bin/sh
./libtool --mode=link c++ -version-info 3:2 -rpath /usr/lib -o libdb3_cxx.la
cxx_app.lo cxx_except.lo cxx_lock.lo cxx_log.lo cxx_mpool.lo cxx_table.lo
cxx_txn.lo 2>libtool.out
rm -fr .libs/libdb3_cxx.la .libs/libdb3_cxx.* .libs/libdb3_cxx.*
gcc -shared cxx_app.lo cxx_except.lo cxx_lock.lo cxx_log.lo cxx_mpool.lo
cxx_table.lo cxx_txn.lo -Wl,-soname -Wl,libdb3_cxx.so.3 -o
.libs/libdb3_cxx.so.3.0.2
this works on my machine because i only have gcc 2.95 installed, but it fails
with 2.96/3.0. the command used to link is:
archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname
\$wl\$soname -o \$lib"
so either we should set CC from $nonopt or change the archive_cmds string.
Here's a diff for the first option:
--- /usr/share/libtool/ltmain.sh Sat Sep 22 18:10:52 2001
+++ ltmain.sh Fri Nov 16 11:42:43 2001
@@ -744,6 +744,7 @@
libtool_args="$nonopt"
compile_command="$nonopt"
finalize_command="$nonopt"
+ CC="$nonopt"
compile_rpath=
finalize_rpath=
this fixes the problem, but i find this shell script very difficult to
understand, so i'm not aware of all the ramifications this might have.
--
Revolutions do not require corporate support.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Trouble linking c++ programs,
Matthew Wilcox <=