This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14234] New: Unresolved symbols for template instantitations
- From: "rwgk at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Feb 2004 02:36:07 -0000
- Subject: [Bug c++/14234] New: Unresolved symbols for template instantitations
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Under Mac OS 10.3.2 linking some Boost.Python regression tests fails.
I've stripped down one of these tests and it appears that the problem
is related to template instantiations for pointer types with a const&
qualifier.
g++ (GCC) 3.4.0 20040220 (prerelease)
Configured with: /net/worm/scratch1/rwgk/gcc-3_4-branch/configure --
prefix=/usr/local_cci/gcc-3_4-branch_2004_02_20 --enable-languages=c,c++
Apple G5 under OS 10.3.2:
Darwin coral.lbl.gov 6.8 Darwin Kernel Version 6.8: Wed Sep 10 15:20:55
PDT 2003; root:xnu/xnu-344.49.obj~2/RELEASE_PPC Power Macintosh powerpc
To reproduce the bug get this completely self-contained package:
http://cci.lbl.gov/~rwgk/bugs/gcc340/gcc340_mac_20040220.tar.gz
To unpack and see the complete information about the source code:
gunzip -c gcc340_mac_20040220.tar.gz | tar xf -
cd gcc340_mac_20040220
more SOURCE_CODE_INFO
It is assumed that g++ == gcc 3.4.0.
To run the demo:
./demo_link_problem.csh
Near the end of the output you should see:
g++ -w -bundle -
bundle_loader /System/Library/Frameworks/Python.framework/Versions/2.3/Python /S
ystem/Library/Frameworks/Python.framework/Versions/2.3/Python -o
libtbx/m1_stripped_1_ext.so boost_adaptbx/m1_stripped_1_ext.os -Llibtbx -
L/net_scarlet/scratch1/rwgk/gcc340_mac/libtbx -lboost_python -lm
scons: done building targets.
This means linking of m1_stripped_1_ext.so was successful.
At the very end you should see:
g++ -w -bundle -
bundle_loader /System/Library/Frameworks/Python.framework/Versions/2.3/Python /S
ystem/Library/Frameworks/Python.framework/Versions/2.3/Python -o
libtbx/m1_stripped_2_ext.so boost_adaptbx/m1_stripped_2_ext.os -Llibtbx -
L/net_scarlet/scratch1/rwgk/gcc340_mac/libtbx -lboost_python -lm
/usr/bin/ld: Undefined symbols:
boost::python::converter::detail::null_ptr_owner<D* const>::value
collect2: ld returned 1 exit status
scons: *** [libtbx/m1_stripped_2_ext.so] Error 1
scons: building terminated because of errors.
The only difference between m1_stripped_1_ext.cpp and m1_stripped_2_ext.cpp
is the signature of a function:
% diff boost_adaptbx/m1_stripped_1_ext.cpp boost_adaptbx/m1_stripped_2_ext.cpp
6c6
< D take_d(D* d) { return *d; }
---
> D take_d(D* const& d) { return *d; }
Comments:
- The same source code works fine with gcc 3.4.0 20040220 under Linux.
- I've observed this bug already with gcc 3.3.1 under OS 10.2.
- Apple's compiler (Xcode 1.1, based on gcc 3.3) does not need the
workaround (but it needs other workarounds and generates
significantly slower code).
Sorry for the big package, but it would be impractical for me to work
out a smaller example. It took several hours already to prepare the set
of reports I am submitting today. I hope you have tools that make it
much easier to pin-point the root of the problem. When you run the demo
the output shows all commands used. You can copy-and-paste the commands
to run them without the build system. If you look at the .csh scripts:
"libtbx.scons" is a replacement for "make". The rest should be obvious
I hope.
--
Summary: Unresolved symbols for template instantitations
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rwgk at yahoo dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc-apple-darwin7.2.0
GCC host triplet: powerpc-apple-darwin7.2.0
GCC target triplet: powerpc-apple-darwin7.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14234