".mexa64: cannot dynamically load executable" problem

2 views (last 30 days)
I am compiling a mexa64 file in Ubuntu 12.04 with matlab 2013a. I used gcc, g++, gfortran, all with version 4.6.3. I can compile it without showing error, and get the .mexa64 executable. However, when executing the executable, the above error message shows up:
-----------
"Invalid MEX-file '/home/lxzhu/cas2d/src/caspol2d.mexa64': /home/lxzhu/cas2d/src/caspol2d.mexa64: cannot dynamically load executable"
-----------
I used the ldd command to check the dependency, which is shown as follows and seems fine:
-------------
>> !ldd caspol2d.mexa64 linux-vdso.so.1 => (0x00007fff79bf8000) /opt/MATLAB/R2013a/bin/glnxa64/libmx.so (0x00007f8100578000) /opt/MATLAB/R2013a/bin/glnxa64/libmex.so (0x00007f8100350000) /usr/lib/liblapack.so.3gf (0x00007f80ff730000) /usr/lib/libblas.so.3gf (0x00007f80ff1c0000) /opt/MATLAB/R2013a/sys/os/glnxa64/libgfortran.so.3 (0x00007f80feea8000) /opt/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6 (0x00007f80feb98000) /lib/x86_64-linux-gnu/libm.so.6 (0x00007f80fe898000) /opt/MATLAB/R2013a/sys/os/glnxa64/libgcc_s.so.1 (0x00007f80fe680000) /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f80fe460000) /lib/x86_64-linux-gnu/libc.so.6 (0x00007f80fe0a0000) /opt/MATLAB/R2013a/bin/glnxa64/libmwresource_core.so (0x00007f80fde98000) /opt/MATLAB/R2013a/bin/glnxa64/libmwi18n.so (0x00007f80fdbe0000) /opt/MATLAB/R2013a/bin/glnxa64/libmwmfl_scalar.so (0x00007f80fd9c8000) /opt/MATLAB/R2013a/bin/glnxa64/libut.so (0x00007f80fd710000) /opt/MATLAB/R2013a/bin/glnxa64/libmwfl.so (0x00007f80fd388000) /opt/MATLAB/R2013a/bin/glnxa64/libmwMATLAB_res.so (0x00007f80fce00000) /opt/MATLAB/R2013a/bin/glnxa64/libboost_date_time.so.1.49.0 (0x00007f80fcbf0000) /opt/MATLAB/R2013a/bin/glnxa64/libboost_signals.so.1.49.0 (0x00007f80fc9d8000) /opt/MATLAB/R2013a/bin/glnxa64/libboost_system.so.1.49.0 (0x00007f80fc7d0000) /opt/MATLAB/R2013a/bin/glnxa64/libboost_thread.so.1.49.0 (0x00007f80fc5b0000) /opt/MATLAB/R2013a/bin/glnxa64/libmwcpp11compat.so (0x00007f80fc3a0000) /opt/MATLAB/R2013a/bin/glnxa64/libicudata.so.49 (0x00007f80fb080000) /opt/MATLAB/R2013a/bin/glnxa64/libicuuc.so.49 (0x00007f80face8000) /opt/MATLAB/R2013a/bin/glnxa64/libicui18n.so.49 (0x00007f80fa8b8000) /opt/MATLAB/R2013a/bin/glnxa64/libicuio.so.49 (0x00007f80fa6a8000) /opt/MATLAB/R2013a/bin/glnxa64/libtbb.so.2 (0x00007f80fa560000) /opt/MATLAB/R2013a/bin/glnxa64/libtbbmalloc.so.2 (0x00007f80fa428000) /lib/x86_64-linux-gnu/libz.so.1 (0x00007f80fa210000) /opt/MATLAB/R2013a/bin/glnxa64/libmwservices.so (0x00007f80f9cd0000) /opt/MATLAB/R2013a/bin/glnxa64/libmwmpath.so (0x00007f80f9a88000) /opt/MATLAB/R2013a/bin/glnxa64/libmwm_dispatcher.so (0x00007f80f97d0000) /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f80f9598000) /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f80f9390000) /opt/MATLAB/R2013a/bin/glnxa64/libboost_filesystem.so.1.49.0 (0x00007f80f9170000) /opt/MATLAB/R2013a/bin/glnxa64/libexpat.so.1 (0x00007f80f8f48000) /lib/x86_64-linux-gnu/librt.so.1 (0x00007f80f8d40000) /opt/MATLAB/R2013a/bin/glnxa64/libboost_log.so.1.49.0 (0x00007f80f8a60000) /opt/MATLAB/R2013a/bin/glnxa64/libboost_log_setup.so.1.49.0 (0x00007f80f8610000) /opt/MATLAB/R2013a/bin/glnxa64/libboost_chrono.so.1.49.0 (0x00007f80f8408000) /opt/MATLAB/R2013a/bin/glnxa64/libboost_regex.so.1.49.0 (0x00007f80f80f8000) /opt/MATLAB/R2013a/bin/glnxa64/libunwind.so.8 (0x00007f80f7ed8000) /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f80f7c98000) /opt/MATLAB/R2013a/bin/glnxa64/libmwregexp.so (0x00007f80f7a48000) /opt/MATLAB/R2013a/bin/glnxa64/libmwmlutil.so (0x00007f80f7258000) /opt/MATLAB/R2013a/bin/glnxa64/libmwMATLAB_settings_res.so (0x00007f80f7038000) /opt/MATLAB/R2013a/bin/glnxa64/libmwnativedisplay.so (0x00007f80f6e30000) /opt/MATLAB/R2013a/bin/glnxa64/libboost_iostreams.so.1.49.0 (0x00007f80f6c18000) /opt/MATLAB/R2013a/bin/glnxa64/libboost_serialization.so.1.49.0 (0x00007f80f69a0000) /opt/MATLAB/R2013a/bin/glnxa64/libxerces-c.so.27 (0x00007f80f63a0000) /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007f80f6178000) /opt/MATLAB/R2013a/bin/glnxa64/libmwxmlcore.so (0x00007f80f5f00000) /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f80f5cd8000) /lib64/ld-linux-x86-64.so.2 (0x00007f8100868000)
-----------
I have also set the LD_LIBRARY_PATH to include all the directories including the shared object files:
-----------
>> getenv LD_LIBRARY_PATH
ans =
/opt/MATLAB/R2013a/sys/os/glnxa64:/opt/MATLAB/R2013a/bin/glnxa64:/opt/MATLAB/R2013a/extern/lib/glnxa64:/opt/MATLAB/R2013a/runtime/glnxa64:/opt/MATLAB/R2013a/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/opt/MATLAB/R2013a/sys/java/jre/glnxa64/jre/lib/amd64/server:/opt/MATLAB/R2013a/sys/java/jre/glnxa64/jre/lib/amd64:/opt/MATLAB/R2013a/bin/glnxa64:/usr/lib:/opt/MATLAB/R2013a/sys/os/glnxa64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib64:
-----------
I have also tried to adding '-fPIC' to CFLAGS, CXXFLAGS, FFLAGS, CPPFLAGS in the configure stage, and adding the '-shared' option in the linking stage, but the error persist.
I have tried in another linux machine, and the same error appears. Besides, I have compiled this in macosx 10.8, by modifying some surfix, and file formats, and that can compile successfully. I can also run the executable successfully and produce the required simulation result. So I guess, I might have compiling and linking issue in the linux case.
Hope someone here can provide some hints about what is wrong with it.
Suggestion will be greatly appreciated.

Answers (0)

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!