Clear Filters
Clear Filters

Mex does not accept -g?

3 views (last 30 days)
Erik Keever
Erik Keever on 7 Apr 2020
Hello, I have suddenly collided with a rather frightening problem. I have a code that is about an even split between a compiled/gpu-accelerated core and matlab high level stuff. The flow to creating the mex files goes as (ignoring most of the compiler options ofc):
nvcc -g -cuda foo1.cu % creates cuda fatbins in .cpp files
g++ -fPIC -g -c foo1.cpp % compile cpp to object code
(...)
mex -g -c interface.cpp % compile interface
mex -cxx foo1.o foo2.o fooN.o interface.o -output bar % link
And this rewards me with:
'/home/erik-k/code/bar.mexa64' is not a MEX file. For more information, see <a href="matlab: helpview([docroot '/matlab/helptargets.map'],'ENOTMEX')">File is not a MEX file</a>.
make: *** [Makefile:77: bar] Error 255
After some frustration and bisection, I eventually found that removing -g from the interface.cpp compile "fixes" the problem. The biggest thing I cannot understand is, the output from nm shows that the mexFunction symbol IS PRESENT in the "bad" mex file. Does -g break the little hidden "version info" object file that mex makes/links with the input code?
I noticed this began after I upgraded from matlab 2018b to 2019b.

Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!