mex: link of ' "mexGPUExample.mexa64"' failed

5 次查看(过去 30 天)
>> setenv('MW_NVCC_PATH','/usr/local/cuda-5.5/bin/nvcc') >> mex mexGPUExample.cu /usr/lib/x86_64-linux-gnu/libc_nonshared.a(atexit.oS): In function `atexit': (.text+0x12): undefined reference to `__cxa_atexit' collect2: error: ld returned 1 exit status
mex: link of ' "mexGPUExample.mexa64"' failed.
Unable to complete successfully.
>> >>
how to solve it?

回答(3 个)

Þ™
Þ™ 2013-11-27
I got it,I update my g++-4.4,so it worked.

Joao
Joao 2014-6-26
I also have this problem in a linux mint 17 Matlab R2014a cuda5.5 setup. Changing the gcc/g++ version from 4.8 to 4.7.3 did not fix the mex error.
my Matlab output is
///
>> mex -largeArrayDims mexGPUExample.cu
Building with 'nvcc'.
Error using mex
/usr/lib/x86_64-linux-gnu/libc_nonshared.a(atexit.oS): In function `atexit':
(.text+0x12): undefined reference to `__cxa_atexit'
collect2: error: ld returned 1 exit status
///
In matlab, mexing .c and .cpp files works, and in the command line nvcc .cu files works as well.
Any ideas?

Jan Barowski
Jan Barowski 2015-2-25
I got the same error using Matlab 2015 Prerelease on Ubuntu 14.04 with CUDA 6.5 and g++4.8. Thanks to Matlab support we figured out, that manually linking does the trick. Here is my compile script for the matlab mex/gpu example:
myArch = computer('arch'); pathToOpts = fullfile(matlabroot, ... 'toolbox', 'distcomp', 'gpu', ... 'extern', 'src', 'mex', myArch,'gcc',... ['mex_CUDA_' myArch '.xml']); copyfile(pathToOpts,'.','f')
mex -v -largeArrayDims mexGPUExample.cu -lstdc++ -lc
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 GPU CUDA and MEX Programming 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by