public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* g++ linking problem
@ 2006-06-04 14:14 S3
  2006-06-04 17:35 ` Brian Dessent
  0 siblings, 1 reply; 2+ messages in thread
From: S3 @ 2006-06-04 14:14 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1290 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I see other messages similar to this in the mailing list,
but I don't see any resolution yet.

I am having a problem linking C++ programs.
(I have attached the logs from compiling MySQL and KDE arts.)
The programs compile just fine, but when it tries to link
them, it fails to find all basic C++ symbols, such as those
from libstdc++.  I have libstdc++-v3 installed.
When I use g++ ordinarily, it links to libstdc++ just fine.

Specifically, it can't find:
__cxa_pure_virtual
std::basic_string

I am using:
g++ (GCC) 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)
(I had this problem with gcc 3.4.5 also.)

For MySQL, I was able to work around it by adding
- -lstdc++ to my CFLAGS, but that seems like a bad hack.
(This didn't work for arts.
Maybe it needed the supplemental library too?)
What is the proper way to get C++ to link?
Why would the way the these programs' Makefiles
not be able to link while normal invocations of g++ can?

Any help would be greatly appreciated.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2-ecc0.1.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEguq/xzVgPqtIcfsRAjcPAJ9kpE7KERH10EJQ8VGK4JzZ+2I5BACff4yT
/7AQngAd3i0wbBIS+jRCQ/w=
=Qu7H
-----END PGP SIGNATURE-----

[-- Attachment #2: log.tar.bz2 --]
[-- Type: application/x-bzip2, Size: 64565 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: g++ linking problem
  2006-06-04 14:14 g++ linking problem S3
@ 2006-06-04 17:35 ` Brian Dessent
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dessent @ 2006-06-04 17:35 UTC (permalink / raw)
  To: S3; +Cc: gcc-help, libtool

S3 wrote:

> I see other messages similar to this in the mailing list,
> but I don't see any resolution yet.
> 
> I am having a problem linking C++ programs.
> (I have attached the logs from compiling MySQL and KDE arts.)
> The programs compile just fine, but when it tries to link
> them, it fails to find all basic C++ symbols, such as those
> from libstdc++.  I have libstdc++-v3 installed.
> When I use g++ ordinarily, it links to libstdc++ just fine.
> 
> Specifically, it can't find:
> __cxa_pure_virtual
> std::basic_string

This is usually caused by the user trying to link by invoking gcc
instead of g++ when C++ code is involved.  If you link with g++ it knows
to include all the necessary flags and options to support C++, which
does not happen when invoked as gcc.  However, in your case, libtool is
being used which adds another layer of indirection on top of things.

Unfortunately your configuration (or perhaps the package itself) is
invoking "libtool --silent", which means that the libtool wrapper isn't
printing the actual command that it's executing, which means those tens
of thousands of lines of spew you attached are more or less useless for
determining the actual problem.  You could have saved everybody reading
a lot of time by just incluing the the part that causes the error, which
was:

/bin/sh ../libtool --silent --tag=CXX --mode=link g++  -Wno-long-long
-Wundef -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align
-Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -DNDEBUG
-DNO_DEBUG -O2 -march=pentium4 -O2 -pipe -fomit-frame-pointer -mmmx
-msse2 -fstack-protector -Wformat-security -Wmissing-format-attribute
-Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common 
-ftemplate-depth-99    -o libmcop.la -rpath /usr/kde/3.5/lib
-no-undefined -Wl,--no-undefined -Wl,--allow-shlib-undefined
-version-info 1:0  -L/usr/kde/3.5/lib -L/usr/qt/3/lib -L/usr/lib  [many
.lo files]  -lgmodule-2.0 -ldl -lgthread-2.0 -lglib-2.0  
../libltdl/libltdlc.la 
.libs/buffer.o: In function
`Arts::Buffer::readString(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >&)':
buffer.cc:(.text+0x6c1): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::assign(char const*,
unsigned int)'

In any case, this is not the right list to post on.  I suggest you post
this to the libtool list (CC:d), or the mailing list of the package
itself.

Brian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-04 17:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-04 14:14 g++ linking problem S3
2006-06-04 17:35 ` Brian Dessent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).