Clear Filters
Clear Filters

Linking issue with Matlab Coder....

4 views (last 30 days)
Arwel
Arwel on 6 Mar 2018
Answered: Anakin Zheng on 26 Jul 2018
Hi, I am trying to link to some existing precompiled libraries using Matlab Coder. Within my code I have the following.....
libPriority = '';
libPreCompiled = true;
libLinkOnly = true;
linkPath = '/home/arwel/Documents/coding/multinestEdits/eggboxOnly/MultiNest_v3.10_eggboxOnly/multinest_eggboxOnly/lib';
coder.updateBuildInfo('addLinkObjects','libmultinest.so',linkPath,libPriority,libPreCompiled,libLinkOnly);
coder.updateBuildInfo('addLinkObjects','libmultinest.so.3.10',linkPath,libPriority,libPreCompiled,libLinkOnly);
coder.ceval('mainRoutine',0,[]);
When i try to make the mex in Coder, it fails during the testing of the generated mex. However it will still make the mex.
If I try to run it I get the following error message...
>> multinestCaller_mex() Invalid MEX-file '<.......>/multinestTests/multinestCaller_mex.mexa64': libmultinest.so.3.10: cannot open shared object file: No such file or directory.
I have verified that both 'libmultinest.so' and 'libmultinest.so.3.10' are in the same directory. Why is it that it seems to find one library and not the other, given that they are both in the same place?
  2 Comments
Sumit Ghosh
Sumit Ghosh on 23 Mar 2018
Edited: Sumit Ghosh on 23 Mar 2018
You may try using ldd on the mex file to figure out what .so file libmultinest.so is being resolved to. Once you verify that, you can try to put libmultinest.so.3.10 in the same path or put a symlink to libmultinest.so.3.10.
Arwel
Arwel on 26 Jul 2018
Okay, I've returned to this now after a while away from it. Running ldd gives me the following...
linux-vdso.so.1 => (0x00007ffdcc6dc000)
libmx.so => not found
libmex.so => not found
libmat.so => not found
libm.so.6 => /lib64/libm.so.6 (0x00007fe95ca22000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fe95c719000)
libmultinest.so.3.10 => not found
/usr/local/MATLAB/R2016b/bin/glnxa64/libmx.so (0x00007fe95c38c000)
libemlrt.so => not found
libcovrt.so => not found
libut.so => not found
libmwmathutil.so => not found
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fe95c174000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fe95bf58000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe95bb94000)
/lib64/ld-linux-x86-64.so.2 (0x00005587bff37000)
libmwresource_core.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwresource_core.so (0x00007fe95b992000)
libmwi18n.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwi18n.so (0x00007fe95b668000)
libut.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libut.so (0x00007fe95b3a9000)
libmwfl.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwfl.so (0x00007fe95aff8000)
libboost_chrono.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_chrono.so.1.56.0 (0x00007fe95adf1000)
libboost_date_time.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_date_time.so.1.56.0 (0x00007fe95abe0000)
libboost_filesystem.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_filesystem.so.1.56.0 (0x00007fe95a9ca000)
libboost_log.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_log.so.1.56.0 (0x00007fe95a6ec000)
libboost_regex.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_regex.so.1.56.0 (0x00007fe95a3dc000)
libboost_signals.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_signals.so.1.56.0 (0x00007fe95a1c6000)
libboost_system.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_system.so.1.56.0 (0x00007fe959fc2000)
libboost_thread.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_thread.so.1.56.0 (0x00007fe959da1000)
libmwcpp11compat.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwcpp11compat.so (0x00007fe959b83000)
libicudata.so.56 => /usr/local/MATLAB/R2016b/bin/glnxa64/libicudata.so.56 (0x00007fe95819d000)
libicuuc.so.56 => /usr/local/MATLAB/R2016b/bin/glnxa64/libicuuc.so.56 (0x00007fe957e06000)
libicui18n.so.56 => /usr/local/MATLAB/R2016b/bin/glnxa64/libicui18n.so.56 (0x00007fe95798c000)
libicuio.so.56 => /usr/local/MATLAB/R2016b/bin/glnxa64/libicuio.so.56 (0x00007fe95777e000)
libtbb.so.2 => /usr/local/MATLAB/R2016b/bin/glnxa64/libtbb.so.2 (0x00007fe957533000)
libtbbmalloc.so.2 => /usr/local/MATLAB/R2016b/bin/glnxa64/libtbbmalloc.so.2 (0x00007fe9572e1000)
libz.so.1 => /lib64/libz.so.1 (0x00007fe9570ca000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fe956ec6000)
libexpat.so.1 => /usr/local/MATLAB/R2016b/bin/glnxa64/libexpat.so.1 (0x00007fe956c9d000)
librt.so.1 => /lib64/librt.so.1 (0x00007fe956a95000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fe95685d000)
libboost_serialization.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_serialization.so.1.56.0 (0x00007fe9565fd000)
libunwind.so.8 => /usr/local/MATLAB/R2016b/bin/glnxa64/libunwind.so.8 (0x00007fe9563de000)
libssl.so.1.0.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libssl.so.1.0.0 (0x00007fe956172000)
libcrypto.so.1.0.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libcrypto.so.1.0.0 (0x00007fe955d8f000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007fe955b8b000)
So it's not finding the multinest library, but also a bunch of other (mex?) libraries. What should I do to remedy this?
Cheers,
Arwel

Sign in to comment.

Answers (1)

Anakin Zheng
Anakin Zheng on 26 Jul 2018
Hi Arwel,
Can you check whether '/home/arwel/Documents/coding/multinestEdits/eggboxOnly/MultiNest_v3.10_eggboxOnly/multinest_eggboxOnly/lib' is on your LD_LIBRARY_PATH?
Anakin

Products

Community Treasure Hunt

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

Start Hunting!