issues with unit tests on intel 32 bit, gcc 4.3, undefined reference to `__sync_fetch_and_add_4'
Hi,
I'm having an issue to link a boost unit test application on a Linux
box, which is 64 bit - but I want to create a 32 bit application.
I saw the following bug report: https://svn.boost.org/trac/boost/ticket/2525
and applied to patches attached, but to no avail. I also tried the
latest svn trunk of boost, but still no luck.
I'm trying to compile & link the following simple sample app:
#include
Maróy Ákos
Hi,
I'm having an issue to link a boost unit test application on a Linux box, which is 64 bit - but I want to create a 32 bit application.
How did you build Boot.Test library? what variant r u using? Static or shared?
I'm trying to compile & link the following simple sample app:
#include
using namespace boost::unit_test;
test_suite * init_unit_test_suite(int, char ** const) { test_suite *ts = BOOST_TEST_SUITE("test_suite"); framework::master_test_suite().add(ts);
return 0; }
I get the following results:
... /home/maroy/src/tyrell/src/darksweep/usr/lib/ libboost_test_exec_monitor-gcc43-mt-s.a(framework.o): You should not use test_exec_monitor. You should link with boost_unit_test_framework. I'd suggest you to try to use single header variant of Boost.Test and thus avoid any linking issues.
$ g++ --version g++ (Ubuntu 4.3.2-1ubuntu12) 4.3.2 $ uname -a Linux tomodachi 2.6.27-11-generic #1 SMP Wed Apr 1 20:53:41 UTC 2009 x86_64 GNU/Linux
I can try to reproduce this. But I'll need to find vmware image for that. Do you know where i can find one? Gennadiy
Gennadiy,
I'm having an issue to link a boost unit test application on a Linux box, which is 64 bit - but I want to create a 32 bit application.
How did you build Boot.Test library? what variant r u using? Static or shared?
I compiled it the following way: bjam architecture=x86 address-model=32 link=static runtime-link=static --prefix=../../usr --includedir=../../usr/include --libdir=../../usr/lib install I'm trying to use the static version
You should not use test_exec_monitor. You should link with boost_unit_test_framework.
linking only to boost_unit_test_framework gives the same results: p$ make g++ -m32 -L/home/maroy/src/tyrell/src/darksweep/usr/lib -I/home/maroy/src/tyrell/src/darksweep/usr/include/boost-1_39 -o tests tests.cpp -lboost_unit_test_framework-gcc43-mt-s /home/maroy/src/tyrell/src/darksweep/usr/lib/libboost_unit_test_framework-gcc43-mt-s.a(framework.o): In function `boost::unit_test::framework::register_test_unit(boost::unit_test::test_suite*)': framework.cpp:(.text+0x4a4): undefined reference to `__sync_fetch_and_add_4' /home/maroy/src/tyrell/src/darksweep/usr/lib/libboost_unit_test_framework-gcc43-mt-s.a(framework.o): In function `boost::unit_test::framework::register_test_unit(boost::unit_test::test_case*)': framework.cpp:(.text+0x648): undefined reference to `__sync_fetch_and_add_4' framework.cpp:(.text+0x713): undefined reference to `__sync_fetch_and_add_4' /home/maroy/src/tyrell/src/darksweep/usr/lib/libboost_unit_test_framework-gcc43-mt-s.a(framework.o): In function `boost::unit_test::framework::get(unsigned long, boost::unit_test::test_unit_type)': framework.cpp:(.text+0x14fb): undefined reference to `__sync_fetch_and_add_4' /home/maroy/src/tyrell/src/darksweep/usr/lib/libboost_unit_test_framework-gcc43-mt-s.a(framework.o): In function `boost::unit_test::framework::run(unsigned long, bool)': framework.cpp:(.text+0x3151): undefined reference to `__sync_fetch_and_add_4' /home/maroy/src/tyrell/src/darksweep/usr/lib/libboost_unit_test_framework-gcc43-mt-s.a(framework.o):framework.cpp:(.text._ZN5boost9unit_test9framework11setup_errorC1ENS0_13basic_cstringIKcEE[boost::unit_test::framework::setup_error::setup_error(boost::unit_test::basic_cstring<char const>)]+0x5c): more undefined references to `__sync_fetch_and_add_4' follow collect2: ld returned 1 exit status make: *** [tests] Error 1
I'd suggest you to try to use single header variant of Boost.Test and thus avoid any linking issues.
hm, which would be...? this is my source code:
#include
$ g++ --version g++ (Ubuntu 4.3.2-1ubuntu12) 4.3.2 $ uname -a Linux tomodachi 2.6.27-11-generic #1 SMP Wed Apr 1 20:53:41 UTC 2009 x86_64 GNU/Linux
I can try to reproduce this. But I'll need to find vmware image for that. Do you know where i can find one?
this seems to be one: Ubuntu 8.10 Desktop 64-Bit (amd64) VMWare Virtual Machine http://www.mininova.org/tor/2013073 thanks for the help, Akos
Maróy Ákos
I'd suggest you to try to use single header variant of Boost.Test and thus avoid any linking issues.
hm, which would be...? this is my source code:
#include
#include
using namespace boost::unit_test;
test_suite * init_unit_test_suite(int, char ** const) { test_suite *ts = BOOST_TEST_SUITE("test_suite"); framework::master_test_suite().add(ts);
return 0; }
And remove any libs from link line. Gennadiy
Gennadiy, Gennadiy Rozental wrote:
Maróy Ákos
writes: I'd suggest you to try to use single header variant of Boost.Test and thus avoid any linking issues. hm, which would be...? this is my source code:
#include
#include
using namespace boost::unit_test;
test_suite * init_unit_test_suite(int, char ** const) { test_suite *ts = BOOST_TEST_SUITE("test_suite"); framework::master_test_suite().add(ts);
return 0; }
And remove any libs from link line.
works wonderfully - thank you! Akos
participants (2)
-
Gennadiy Rozental
-
Maróy Ákos