help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking libraries while making mex file


From: Jaroslav Hajek
Subject: Re: Linking libraries while making mex file
Date: Mon, 12 Jan 2009 16:47:43 +0100

On Mon, Jan 12, 2009 at 2:24 PM, Rishi Amrit <address@hidden> wrote:
> Hi,
>
>    I am trying compile the mex interface of ipopt
> (https://projects.coin-or.org/Ipopt/wiki/MatlabInterface) to use it with
> octave. Since the mex interface is written to work with Matlab, I had to
> change the Makefile. After making some sensible changes in the Makefile of
> the package, I was able to compile the mex file for octave, and it runs
> almost perfect. After the file ipopt.mex is made, I call it from octave. It
> gave me the following error:
>
> error: libipopt.so.0: cannot open shared object file: No such file or
> directory
> error: failed to install .mex file function `ipopt'
>
> Now libipopt.so.0 is present in the library path of the package (
> '/opt/CoinIpopt/install/lib' in my case)
>
> The command I used to make the mex file was:
>
> mkoctfile --mex -L/opt/CoinIpopt/install/lib ipopt.o
>
> My understanding was that the library path was already linked as I specified
> the path in the mkoctfile command. I even tried using addpath to include the
> location of the library file, but that makes no difference.
>
> Finally the workaround that works is I set the environment variable
> LD_LIBRARY_PATH to /opt/CoinIpopt/install/lib and then ipopt works perfect.
> The mex file runs great.
>
> Any ideas on what flags should I use in mkoctfile so that I dont have to set
> the LD_LIBRARY_PATH variable (which I dont, when I compile the mex interface
> with MATLAB).
>

Try -Wl,-rpath=your_path

cheers

-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]