Problem with a Web Service execution of a Matlab converted program

Hello,

I need my Java Web service to call a program developed in Matlab. I've created a C++ shared library from my test.m file using the cpplib wrapper, with the following command: mcc -W cpplib:libtest -T link:lib test.m

I've then created another file which I called another.cpp to use the shared library. I've done so using the following two commands:

g++ -c -I/usr/local/matlab/extern/include -I. another.cpp
g++ -O -o another another.o -L. -ltest

Until this point, everything is ok and I've obtained my compiled file "another". However, when I try to execute the file, the system requests for some shared libraries, which should be pointed out through the LD_LIBRARY_PATH environment variable. Everything works fine changing the variable in the shell. I can execute "another" without any problem. The problem arises when I try to execute the file through my Web Service. I started by developing a script which would export the LD_LIBRARY_PATH and execute "another". The idea was to have the Web Service call the script, but it didn't work. I've tried to solve the LD_LIBRARY_PATH problem by using the following command:

g++ -O -L. -o another another.o -Wl,-rpath=/usr/local/matlab/bin/glnx86 -Wl,-rpath=/usr/local/matlab/sys/os/glnx86,-rpath=. -ltest

This allows me to have an executable "another" with no other shared library needs... However, whenever I compile my "another" with "-Wl...", my Web service just does not execute the file. The problem still remains! Just to be sure, I have executed successfully other c++, using the same compiler, or scripts files from my Web service. But for Matlab programs, I need to use the libraries I referred above in "-Wl".

I've been with this problem for quite a while now, and I still haven't found a way of solving it. Can anyone help me?

Thank you,

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories