mex: link of ' "mexGPUExample.mexa64"' failed
3 views (last 30 days)
Show older comments
>> 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?
0 Comments
Answers (3)
Joao
on 26 Jun 2014
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?
0 Comments
Jan Barowski
on 25 Feb 2015
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!
0 Comments
See Also
Categories
Find more on Get Started with GPU Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!