[Top][All Lists]

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

Re: Linking to external static (!) library

From: Martin Helm
Subject: Re: Linking to external static (!) library
Date: Wed, 20 Apr 2011 14:42:11 +0200
User-agent: KMail/1.13.6 (Linux/; KDE/4.6.2; x86_64; ; )

Am Mittwoch, 20. April 2011, 14:10:14 schrieb TOT:
> Thank you, Martin.
> I tried it in one step:
> mkoctfile -I/path_to_my_include -I/another_path
> -L/path_to_library/libname1.a -L/path_to_library/libname2.a
> It gave me the same problem like you have got.
> Then I used:
> mkoctfile -I/path_to_my_include -I/another_path -L/path_to_library -lname1
> -lname2
> The result was the same.
> You said that with -fPIC option compilation everything worked fine.
> Is there any way to connect to the static library compiled without -fPIC
> option?
> I'm afraid that it's theoretically impossible because resulted oct file
> should be dynamically linked to the octave - which means that it should be
> assembled and linked with -shared option - which means that ALL dependences
> should have PIC information - which means that they should be compiled with
> -fPIC option.

That is how I understand it and how it always worked for me. The linker cannot 
by black magic change the object code in the library to make it suitable for 
the oct file if it is not already "Position Independent Code", which means 
-fPIC is essential.

> Am I right? (please say me that I'm not and by recompiling octave I can get
> it worked)
I am afraid you are right. Maybe someone else jumps in and has an additional 
idea which works with some trick I cannot even imagine.

> Maybe I can recompile octave and include my library into compilation
> process?

That I cannot answer, if I understand you right you are after something like 
compiling a static octave which works only with static libraries. There were 
attempts to have something like that on this mailing lists, but I do not 
remeber if the people who tried that had success or not.
I think - if this is possible - it is more work than  compiling you r library.

To come back to your library: Is the use of the options for the compilation 
really so much splitted to different places? I would usually think that it has 
some central makefile or a configure script which makes it easy to recompile 
whole thing with minimal effort.

reply via email to

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