Showing posts with label gcc. Show all posts
Showing posts with label gcc. Show all posts

CUDA 3.0 and gcc 4.4.x

Thursday, October 21, 2010

Deadly combination! Compilation breaks when you try to do make on NVidia SDK example projects even. Problem is with nvcc incompatibility. A gcc version of 4.3.x works fine (as of this date).


Here is the compilation error listing:
/usr/include/string.h:43: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/string.h:64: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:49: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/include/bits/string3.h:78: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/local/cuda/bin/../include/common_functions.h:59: error: inline function ‘void* memset(void*, int, size_t)’ cannot be declared weak
/usr/local/cuda/bin/../include/common_functions.h:62: error: inline function ‘void* memcpy(void*, const void*, size_t)’ cannot be declared weak
/usr/local/cuda/bin/../include/math_functions.h:422: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/local/cuda/bin/../include/math_functions.h:427: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/local/cuda/bin/../include/math_functions.h:440: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathcalls.h:350: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/include/bits/mathinline.h:38: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathinline.h:50: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/include/bits/mathinline.h:62: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/usr/include/c++/4.4/i486-linux-gnu/bits/c++locale.h: In function ‘int std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)’:
/usr/include/c++/4.4/i486-linux-gnu/bits/c++locale.h:86: error: ‘__builtin_stdarg_start’ was not declared in this scope
dxtc.cu: In function ‘int main(int, char**)’:
dxtc.cu:789: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
make[1]: *** [obj/i386/release/dxtc.cu.o] Error 1

Fixing the error basically means commenting out the specific lines in math_functions.h and common_functions.h on which the compiler shows the error (shown in dark blue).

Solution: comment them out. This will fix compilation errors. I have not tested the side-effect of this hack. But as for fixing compilation break, it works!

Note:
I needed a few more steps:
1. Uninstall gcc-4.4.x, g++-4.4.x (and all 4.4.x libraries)
2. Install gcc and g++ 4.3.x versions.
3. ln -s /usr/bin/gcc-4.3. /usr/bin/gcc
4. ln -s /usr/bin/g++-4.3. /usr/bin/g++
5. Install libXi-dev (since -lXi failed)
6. Install libxmu-dev (since -lxmu failed)

Steps 5,6 were required when I tried to build GL applications like fluidGL, simpleGL etc.

Related links:


Read more...