- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am having a problem with building a mex file in another thread due to an undefined symbol at execution time. I thought maybe a workaround would be to use -static-intel, but I get a different error at link time:
Thanks
I am having a problem with building a mex file in another thread due to an undefined symbol at execution time. I thought maybe a workaround would be to use -static-intel, but I get a different error at link time:
[bash]-> /opt/intel/bin/ifort -c -I/usr/local/MATLAB/R2010b/extern/include -I/usr/local/MATLAB/R2010b/simulink/include -fast -fexceptions -fpp -fPIC -static-intel -DMX_COMPAT_32 -O0 "MatlabAPI_real.f"
-> /opt/intel/bin/ifort -O -fast -static-intel -pthread -shared -Wl,--version-script,/usr/local/MATLAB/R2010b/extern/lib/glnxa64/fexport.map -Wl,--no-undefined -o "MatlabAPI_real.mexa64" MatlabAPI_real.o "MatlabAPImex.o" "MatlabAPImx.o" -Wl,-rpath-link,/usr/local/MATLAB/R2010b/bin/glnxa64 -L/usr/local/MATLAB/R2010b/bin/glnxa64 -lmx -lmex -lmat -L/opt/intel/lib/intel64 -lm -lirc
ifort: command line remark #10010: option '-pthread' is deprecated and will be removed in a future release. See '-help deprecated'
ipo: remark #11000: performing multi-file optimizations
ipo: remark #11006: generating object file /tmp/ipo_ifortPltRfV.o
ld: /opt/intel/lib/intel64/libifcoremt.a(for_contig_array.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/opt/intel/lib/intel64/libifcoremt.a: could not read symbols: Bad value
mex: link of ' "MatlabAPI_real.mexa64"' failed.
[/bash] How can I tell ifort to use libifcoremt_pic.a instead of libifcoremt.a in this case? (shouldn't it choose it automatically given that -shared is supplied?)Thanks
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
first, get rid of -fast and use -xhost -O2 instead. Don't use -fast, it changes frequently with compiler version and currently contains -ipo which you don't need for this example.
and add -mcmodel=medium to your builds
as for libifcoremt_pic.a - yes, I would have expected ifort -static-intel -fpic to pick it up automatically. that may be a bug. Try adding it manually to the last ifort command.
see if this helps.
ron
and add -mcmodel=medium to your builds
as for libifcoremt_pic.a - yes, I would have expected ifort -static-intel -fpic to pick it up automatically. that may be a bug. Try adding it manually to the last ifort command.
see if this helps.
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks very much for the advice. I am new to intel compilers and took those flags from an example mexopts.sh configuration I found online.
One question I have - in the ifort man page it says:
NOTE: When you specify -mcmodel=medium or -mcmodel=large, you must also specify compiler option -shared-intel to ensure that the correct dynamic versions of the Intel run-time libraries are used.
So I can't use it in this case? (shared-intel doesn't work at the moment due to the problem with __intel_sse2_strcpy)
One question I have - in the ifort man page it says:
NOTE: When you specify -mcmodel=medium or -mcmodel=large, you must also specify compiler option -shared-intel to ensure that the correct dynamic versions of the Intel run-time libraries are used.
So I can't use it in this case? (shared-intel doesn't work at the moment due to the problem with __intel_sse2_strcpy)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just to follow up - adding the _pic library manually did allow it to link - but unfortunately it hasn't helped, I still get the same undefined symbol error:
-> /opt/intel/bin/ifort -c -I/usr/local/MATLAB/R2010b/extern/include -I/usr/local/MATLAB/R2010b/simulink/include -xhost -fexceptions -fpp -fPIC -static-intel -DMX_COMPAT_32 -O2 "MatlabAPI_real.f"
-> /opt/intel/bin/ifort -O2 -xhost -fPIC -static-intel -pthread -shared -Wl,--version-script,/usr/local/MATLAB/R2010b/extern/lib/glnxa64/fexport.map -Wl,--no-undefined -o "MatlabAPI_real.mexa64" MatlabAPI_real.o "MatlabAPImex.o" "MatlabAPImx.o" /opt/intel/lib/intel64/libifcoremt_pic.a -Wl,-rpath-link,/usr/local/MATLAB/R2010b/bin/glnxa64 -L/usr/local/MATLAB/R2010b/bin/glnxa64 -lmx -lmex -lmat -L/opt/intel/lib/intel64 -lm -lirc
ifort: command line remark #10010: option '-pthread' is deprecated and will be removed in a future release. See '-help deprecated'
>> MatlabAPI_real
??? Invalid MEX-file
'/home/robince/src/MatlabAPI_20091219/MatlabAPI_real.mexa64':
/home/robince/src/MatlabAPI_20091219/MatlabAPI_real.mexa64: undefined
symbol: __intel_sse2_strcpy.
robince@linux407:~/src/MatlabAPI_20091219$ ldd MatlabAPI_real.mexa64
linux-vdso.so.1 => (0x00007fffba8dc000)
libmx.so => not found
libmex.so => not found
libmat.so => not found
libm.so.6 => /lib/libm.so.6 (0x00007fcf4f407000)
libirc.so => /opt/intel/lib/intel64/libirc.so (0x00007fcf4f2b7000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007fcf4f099000)
libc.so.6 => /lib/libc.so.6 (0x00007fcf4ed16000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fcf4eb00000)
libdl.so.2 => /lib/libdl.so.2 (0x00007fcf4e8fb000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcf4f9c0000)
Thanks
-> /opt/intel/bin/ifort -c -I/usr/local/MATLAB/R2010b/extern/include -I/usr/local/MATLAB/R2010b/simulink/include -xhost -fexceptions -fpp -fPIC -static-intel -DMX_COMPAT_32 -O2 "MatlabAPI_real.f"
-> /opt/intel/bin/ifort -O2 -xhost -fPIC -static-intel -pthread -shared -Wl,--version-script,/usr/local/MATLAB/R2010b/extern/lib/glnxa64/fexport.map -Wl,--no-undefined -o "MatlabAPI_real.mexa64" MatlabAPI_real.o "MatlabAPImex.o" "MatlabAPImx.o" /opt/intel/lib/intel64/libifcoremt_pic.a -Wl,-rpath-link,/usr/local/MATLAB/R2010b/bin/glnxa64 -L/usr/local/MATLAB/R2010b/bin/glnxa64 -lmx -lmex -lmat -L/opt/intel/lib/intel64 -lm -lirc
ifort: command line remark #10010: option '-pthread' is deprecated and will be removed in a future release. See '-help deprecated'
>> MatlabAPI_real
??? Invalid MEX-file
'/home/robince/src/MatlabAPI_20091219/MatlabAPI_real.mexa64':
/home/robince/src/MatlabAPI_20091219/MatlabAPI_real.mexa64: undefined
symbol: __intel_sse2_strcpy.
robince@linux407:~/src/MatlabAPI_20091219$ ldd MatlabAPI_real.mexa64
linux-vdso.so.1 => (0x00007fffba8dc000)
libmx.so => not found
libmex.so => not found
libmat.so => not found
libm.so.6 => /lib/libm.so.6 (0x00007fcf4f407000)
libirc.so => /opt/intel/lib/intel64/libirc.so (0x00007fcf4f2b7000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00007fcf4f099000)
libc.so.6 => /lib/libc.so.6 (0x00007fcf4ed16000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fcf4eb00000)
libdl.so.2 => /lib/libdl.so.2 (0x00007fcf4e8fb000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcf4f9c0000)
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I made a mistake! I was still manually adding -lirc from the other problem, it seems to be this library that has the undefined symbol. When I removed it the static version seems to work.
Thanks again,
Thanks again,
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page