cannot dynamically load executable

11 Ansichten (letzte 30 Tage)
Syed Bilal Mehdi
Syed Bilal Mehdi am 9 Jun. 2011
I am trying to get gcc 4.6 working with Matlab R2008b. I know that the newer version of gcc hasn't been tested but lets say I have no other way out.
The problem that I have right now is that my file; though complies without error; shows the following error during runtime:
??? Invalid MEX-file '/home/mehdi1/Desktop/test.mexglx': /home/mehdi1/Desktop/test.mexglx: cannot dynamically load executable.
Hint: I used to get the following error when trying to run my program complied directly from gcc
./test: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory
The solution was specifying the path to libgfortran in LD_LIBRARY_PATH. I am not sure how to do that with Matlab

Antworten (2)

Kaustubha Govind
Kaustubha Govind am 9 Jun. 2011
First, I would recommend using the nm or ldd utilities to figure out all the library dependencies that are not being resolved (is this what you mean by trying to open the file in gcc?).
Once you have added the library paths to LD_LIBRARY_PATH, this should also be visible from MATLAB (you need to restart MATLAB after changing the environment variable so the new value is picked up). Try executing the following at the MATLAB prompt to see if LD_LIBRARY_PATH still has the path to libgfortran.so:
>> !printenv LD_LIBRARY_PATH
  1 Kommentar
Walter Roberson
Walter Roberson am 9 Jun. 2011
I think the problem is that Syed does not know how to change the LD_LIBRARY_PATH
Seyd is using Linux, it appears to me.

Melden Sie sich an, um zu kommentieren.


Syed Bilal Mehdi
Syed Bilal Mehdi am 9 Jun. 2011
Thanks for the reply. I used the ldd command and fiddled with the mexopts file and LD_LIBRARY_PATH variable but am still stuck.
The ldd command is now returning the following:
/home/mehdi1/Desktop/test.mexglx: /site/local/pkg/MathWorks/matlab2008b/sys/os/glnx86/libgcc_s.so.1: version `GCC_4.4.0' not found (required by /home/mehdi1/Desktop/test.mexglx)
linux-gate.so.1 => (0xb77cb000)
libmx.so => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/libmx.so (0xb7760000)
libmex.so => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/libmex.so (0xb7751000)
libmat.so => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/libmat.so (0xb7730000)
libgfortran.so.3 => /scratch/local/Bilal/gcc/lib/libgfortran.so.3 (0xb7630000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb75ea000)
libquadmath.so.0 => /scratch/local/Bilal/gcc/lib/libquadmath.so.0 (0xb7578000)
libgcc_s.so.1 => /site/local/pkg/MathWorks/matlab2008b/sys/os/glnx86/libgcc_s.so.1 (0xb756c000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7554000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7405000)
libut.so => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/libut.so (0xb7315000)
libmwfl.so => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/libmwfl.so (0xb72f1000)
libicudata.so.36 => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/libicudata.so.36 (0xb72ef000)
libicuuc.so.36 => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/libicuuc.so.36 (0xb71d3000)
libicui18n.so.36 => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/libicui18n.so.36 (0xb70a4000)
libicuio.so.36 => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/libicuio.so.36 (0xb709a000)
libz.so.1 => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/libz.so.1 (0xb7085000)
libstdc++.so.6 => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6 (0xb6fa7000)
libmwservices.so => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/libmwservices.so (0xb6e57000)
libmwmpath.so => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/libmwmpath.so (0xb6e22000)
libmwm_dispatcher.so => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/libmwm_dispatcher.so (0xb6dca000)
libhdf5.so.0 => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/libhdf5.so.0 (0xb6c9b000)
/lib/ld-linux.so.2 (0xb77cc000)
librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb6c92000)
libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb6c8d000)
libexpat.so.1 => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libexpat.so.1 (0xb6c64000)
libboost_thread-gcc41-mt-1_34_1.so.1.34.1 => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libboost_thread-gcc41-mt-1_34_1.so.1.34.1 (0xb6c58000)
libboost_signals-gcc41-mt-1_34_1.so.1.34.1 => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libboost_signals-gcc41-mt-1_34_1.so.1.34.1 (0xb6c47000)
libmwmathutil.so => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libmwmathutil.so (0xb6bb8000)
libmwmlutil.so => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libmwmlutil.so (0xb6b95000)
libncurses.so.5 => /lib/libncurses.so.5 (0xb6b65000)
libboost_filesystem-gcc41-mt-1_34_1.so.1.34.1 => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libboost_filesystem-gcc41-mt-1_34_1.so.1.34.1 (0xb6b59000)
libmwdatasvcs.so => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libmwdatasvcs.so (0xb6b43000)
libxerces-c.so.27 => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libxerces-c.so.27 (0xb677b000)
libmwxmlcore.so => /site/local/pkg/MathWorks/matlab2008b/bin/glnx86/../../bin/glnx86/../../bin/glnx86/../../bin/glnx86/libmwxmlcore.so (0xb670b000)
symbol __divtf3, version GCC_4.4.0 not defined in file libgcc_s.so.1 with link time reference (/home/mehdi1/Desktop/test.mexglx)
symbol __addtf3, version GCC_4.4.0 not defined in file libgcc_s.so.1 with link time reference (/home/mehdi1/Desktop/test.mexglx)
symbol __multf3, version GCC_4.4.0 not defined in file libgcc_s.so.1 with link time reference (/home/mehdi1/Desktop/test.mexglx)
symbol __extenddftf2, version GCC_4.4.0 not defined in file libgcc_s.so.1 with link time reference (/home/mehdi1/Desktop/test.mexglx)
symbol __lttf2, version GCC_4.4.0 not defined in file libgcc_s.so.1 with link time reference (/home/mehdi1/Desktop/test.mexglx)
symbol __floatsitf, version GCC_4.4.0 not defined in file libgcc_s.so.1 with link time reference (/home/mehdi1/Desktop/test.mexglx)
I have no idea what GCC_4.4 has to do with anything in my case (I am using GCC_4.6)
When I try to run the code, unlike what ldd shows, the error that I get is again about libraries not being found
??? Invalid MEX-file '/home/mehdi1/Desktop/test.mexglx': libgfortran.so.3: cannot open shared object file: No such file or directory.
I am having a hard time in figuring out the problem now. I will be glad if someone can help me out here
  1 Kommentar
Kaustubha Govind
Kaustubha Govind am 10 Jun. 2011
I'm not sure what the ldd error means, but have you ensured that the path to libgfortran.so.3 is visible on LD_LIBRARY_PATH from MATLAB?
>> !printenv LD_LIBRARY_PATH

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by