Problem when compiling MEX functions in Linux

51 views
Skip to first unread message

lefundes...@gmail.com

unread,
Jan 4, 2018, 6:02:59 PM1/4/18
to Robotics & Machine Vision Toolboxes
Hi,

I'm trying to compile the mex functions from the MVTB. I've made sure to install gcc 4.9 for compatibility, but still I get the following error when using either make from my system's terminal or from inside matlab:

mex CFLAGS=-std=c99 -g closest.c
Building with 'gcc'.
/usr/bin/ld: /tmp/mex_2525300140537866_21902/closest.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/tmp/mex_2525300140537866_21902/closest.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

Makefile:25: recipe for target 'mex' failed
make: *** [mex] Error 255

Any ideas on how to fix this? 

Peter Corke

unread,
Jan 8, 2018, 3:34:08 PM1/8/18
to Robotics & Machine Vision Toolboxes
I haven't built MEX files on linux for a long time, I don't have a linux machine or VM at the moment.

Sadly this is a MATLAB issue, not a toolbox issue.  Some things to try, sorry if you've already done this:

- gcc version is appropriate for the version of MATLAB
- you are using the correct mex binary
- there is a mex -setup option
- a quick google shows other people discussing this issue, eg. https://github.com/BVLC/caffe/issues/2171
- contact MATLAB technical support, that's what you pay for

peter

任春

unread,
Dec 18, 2021, 9:58:47 AM12/18/21
to Robotics & Machine Vision Toolboxes
 how do you solve it?

任春

unread,
Dec 18, 2021, 9:58:50 AM12/18/21
to Robotics & Machine Vision Toolboxes
Hi,can you tell me how do you solve this problem?I have the same question with you ,please give me the answer at your convenience.

On Friday, January 5, 2018 at 7:02:59 AM UTC+8 lefundes...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages