Problem with libeng.dylib and libmx.dylib for maci64
Show older comments
I am trying to call Matlab routines from a Fortran code using gfortran compiler on my Mac 10.7.3 Intel Core i7 laptop. I am getting following errors:
deb$ export DYLD_LIBRARY_PATH=/Users/deb/matlab/MATLAB_R2010a.app/bin/maci64
deb$ gfortran -I/Users/deb/matlab/MATLAB_R2010a.app/extern/include -L/Users/deb/matlab/MATLAB_R2010a.app/bin/maci64 -leng -lmx fengdemo.F
ld: warning: in /Users/deb/matlab/MATLAB_R2010a.app/bin/maci64/libeng.dylib, file is not of required architecture
ld: warning: in /Users/deb/matlab/MATLAB_R2010a.app/bin/maci64/libmx.dylib, file is not of required architecture
Undefined symbols:
"_mxdestroyarray_", referenced from:
_MAIN__ in ccHWJjnZ.o
_MAIN__ in ccHWJjnZ.o
"_engopen_", referenced from:
_MAIN__ in ccHWJjnZ.o
"_engputvariable_", referenced from:
_MAIN__ in ccHWJjnZ.o
"_engclose_", referenced from:
_MAIN__ in ccHWJjnZ.o
_MAIN__ in ccHWJjnZ.o
"_engevalstring_", referenced from:
_MAIN__ in ccHWJjnZ.o
_MAIN__ in ccHWJjnZ.o
_MAIN__ in ccHWJjnZ.o
_MAIN__ in ccHWJjnZ.o
_MAIN__ in ccHWJjnZ.o
_MAIN__ in ccHWJjnZ.o
"_mxcopyptrtoreal8730_", referenced from:
_MAIN__ in ccHWJjnZ.o
"_enggetvariable_", referenced from:
_MAIN__ in ccHWJjnZ.o
"_mxgetpr_", referenced from:
_MAIN__ in ccHWJjnZ.o
_MAIN__ in ccHWJjnZ.o
"_mxcreatedoublematrix730_", referenced from:
_MAIN__ in ccHWJjnZ.o
"_mxcopyreal8toptr730_", referenced from:
_MAIN__ in ccHWJjnZ.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I am able to compile and run the same codes successfully on a 32-bit Linux machine.
It seems that in 64-bit machine, the matlab libeng.dylib and libmx.dylib files are not of required architecture, while in the 32-bit version they are fine.
Has anyone faced the same problem? Any fix-up will be appreciated.
Best,
Kalyanmoy Deb
Answers (1)
Kaustubha Govind
on 12 Mar 2012
0 votes
I'm not a Mac user, but from my experience on Windows and Linux, it seems like the gfortran compiler may be attempting to compile a 32-bit binary, but you have the 64-bit verison of MATLAB installed (your libraries are located in a folder called maci64) and therefore have 64-bit libraries. You need to use gfortran to compile a 64-bit target to be able to link against these.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!