Boost logo

Boost Users :

Subject: [Boost-users] issues with unit tests on intel 32 bit, gcc 4.3, undefined reference to `__sync_fetch_and_add_4'
From: Maróy Ákos (akos_at_[hidden])
Date: 2009-04-13 06:22:22


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 <boost/test/unit_test.hpp>

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:

$ make tests
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_test_exec_monitor-gcc43-mt-s
-lboost_unit_test_framework-gcc43-mt-s
/home/maroy/src/tyrell/src/darksweep/usr/lib/libboost_test_exec_monitor-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_test_exec_monitor-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_test_exec_monitor-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_test_exec_monitor-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_test_exec_monitor-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 compiled boost using the following command:

bjam architecture=x86 address-model=32 link=static runtime-link=static
--prefix=../../usr --includedir=../../usr/include --libdir=../../usr/lib
install

I have the following:

$ g++ --version
g++ (Ubuntu 4.3.2-1ubuntu12) 4.3.2
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ uname -a
Linux tomodachi 2.6.27-11-generic #1 SMP Wed Apr 1 20:53:41 UTC 2009
x86_64 GNU/Linux

(basically Ubuntu 8.10 64 bit)

am I doing something wrong?


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