|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Statically linking Octave to C++ programHi,
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 |
|
|
Re: Statically linking Octave to C++ programmark8 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 > > > 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. _______________________________________________ Help-octave mailing list Help-octave@... https://www-old.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Statically linking Octave to C++ programDo 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. |
|
|
Re: Statically linking Octave to C++ programFor what it's worth, I just tried ./configure --enable-static which produced liboctave.a. However, if I run ranlib liboctave.a, I get: > ranlib liboctave.a ranlib: file: liboctave.a(oct-fftw.o) has no symbols ranlib: file: liboctave.a(f2c-main.o) has no symbols ranlib: file: liboctave.a(mkdir.o) has no symbols ranlib: file: liboctave.a(rename.o) has no symbols ranlib: file: liboctave.a(rmdir.o) has no symbols ranlib: file: liboctave.a(strftime.o) has no symbols ranlib: file: liboctave.a(strptime.o) has no symbols ranlib: file: liboctave.a(strcasecmp.o) has no symbols ranlib: file: liboctave.a(strncase.o) has no symbols ranlib: file: liboctave.a(tempname.o) has no symbols ranlib: file: liboctave.a(tempnam.o) has no symbols ranlib: file: liboctave.a(oct-rl-edit.o) has no symbols ranlib: file: liboctave.a(oct-rl-hist.o) has no symbols feeling stumped... |
|
|
Re: Statically linking Octave to C++ programmark8 wrote:
> > Do you mean: > ./configure --enable-static > Doesn't the fact that I have the libraries liboctave.a etc. suggest that was > done already? > > yes. You might need --disable-shared as well D. _______________________________________________ Help-octave mailing list Help-octave@... https://www-old.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: Statically linking Octave to C++ programmark8 wrote:
> > mark8 wrote: > >> 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. >> >> > > For what it's worth, I just tried > ./configure --enable-static > which produced liboctave.a. However, if I run ranlib liboctave.a, I get: > >> ranlib liboctave.a >> > ranlib: file: liboctave.a(oct-fftw.o) has no symbols > ranlib: file: liboctave.a(f2c-main.o) has no symbols > ranlib: file: liboctave.a(mkdir.o) has no symbols > ranlib: file: liboctave.a(rename.o) has no symbols > ranlib: file: liboctave.a(rmdir.o) has no symbols > ranlib: file: liboctave.a(strftime.o) has no symbols > ranlib: file: liboctave.a(strptime.o) has no symbols > ranlib: file: liboctave.a(strcasecmp.o) has no symbols > ranlib: file: liboctave.a(strncase.o) has no symbols > ranlib: file: liboctave.a(tempname.o) has no symbols > ranlib: file: liboctave.a(tempnam.o) has no symbols > ranlib: file: liboctave.a(oct-rl-edit.o) has no symbols > ranlib: file: liboctave.a(oct-rl-hist.o) has no symbols > > feeling stumped... > > D. _______________________________________________ Help-octave mailing list Help-octave@... https://www-old.cae.wisc.edu/mailman/listinfo/help-octave |
| Free embeddable forum powered by Nabble | Forum Help |