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

7 Ansichten (letzte 30 Tage)
Þ™
Þ™ am 27 Nov. 2013
Beantwortet: Jan Barowski am 25 Feb. 2015
>> 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?

Antworten (3)

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

Joao
Joao am 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?

Jan Barowski
Jan Barowski am 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!

Kategorien

Mehr zu Get Started with GPU Coder finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by