Hi - 

I am the developer of a CUDA library and the users recently reported a bug for 
ubuntu 15.10. As CUDA currently does not support gcc 5.*, I have to compile all 
host binaries with gcc-4.9. The funny thing, my build system bails out with the 
following error message when linking to libboost_unit_test_framework which I 
was able to reproduce with the attached source code:

$ gcc-4.9 -D_GLIBCXX_USE_CXX11_ABI=0 external_main_example_1.cpp 
-lboost_unit_test_framework
tmp/ccDk5v3M.o: In function 
`boost::unit_test::make_test_case(boost::unit_test::callback0<boost::unit_test::ut_detail::unused>
 const&, boost::unit_test::basic_cstring<char const>)':
external_main_example_1.cpp:(.text._ZN5boost9unit_test14make_test_caseERKNS0_9callback0INS0_9ut_detail6unusedEEENS0_13basic_cstringIKcEE[_ZN5boost9unit_test14make_test_caseERKNS0_9callback0INS0_9ut_detail6unusedEEENS0_13basic_cstringIKcEE]+0x42):
 undefined reference to 
`boost::unit_test::ut_detail::normalize_test_case_name(boost::unit_test::basic_cstring<char
 const>)'
collect2: error: ld returned 1 exit status

The above follows the recommendations from 
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html. Note that, 
if I build boost with gcc 4.9 on 15.10, the above works as expected.

I was wondering if this is a known feature of the ubuntu boost distro? Are 
there any workarounds to this, that I potentially overlooked?

Best,
Peter
#ifndef BOOST_TEST_DYN_LINK
#define BOOST_TEST_DYN_LINK
#endif
#include <boost/test/unit_test.hpp>
#include <boost/bind.hpp>
using namespace boost::unit_test;

//____________________________________________________________________________//

void free_test_function( int i, int j )
{
    BOOST_CHECK_EQUAL( i, j );
}

//____________________________________________________________________________//

bool
init_function()
{
    framework::master_test_suite().
        add( BOOST_TEST_CASE( boost::bind( &free_test_function, 1, 1 ) ) );
    framework::master_test_suite().
        add( BOOST_TEST_CASE( boost::bind( &free_test_function, 1, 2 ) ) );
    framework::master_test_suite().
        add( BOOST_TEST_CASE( boost::bind( &free_test_function, 2, 1 ) ) );

    // do your own initialization here
    // if it successful return true

    // But, you CAN'T use testing tools here

    return true;
}

//____________________________________________________________________________//

int
main( int argc, char* argv[] )
{
    return ::boost::unit_test::unit_test_main( &init_function, argc, argv );
}

//____________________________________________________________________________//
-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss

Reply via email to