gcc 7.3.0 and mex functions on linux

2 views (last 30 days)
Ed Mendes
Ed Mendes on 7 May 2018
Commented: 李 李 on 2 Jul 2023
Hello I know that latest gcc compiler version for the latest matlab release is 6.3.x. However since I had to upgrade my notebook to ubuntu bionic I wonder whether there is a way to use 7.3 instead.
The first thing I tried was to compile yprime.c and then test it. It worked but there is something odd going on (it does not work for more complicated mex function though).
ld yprime.mexa64
ld: warning: libmx.so, needed by yprime.mexa64, not found (try using -rpath or -rpath-link)
ld: warning: libmex.so, needed by yprime.mexa64, not found (try using -rpath or -rpath-link)
ld: warning: cannot find entry symbol _start; not setting start address
yprime.mexa64: undefined reference to `mxIsDouble'
yprime.mexa64: undefined reference to `mxGetM'
yprime.mexa64: undefined reference to `mxIsComplex'
yprime.mexa64: undefined reference to `mxIsSparse'
yprime.mexa64: undefined reference to `mexErrMsgIdAndTxt'
yprime.mexa64: undefined reference to `mxGetN'
yprime.mexa64: undefined reference to `mexWarnMsgIdAndTxt'
yprime.mexa64: undefined reference to `mxCreateDoubleMatrix_730'
yprime.mexa64: undefined reference to `mxGetPr'
libmex.so is under MATLABROOT/bin/glnxa64 as usual and one of the flags points exactly to that directory. Using a makefile I managed to get rid of the warnings but not of the "undefined reference", although all the possible paths and libs were included during compilation and linking process.
Is there a way around? Or I don't have a choice but to downgrade gcc? If that is the case, is there a recipe to be followed?
Many thanks
Ed

Answers (1)

Ed Mendes
Ed Mendes on 8 May 2018
I managed to get rid of part of messages using the rpath and rpath-link, however mex still complains on some missing libraries.
ld: warning: libmwboost_chrono.so.1.56.0, needed by libmwboost_log.so.1.56.0, not found (try using -rpath or -rpath-link)
ld: warning: libicudata.so.59, needed by libmwboost_log.so.1.56.0, not found (try using -rpath or -rpath-link)
ld: warning: cannot find entry symbol _start; not setting start address
bin/glnxa64/libmwservices.so: undefined reference to `mwboost::chrono::steady_clock::now()'
bin/glnxa64/libicuuc.so.59: undefined reference to `icudt59_dat'
bin/glnxa64/libmwmvm.so: undefined reference to `mwboost::chrono::system_clock::now()'
Another observation, when trying using my own Makefiles I had to be extremely careful where to place -lmex -lex .... They have to placed between the include dirs and the lib dirs. This happens only on linux. On macos I had no problem.
Compiling mex on linux machines used to be pretty straightforward but that has definitely changed.
  2 Comments
y cj
y cj on 13 Feb 2019
Have you solved this problem?
李 李
李 李 on 2 Jul 2023
Have you solved this problem?I encountered the same problem

Sign in to comment.

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!