Incubator-mxnet: when i compile mxnet on the ubuntu15.10,i got this compile error.

Created on 2 Jan 2016  Â·  26Comments  Â·  Source: apache/incubator-mxnet

ndarray.cc:(.text+0x848):对‘void mxnet::ndarray::EvalClipmshadow::gpu(mshadow::TBlob const&, float const&, float const&, mshadow::TBlob_, mxnet::RunContext)’未定义的引用
...
:对‘mxnet::opt::call_sgd_update_gpu(mxnet::RunContext, mshadow::TBlob, mshadow::TBlob, float, mxnet::opt::SGDParam const&)’未定义的引用
...
collect2: error: ld returned 1 exit status
Makefile:167: recipe for target 'bin/im2rec' failed
make: *_* [bin/im2rec] Error 1

i have no idea to overcome this, any suggestion is appreciated.

Most helpful comment

try make clean_all

All 26 comments

try make clean_all

thanks for your suggestion, but make clean_all does not solve the problem, the same compile errors prompt again.

Try make a fresh clone of the newest code and compile again.

yes, my code is out of date. thanks, but i get another error:
'''
/usr/bin/ld: skipping incompatible /usr/local/cuda-7.5/lib64/libcuda.so when searching for -lcuda
/usr/bin/ld: cannot find -lcuda
'''
does mxnet not support cuda-7.5?

I am using cuda 7.5, mxnet works well

so, any suggestion?

have you installed the nvidia driver? libcuda.so is often located at

/usr/lib/x86_64-linux-gnu/libcuda.so
/usr/lib64/libcuda.so

when you run the 'locate' cmd in your bash, can you find the path of libcuda.so?

$ locate libcuda.so

Thanks All!
i can locate the libcuda.so which link to libcuda.so.352.63
but the ld said it's incompatible
here is the details of run locate

 ~/lib/mxnet$ locate libcuda.so
/usr/lib/i386-linux-gnu/libcuda.so
/usr/lib/i386-linux-gnu/libcuda.so.1
/usr/lib/i386-linux-gnu/libcuda.so.352.63
/usr/lib/x86_64-linux-gnu/libcuda.so.1
/usr/lib/x86_64-linux-gnu/libcuda.so.352.63
/usr/local/cuda-7.5/doc/man/man7/libcuda.so.7
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcuda.so
/usr/local/cuda-7.5/targets/x86_64-linux/lib/stubs/libcuda.so
/usr/share/man/man7/libcuda.so.7.gz

and the output of ld:

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/libcuda.so when searching for -lcuda
/usr/bin/ld: skipping incompatible /usr/lib/../lib/libcuda.so when searching for -lcuda
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../libcuda.so when searching for -lcuda
/usr/bin/ld: skipping incompatible /usr/lib/libcuda.so when searching for -lcuda
/usr/bin/ld: cannot find -lcuda
collect2: error: ld returned 1 exit status
Makefile:153: recipe for target 'lib/libmxnet.so' failed
make: *** [lib/libmxnet.so] Error 1

Can you compile other program that use cuda? This looks like either your cuda is not correctly installed or your compiler tool chain is broken.

i have successfully compiled Caffe and Torch with support of cuda.

What is the version of GCC?

gcc version is 4.9.3

@tanger830 Try degrade to gcc 4.8.4 I met similar problems using higher version of gcc/g++

i have replaced gcc and g++ with gcc-4.8 and g++-4.8 in config.mk which version is 4.8.5, but the same ld error appears again :(

Do you have several CUDA installed on your machine?

I had a similar problem. I fixed it by following two steps:
make clean_all
source ~/.bashrc

try to modify the Makefile, -lcuda -> -lcudart

Hi All,
I am trying to run this program, http://www.ieap.uni-kiel.de/et/people/kruse/tutorials/cuda/tutorial01o/web01o/tutorial01o.pdf

I am having this output in terminal when I try make:
g++ main.o cuda_wrapper.o -o main -L/usr/local/cuda-5.5/lib64 -lcuda -lcudart OcelotConfig -l
/usr/bin/ld: cannot find -lcuda
/usr/bin/ld: cannot find -lcudart
collect2: error: ld returned 1 exit status
make: *** [main] Error 1

this is the make file that they have used:
CC=g++
LINKER_DIRS=-L/usr/local/cuda-5.5/lib64
LINKER_FLAGS=-lcuda -lcudart
NVCC=nvcc
CUDA_ARCHITECTURE=20
OCELOT=OcelotConfig -l

all: main

main: main.o cuda_wrapper.o
$(CC) main.o cuda_wrapper.o -o main $(LINKER_DIRS) $(LINKER_FLAGS) $(OCELOT)

main.o: main.cpp
$(CC) main.cpp -c -I .

cuda_wrapper.o: cuda_wrapper.cu
$(NVCC) -c cuda_wrapper.cu -arch=sm_$(CUDA_ARCHITECTURE)

clean:
rm -f main.o cuda_wrapper.o main

Sorry to necro this post. But I am struggling with this same issue. I was using mxnet just fine a few months ago, now some updates later. Changing the Makefile from -lcuda to -lcudart has not worked and I am getting this error:

collect2: error: ld returned 1 exit status
make: *** [bin/im2rec] Error 1

when trying to compile mxnet from scratch with CUDA enabled.

same error here, -lcudart doesn't fix. Ubuntu 16.04, CUDA V8.0.26

try to remove this line https://github.com/dmlc/mxnet/blob/master/Makefile#L52 ?

bin/im2rec is not necessary anymore. there is a python version.

compiles without the "BIN += bin/im2rec" line

Remov all 52-56 lines or just the 52th line?I am little confused. @mli

@meanmee I was able to build the code using @anttttti's suggestion to remove the line "BIN+=bin/im2rec"

@kkgadiraju that's awesome, it works!

Was this page helpful?
0 / 5 - 0 ratings