[Boost.Test] shared lib (.so) has no main(), static (.a) does
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
Hi Chris ! An'n Maandag 14 Mai 2007 hett Chris Uzdavinis schreven:
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.
Yes.
System: suse linux 9.1 compiler: g++ 3.3.3 boost version: 1.34 $g++ mytest.cpp -I $BOOST_HDRDIR -L $BOOST_ROOT/lib -lboost_unit_test_framework-gcc33-mt-d
You have to define BOOST_TEST_DYN_LINK when using the shared test library on all platforms. Please try to add -DBOOST_TEST_DYN_LINK to your command line... Yours, Jürgen -- * Dipl.-Math. Jürgen Hunold ! Ingenieurgesellschaft für * voice: ++49 511 262926 57 ! Verkehrs- und Eisenbahnwesen mbH * fax : ++49 511 262926 99 ! Lister Straße 15 * juergen.hunold@ivembh.de ! www.ivembh.de * * Geschäftsführer: ! Sitz des Unternehmens: Hannover * Prof. Dr.-Ing. Thomas Siefer ! Amtsgericht Hannover, HRB 56965 * PD Dr.-Ing. Alfons Radtke !
"Chris Uzdavinis"
#define BOOST_TEST_MAIN #include
BOOST_AUTO_TEST_CASE(mytest) { } $g++ mytest.cpp -I $BOOST_HDRDIR -L $BOOST_ROOT/lib -lboost_unit_test_framework-gcc33-mt-d
Try to add -static before -l or rename shared libary version of the Unit test framework. This is currently is being descussed and there maybe some other options suggested. Gennadiy
participants (3)
-
Chris Uzdavinis
-
Gennadiy Rozental
-
Jürgen Hunold