Boost logo

Boost Users :

From: Chris Uzdavinis (cuzdav_at_[hidden])
Date: 2007-05-14 17:21:27


Hi, I'm trying out boost 1.34 and running into some troubles getting
my test programs to link. They were working fine with 1.33.1, and
rebuilding with 1.34 now fails to find "main" in the boost unit test
framework library. After a little investigation, I found that the .so
does not have main() in it, but the .a does.

System: suse linux 9.1
compiler: g++ 3.3.3
boost version: 1.34

I built boost by simply issuing: ./configure && make && make install

I've searched for hints what may have changed or why it's no longer
working (that is, what I'm doing wrong) but I just don't see any
relevant documentation. The most suspicious part is the difference
from the shared library and the archive file.

$ nm -a /usr/local/lib/libboost_unit_test_framework-gcc33-mt-d.so | grep main
00077498 d DW.ref._ZTISt12domain_error
000582b8 t _GLOBAL__I__ZN5boost9unit_test49_GLOBAL__N_libs_test_src_unit_test_main.cppiMDvta17results_collectorE
00000000 a unit_test_main.cpp
00057f68 T _ZN5boost9unit_test14unit_test_mainEPFbvEiPPc
00082bd0 B _ZN5boost9unit_test49_GLOBAL__N_libs_test_src_unit_test_main.cppiMDvta17results_collectorE
00077408 V _ZTISt12domain_error
000727b8 V _ZTSSt12domain_error
$

$nm -a /usr/local/lib/libboost_unit_test_framework-gcc33-mt-d.a | grep main
00000000 V _ZTISt12domain_error
00000000 V _ZTSSt12domain_error
unit_test_main.o:
000002bc t _GLOBAL__I__ZN5boost9unit_test49_GLOBAL__N_libs_test_src_unit_test_main.cpprMsLbd17results_collectorE
00000210 T main
00000000 a unit_test_main.cpp
00000000 T _ZN5boost9unit_test14unit_test_mainEiPPc
00000000 B _ZN5boost9unit_test49_GLOBAL__N_libs_test_src_unit_test_main.cpprMsLbd17results_collectorE
$

For a simple example:

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE(mytest)
{
}

$g++ mytest.cpp -I $BOOST_HDRDIR -L $BOOST_ROOT/lib
-lboost_unit_test_framework-gcc33-mt-d

/usr/lib/gcc-lib/i586-suse-linux/3.3.3/../../../crt1.o(.text+0x18): In
function `_start':
../sysdeps/i386/elf/start.S:98: undefined reference to `main'
collect2: ld returned 1 exit status

Suggestions welcome. Thanks.

Chris


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net