help-octave
[Top][All Lists]
Advanced

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

Re: mkoctfile and linking newbie question


From: John W. Eaton
Subject: Re: mkoctfile and linking newbie question
Date: Wed, 27 May 2009 18:53:45 -0400

On 27-May-2009, roumbaba wrote:

| Ok I have found a way around:
| 
| The same command with the -v option display the gcc commands issued.
| It turns out that my -l option gets called at compile (-c) time and not a
| link time for some reason.
| So now instead of using mkoctfile use system( ) with the correct gcc
| arguments order.
| 
| 
| 
| roumbaba wrote:
| > 
| > Hi,
| > 
| > I am trying to build a .mex file using mkoctfile --mex as described in the
| > octave manual.
| > I need to link in some other library 'libmylib.a' in my mex file. Trying
| > to follow the manual I am doing something like this:
| > 
| > mkoctfile --mex '-I/myincludedir/ -L/mylibdir/ -lmylib' mymexfunction.c
| > 
| > but I get the following message from mkoctfile:
| > powerpc-apple-darwin8-gcc-4.0.1: -lmylib: linker input file unused because
| > linking not done
| > 
| > and 
| > 
| > /usr/bin/ld: Undefined symbols:
| > _mylib_symbol1
| > collect2: ld returned 1 exit status
| > 
| > What am I doing wrong?

Try omitting the quotes around the -I, -L, and -l arguments.  With the
quotes, mkoctfile sees

  '-I/myincludedir/ -L/mylibdir/ -lmylib'

as a single argument, and thinks it is just one -I argument for the
compiler.  It never sees the -L or -l arguments, so it doesn't add
them to the correct commands.

| > btw: will a .mex file compiled using mkoctfile run under matlab?

Probably not.

jwe


reply via email to

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