FS#29359 - [cuda-toolkit] Incompatibility with GCC 4.7
Attached to Project:
Community Packages
Opened by Anonymous (Kyouko) - Monday, 09 April 2012, 17:08 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Saturday, 24 November 2012, 01:52 GMT
Opened by Anonymous (Kyouko) - Monday, 09 April 2012, 17:08 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Saturday, 24 November 2012, 01:52 GMT
|
Details
Description:
nvcc compiler is currently incompatible with GCC 4.7. http://forums.developer.nvidia.com/devforum/discussion/6336/cuda-sdk-4-1-and-gcc-4-7-0/p1 I think the dependency gcc<=4.6.3 should be added. Steps to reproduce: 1) Create test file: [test.cu] #include <iostream> int main () { std::cout<<"Hello world!"; return 0; } [/test.cu] 2) Try to compile it: # nvcc test.cu Errors: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ext/atomicity.h(48): error: identifier "__atomic_fetch_add" is undefined /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ext/atomicity.h(52): error: identifier "__atomic_fetch_add" is undefined 2 errors detected in the compilation of "/tmp/tmpxft_000023a4_00000000-4_main.cpp1.ii". |
This task depends upon
Closed by Sven-Hendrik Haase (Svenstaro)
Saturday, 24 November 2012, 01:52 GMT
Reason for closing: Upstream
Additional comments about closing: See comments.
Saturday, 24 November 2012, 01:52 GMT
Reason for closing: Upstream
Additional comments about closing: See comments.
Other than that, there may be other tags that we may need to undef. Currently, undefing the following in cuda.h helps
#undef _GLIBCXX_ATOMIC_BUILTINS
#undef _GLIBCXX_USE_INT128
I can send in a patch (pretty trivial actually) if that helps. I think it would be nice if this is added as a comment atleast.
The patch I thought would work isnt. The two undefs have to be included in the .cu files before any other header.
Trying to push it up to any of the header files didn't work.
Sorry about the false hopes. I am trying to hack with the cuda/bin/nvcc.profile to see if something can be done.
Can you close this for now, I will contact you directly with the patch if I can finally fix it.
(which just contains the two undefs above) works for me. Are there pitfalls with routing calls to nvcc through a shell script?
I can confirm this works for me as well.
#!/bin/sh
DIR=$(dirname $0)
$DIR/nvcc.bin --pre-include /usr/local/include/gcc_cuda_compat.h $@