help-octave
[Top][All Lists]
Advanced

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

Re: Statically linking Octave to C++ program


From: David Bateman
Subject: Re: Statically linking Octave to C++ program
Date: Sat, 12 Sep 2009 23:24:26 +0200
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

mark8 wrote:
Hi,
I need to statically link the Octave library within a C++ program so that it
can be used on a distributed grid. For other libraries, I have made symlinks
with altered names to the static library (such as libgsl-s.a for the gsl
library) in the same library directory, and then compile with, for example,
-lgsl-s.
This works fine for any other library except Octave. With Octave, I can
#include<octave/oct.h> and of course it links in fine so long as I don't
call any octave functions. As soon as I try to declare an octave object
(such as Matrix m(2,2);), I get hundreds of lines of "undefined symbols"
followed by ld: symbol(s) not found

Right now, I'm working with not much more than a "Hello World" program. It
is fine if I use -loctave but not if I use -loctave-s where liboctave-s.a is
a symlink to liboctave.a.
I've also tried to use the -static compiler flag
I do have the static libraries octave-3.2.2/liboctave.a (and libcruft.a and
liboctinterp.a)

Other details:
I'm using octave 3.2.2 on Mac OSX 10.5
Octave obtained via macports (but I've also built it myself with no
differences)
Compiler: gcc 4.0.1 (but other versions give the same result)

Is it possible to do this static linking? If so, can anyone suggest how?
Thank you very much,
Mark


Try the "-static" flag to the octave configuration script.. The reason for your issues is that the octave oct-files are essentially libraries and these need to be linked in as well. Note that any octave-forge or home built oct-file that you will want to use will also have to be linked in... This gets messy pretty quickly

D.



reply via email to

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