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: mark8
Subject: Re: Statically linking Octave to C++ program
Date: Sat, 12 Sep 2009 15:02:13 -0700 (PDT)



dbateman wrote:
> 
> 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.
> 
> 
> 

Do you mean:
./configure --enable-static 
Doesn't the fact that I have the libraries liboctave.a etc. suggest that was
done already?

Or do you mean adding the --static flag to the Makefile? If so, where? I
tried adding it to the 'all' target so that it reads:
all: header-msg config-check
        $(MAKE) -f octMakefile all
but make complained.
-- 
View this message in context: 
http://www.nabble.com/Statically-linking-Octave-to-C%2B%2B-program-tp25417085p25418627.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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