g++ 4.7 - CUDA 5.5 RC with g++ 4.7 and 4.8: __int128 build errors -


i'm trying compile code cuda sdk 5.5 rc , g++ 4.7 on macos x 10.8. if understand correctly cuda 5.5 should work g++ 4.7. looking @ /usr/local/cuda/include/host_config.h should work g++ 4.8.

concerning g++ 4.8: tried compile following program:

// example.cu #include <stdio.h> int main(int argc, char** argv) {   printf("hello world!\n");   return 0; } 

but fails:

$ nvcc example.cu -ccbin=g++-4.8 /usr/local/cellar/gcc48/4.8.1/gcc/include/c++/4.8.1/cstdlib(178): error: identifier "__int128" undefined /usr/local/cellar/gcc48/4.8.1/gcc/include/c++/4.8.1/cstdlib(179): error: identifier "__int128" undefined 2 errors detected in compilation of "/tmp/tmpxft_00007af2_00000000-6_example.cpp1.ii". 

the same program compiles , runs g++ 4.7:

$ nvcc example.cu -ccbin=g++-4.7 $ ./a.out  hello world! 

but if include <limits>...

// example_limits.cu #include <stdio.h> #include <limits> int main(int argc, char** argv) {   printf("hello world!\n");   return 0; } 

... g++ 4.7 fails. build log located here: https://gist.github.com/lysannschlegel/6121347
there can find few other errors, i'm not totally sure if related __int128 missing.
other standard library includes break build on g++ 4.7 well, limits 1 tripped over.

i tried g++ 4.5 because happen have on machine (you can never have many compiler versions, can you?), , works.

can expect fixed in release of cuda 5.5? (i hope nvidia doesn't go supporting gcc version 4.6.)
there way work around in meantime?

update:

as @talonmies points out below, not strictly bug in cuda 5.5 on macos gcc not officially supported on macos. many third-party libraries don't handle supported toolchains, clang or llvm-gcc (llvm-gcc being 2007....), there still need make gcc work. gcc 4.6 should work fine (i tested 4.5 only).
can make gcc 4.7 work using trick pointed out @benc in comments:

$ cat compatibility.h  #undef _glibcxx_atomic_builtins #undef _glibcxx_use_int128  $ nvcc example_limits.cu -ccbin=g++-4.7 --pre-include compatibility.h 

nvcc gcc 4.8 still chokes on __int128 in cstdlib. guess cstdlib included before --pre-include files included.

you need read macos getting started guide more closely:

to use cuda on system, need following installed:

cuda-capable gpu

‣ mac osx v. 10.7.5 or later

‣ gcc or clang compiler , toolchain installed using xcode

‣ nvidia cuda toolkit (available @ http://developer.nvidia.com/cuda-downloads)

that means precisely says - use compiler(s) ships xcode. don't use self-built gcc version because isn't guaranteed work, if compiler version listed being supported on other platforms , if trivial code appears compile correctly.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -