CudaSDK Compilation Problems: Ubuntu 9.10 (Karmic) + gcc 4.4 Troubleshooting of Cuda SDK compilation

I am Using Ubuntu Karmic (9.10) which comes with GCC 4.4

I am trying to compile cuda sdk 2.3 and I am having these messages when I try to run make on the SDK, After I add

NVCCFLAGS += --compiler-options -fno-inline

To common/common.mk

make[1]: Entering directory `/home/odin/software/cudasdk/2.3/C/common'

make[1]: Leaving directory `/home/odin/software/cudasdk/2.3/C/common'

make[1]: Entering directory `/home/odin/software/cudasdk/2.3/C/common'

make[1]: Leaving directory `/home/odin/software/cudasdk/2.3/C/common'

make[1]: Entering directory `/home/odin/software/cudasdk/2.3/C/common'

make[1]: Leaving directory `/home/odin/software/cudasdk/2.3/C/common'

make -C src/MonteCarlo/ 

make[1]: Entering directory `/home/odin/software/cudasdk/2.3/C/src/MonteCarlo'

/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

make[1]: *** [obj/release/MonteCarlo_SM10.cu_sm_10.o] Error 255

make[1]: Leaving directory `/home/odin/software/cudasdk/2.3/C/src/MonteCarlo'

make: *** [src/MonteCarlo/Makefile.ph_build] Error 2

Does anyone know how to use GCC 4.3 instead of GCC 4.4 in Ubuntu? I think that you should replace some symbolic links but I don’t know where.

Thanks

You could uninstall gcc 4.4 and install 4.3. It doesn’t take that long to do with synaptic.

How can I do this?

You can open Synaptic from System → Administration → Synaptic Package Manager

Search for gcc and you’ll see an entry for gcc-4.3. Right click on it and select “Mark for instalation”. Click on the Apply button and it will be installed.

Next you should go to /usr/bin and remake the softlink to gcc with version 4.3:

sudo rm gcc

sudo ln -s gcc-4.3 gcc

Let me know if that works ;)

Hello everybody!

I managed to work with Ubuntu 9.10 (AMD64). As you did, I installed g+±4.3 and gcc-4.3 packages and created new symlinks (I think, that is not necessary. Editing CC and CXX variables in /SDKPATH/C/common/commom.mk should be sufficient).

Owing to the fact, that I used a fresh installation, some of you may have some additional problems.

You have to install Glut (I installed the developement-packages, too), libXi-dev and libXmu-dev to get a successful sdk-compilation.

Furthermore, I got errors like …

… after compiling.

To avoid this, add the line

to /etc/ld.so.conf and run sudo ldconfig

Hi all,

I tried changing the common.mk but no luck. Then I decided to properly use the update-alternatives and it worked!

The sequence of commands is:

[codebox]sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 44 --slave /usr/bin/g++ g++ /usr/bin/g+±4.4 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.4

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 43 --slave /usr/bin/g++ g++ /usr/bin/g+±4.3 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.3[/codebox]

Note that gcc 4.4 still has higher priority when in “auto” mode. You can then check the config by typing:

[codebox]sudo update-alternatives --display gcc[/codebox]

and swap between versions with

[codebox]sudo update-alternatives --config gcc[/codebox]

Francesco

Here’s a blog post that explains how to do it in some detail:
[url=“http://moelhave.dk/2009/12/nvidia-cuda-on-ubuntu-karmic-koala/”]http://moelhave.dk/2009/12/nvidia-cuda-on-...u-karmic-koala/[/url]
You don’t have to run update-alternatives or in other ways “hide” your gcc 4.4 from the CUDA system.

ubuntu 9.10 display problem