You are not logged in.

#1 2012-07-04 09:43:28

kyoko
Member
Registered: 2012-01-06
Posts: 18

[SOLVED] NVCC issues again

Hello.
I have the last version of cuda-toolkit and gcc 4.7.1. The issues with nvcc and gcc 4.7 are well-known, so I installed gcc44 package from AUR and created symlinks to /opt/cuda-toolkit/bin/gcc. My little test .cu file compiled successfully, but it seems I ran into linkage troubles:

% nvcc test.cu   
/opt/cuda-toolkit/bin//../lib64/libcudart.so: undefined reference to `std::_List_node_base::_M_unhook()@GLIBCXX_3.4.14'
/opt/cuda-toolkit/bin//../lib64/libcudart.so: undefined reference to `std::_List_node_base::_M_hook(std::_List_node_base*)@GLIBCXX_3.4.14'
collect2: ld returned 1 exit status

I'm sure my question is stupid, but what should I do?

Last edited by kyoko (2012-07-04 20:43:46)


Sorry for my English

Offline

#2 2012-07-04 10:29:34

stephane
Forum Fellow
Registered: 2009-10-18
Posts: 25

Re: [SOLVED] NVCC issues again

We have gcc4.6 in [extra]. Does it work with it ?

Offline

#3 2012-07-04 10:49:49

kyoko
Member
Registered: 2012-01-06
Posts: 18

Re: [SOLVED] NVCC issues again

stephane wrote:

We have gcc4.6 in [extra]. Does it work with it ?

I tried, but It didn't work. It's clear that nvcc needs gcc 4.4. I suppose the linkage issue is glibc-related.

Last edited by kyoko (2012-07-04 10:50:53)


Sorry for my English

Offline

#4 2012-07-04 20:37:49

kyoko
Member
Registered: 2012-01-06
Posts: 18

Re: [SOLVED] NVCC issues again

It seems something was wrong with my hands smile Waf build system built my project successfully.

Last edited by kyoko (2012-07-04 20:38:21)


Sorry for my English

Offline

#5 2012-10-04 19:19:36

dandaman0061
Member
From: Boise, ID
Registered: 2009-05-06
Posts: 12

Re: [SOLVED] NVCC issues again

I don't suppose you have any more details on what was wrong do you?  I'm running into the same thing.

If I try and compile with the release gcc (4.7) I receive a ton of __atomic_fetch_add - which is a known and reported bug.
I built gcc44 from AUR and when using that for the nvcc compiler I receive the same "undefined reference ... GLIBC" errors as your first post.

It seems that I have solved this before, but don't remember how.

It is annoying, but I *can* compile with 4.4, and link with 4.7, so I believe it is something with gcc44 not using the proper linker/linking flags.  Any help is appreciated.

*EDIT*:  I AM able to compile successfully with gcc44 by explicitly passing -L/usr/lib on the nvcc command line.  I'll look for an option to put into nvcc.profile to make this default.

nvcc --compiler-bindir=/opt/gcc-4.4 -L/usr/lib junk.cu

Last edited by dandaman0061 (2012-10-04 19:22:54)

Offline

#6 2012-10-04 19:31:27

dandaman0061
Member
From: Boise, ID
Registered: 2009-05-06
Posts: 12

Re: [SOLVED] NVCC issues again

Alright - here are the lines I added to my /opt/cuda-toolkit/bin/nvcc.profile to make it work:

# the -L/usr/lib is a hack to get around GLIBC linking errors with libcudart
compiler-bindir = /opt/gcc-4.4/
LIBRARIES += $(_SPACE_) -L/usr/lib

You can run nvcc -v to have it print out what env vars it is using.

Offline

#7 2012-10-04 20:00:24

kyoko
Member
Registered: 2012-01-06
Posts: 18

Re: [SOLVED] NVCC issues again

As I recall, I made symlink: /opt/cuda-toolkit/bin/gcc -> /usr/bin/gcc-4.4
My nvcc.profile:

TOP              = $(_HERE_)/..

LD_LIBRARY_PATH += $(TOP)/lib:$(TOP)/extools/lib:
PATH            += $(TOP)/open64/bin:$(TOP)/nvvm:$(_HERE_):

INCLUDES        +=  "-I$(TOP)/include" "-I$(TOP)/include/cudart" $(_SPACE_)

LIBRARIES        =+ $(_SPACE_) "-L$(TOP)/lib$(_TARGET_SIZE_)" -lcudart

CUDAFE_FLAGS    +=
OPENCC_FLAGS    +=
PTXAS_FLAGS     +=


Sorry for my English

Offline

#8 2012-10-04 21:55:18

dandaman0061
Member
From: Boise, ID
Registered: 2009-05-06
Posts: 12

Re: [SOLVED] NVCC issues again

Yeah, that looks like the standard nvcc.profile that's included with the cuda-toolkit package.

On a side note, I built gcc46 from the AUR and was able to run nvcc fine with that and doesn't require the explicit -L/usr/lib.  I'm not too sure what NVIDIA's stated compiler support is, probably 4.4 but I couldn't find anything recent saying so.  I saw in a debian mailing list that CUDA 5 works with gcc4.6 which made me start this next step.

I'll probably keep it running with gcc46 until I learn a reason not to, thanks for your reply though.

Offline

Board footer

Powered by FluxBB