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 Comment

It's not a 32-bit library. I compiled this library by myself. A check using 'file libgazebo_transport.so*' brought this:
libgazebo_transport.so: symbolic link to `libgazebo_transport.so.1'
libgazebo_transport.so.1: symbolic link to `libgazebo_transport.so.1.0.1'
libgazebo_transport.so.1.0.1: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=0x0a7bbd6088fcf727758b8cf8ea60337c6e7052ac, not stripped

Sign in to comment.

Answers (1)

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 Comments

Unfourtunately, it's not. I posted the message using the "file" cmd as a comment to my thread.
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?

Sign in to comment.

Categories

Products

Asked:

on 31 Oct 2012

Community Treasure Hunt

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

Start Hunting!