After the installation of the cuda-toolkit 2.3, I tried compiling the sdk examples. After changing the cuda installation path in C/common/common.mk I run in the following problem:
make[1]: Entering directory `/opt/cuda-sdk/C/src/oceanFFT'
/opt/cuda/bin/../include/math_functions.h:412: error: inline function ‘int __signbit(double)’ cannot be declared weak
/opt/cuda/bin/../include/math_functions.h:417: error: inline function ‘int __signbitf(float)’ 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:36: error: inline function ‘int __signbitf(float)’ cannot be declared weak
/usr/include/bits/mathinline.h:42: error: inline function ‘int __signbit(double)’ cannot be declared weak
/usr/include/bits/mathinline.h:48: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
/opt/cuda/bin/../include/math_functions.h:442: error: inline function ‘int __signbitl(long double)’ cannot be declared weak
make[1]: *** [obj/emurelease/oceanFFT_kernel.cu.o] Error 255
make[1]: Leaving directory `/opt/cuda-sdk/C/src/oceanFFT'
make: *** [src/oceanFFT/Makefile.ph_build] Error 2
By the way, I try to compile in emulation mode.
Does anybody have an idea how to solve this issues.
That isn’t an officially supported version, but theoretically it might work if you install gcc-4.3 and g+±4.3. You will then have to get nvcc to pick up gcc-4.3, which is probably best done by making a local directory somewhere with symlinks to the gcc and g++ executables, modifying your cuda makefile to find them, and pass that directory to nvcc via the --compiler-bindir so that nvcc picks up the right compiler.
I’m using Ubuntu 9.10 (both 32 and 64 bit), too and managed to solve the problem. I got the “declared weak” errors and read that they are caused by missing support for gcc4.x.
gcc3 seems not to be in the Ubuntu-Karmic-Repos, so I decided to compile it, but that failed (same error as here). I managed to install it by adding a dapper repo to /etc/apt/sources.list:
deb http://ubuntuarchive.eweka.nl/ubuntu/ dapper main universe restricted multiverse
Afterwards the old gcc and g++ can be installed via apt-get
Anyway, if i waste too much time with this, I’ll probably install Ubuntu 9.04. It’s a new laptop and I’m having problems with the wifi too and i think this may be another 9.10 issue. In fact i used to have Ubuntu 8.04 in the Desktop pc and i don’t like changes too much.
You could do that, but it might be better to put it somewhere else so that you only have to do it once. Perhaps create a $(HOME)/bin and put them there.
That should work, although you don’t need the paths, so in your makefile you could have something like this
CC= gcc-4.3
CXX= g++-4.3
and then use $(CC) and $(CXX) for the C and C++ compilers. That should be sufficient.
nvcc --compiler-bindir $(HOME)/bin .....
if you followed my instructions above.
Right now I think only 8.10 and 9.04 are supported. Both use gcc v4.3 and work fine with CUDA. CUDA 2.2 was the last version supported by 8.04 and 8.04 LTS, if my memory doesn’t fail me.
It seems to work if you comment out the __signbit* (…bit, …bitd, …bitf, …bitl) declarations in /usr/local/cuda/include/math_functions.h
You also have to do that with the *memset and *memcpy declarations in /usr/local/cuda/include/common_functions.h
That’s a total of 6 replacements - 4 signbit and 2 memxxx
It seems these are redundant declarations on gcc-4.4 or something, since it works fine after doing that.
You should not do this. It can have serious consequences for the rest of your operating system install. The entire distro is built with gcc-4.4 and there is a risk that hacking the system wide compiler in this fashion will break system wide things outside of CUDA. You have been warned.
Yes I understand… your concern is justified… I meant just for sake of running the program until NVIDIA added support… and then once you are done relink to the original 4.4 compiler before you close off…
I’ve solved the ‘inline function cannot be declared weak’ problem by appending ‘-fno-strict-aliasing’ to NVCCFLAGS in the makefiles of the programs I’ve tried to compile.
EDIT: grrrr, the correct NVCCFLAGS are: --compiler-options -fno-inline
have you done anything else in addition to “NVCCFLAGS += --compiler-options -fno-inline”?
I commented the math_functions.h and added the flag to common/common.mk, but my installation still complains about weak for memcpy and memset …not sure your flag helped…
any ideas? (except replacing gcc 4.4 w 4.3)
make[1]: Entering directory `/home/ana/CUDASDK/C/src/simpleCUFFT'
/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