Problem with linked library in a compiled MEX function
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm attempting to use a compiled MEX function as part of some code for image analysis. I'm using MATLAB R2018a on an Ubuntu 16.04 machine. The function is compiled using the Intel C++ compiler, with the following command:
icc -c elipsoid_em_12.cpp -DMKL_ILP64 -fPIC -debug expr-source-pos -ftz -xHost -I$MATLAB_ROOT/extern/include -I$MKLROOT/include -O3 -fp-model fast=2 -DNDEBUG -qopt-matmul -axAVX -static -qopenmp-stubs
Then there is a command to create links to various Intel libraries:
icc -o elipsoid_em_12.mexa64 elipsoid_em_12.o -shared -L$MATLAB_ROOT/bin/glnxa64 -L$MKLROOT/lib/intel64 -lmx -lmex -lmat -lut -lstdc++ -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_core.a ${MKLROOT}/lib/intel64/libmkl_intel_thread.a -Wl,--end-group -lpthread -lm
In these commands, $MATLAB_ROOT is the Matlab root directory (in /usr/local in my case), and $MKLROOT is the directory within the Intel System Studio 2018 tree that contains various MKL libraries. There are several of these, I'm using system_studio_2018/compilers_and_libraries.
The problem is that when the MEX function is called, a library called libirng.so is not found. This library is present in various spots in the System Studio directory, and I have tried adding it to the icc commands using -I and -L, but this does not work. I've also tried just directly copying it into bin/glnxa64 in the MATLAB directory. In this case, the library is found, but I get a different error message:
/usr/local/MATLAB/R2018a/bin/glnxa64/libirng.so: undefined symbol: __intel_skx_avx512_memcpy.
Not really sure what's going on here, so any tips would be much appreciated. Thanks!
0 Kommentare
Antworten (1)
Kenny Shu
am 14 Mai 2018
The errors are likely occurring due to compiler incompatibilities with MATLAB R2018a.
Check that the supported version of GCC C/C++ is installed and enabled through "mex -setup". The supported compilers for R2018a can be found here .
0 Kommentare
Siehe auch
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!