Invalid MEX-File / Problem with shared (library) object
显示 更早的评论
I want to use external libraries within a mex-file (from Willowgarage, libgazebo, the API of the robot simulator environment). The C++-code compiles (I am using the supported gcc version 4.4.6 of my R2012b Matlab distribution on a 64-bit Ubuntu 12.04 platform), but when I try to invoke the mexa64-file (which is recognized by Matlab), I got the following error:
Invalid MEX-file '/<local-folder>/Matlab/testGazeboMex.mexa64': libgazebo_transport.so.1: Can not open shared object file: No such file or directory
I added the path of the mentioned library (all other libraries are also in this place) to the LD_LIBRARY_PATH and PATH environment variable. I checked the dependencies using the !ldd command within Matlab, which seems fine. My code is just a test at the moment, if it compiles and initializes some objects:
#include <mex.h>
#include <stdio.h>
#include <string>
#include "gazebo.hh"
#include "Transport.hh"
#include "Node.hh"
#include "msgs.h"
using namespace std;
using namespace gazebo;
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
gazebo::transport::init();
gazebo::transport::NodePtr node(new transport::Node());
}
回答(1 个)
Kaustubha Govind
2012-10-31
0 个投票
Is it possible that libgazebo_transport.so is a 32-bit library? Perhaps you should try using the file command as described here to determined this. Since you are compiling a 64-bit MEX-file, you can only link/load 64-bit shared libraries.
2 个评论
Ferdinand
2012-10-31
Kaustubha Govind
2012-11-2
Ferdinand: Strange. I don't know what else to suggest since you've already verified that !ldd confirms that all dependencies for the MEX-file are on the path. Perhaps you should contact MathWorks Tech Support?
类别
在 帮助中心 和 File Exchange 中查找有关 Write C Functions Callable from MATLAB (MEX Files) 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!