libstdc++ with gcc 4.9 on ubuntu 15.10
Peter Steinbach
steinbach at scionics.de
Wed Jan 6 12:53:38 UTC 2016
On 01/06/2016 11:56 AM, Matthias Klose wrote:
> On 06.01.2016 11:47, Peter Steinbach wrote:
>> 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
>
> -D_GLIBCXX_USE_CXX11_ABI=0 has no effect with GCC 4.9.
>
>> 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?
>
> You have to use CUDA 7.5. Afaik that's the only version supporting GCC
> 5. Or you have to rebuild every c++ library except libstdc++ using
> gcc-4.9 or gcc-5 -D_GLIBCXX_USE_CXX11_ABI=0.
>
Just tested cuda 7.5 on a very simple app:
#include "cuda.h"
#include <iostream>
int main(){
std::cout << "hw!\n";
}
and got:
$ nvcc test.cu #on ubuntu 15.10 with cuda 7.5
In file included from
/usr/local/cuda-7.5//bin/..//include/cuda_runtime.h:76:0,
from <command-line>:0:
/usr/local/cuda-7.5//bin/..//include/host_config.h:115:2: error: #error
-- unsupported GNU version! gcc versions later than 4.9 are not supported!
#error -- unsupported GNU version! gcc versions later than 4.9 are not
supported!
^
if you however run:
$ nvcc -ccbin `which g++-4.9` test.cu
it works perfectly!
More information about the Ubuntu-devel-discuss
mailing list