This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Linking dependencies into static library / Partial linking
- From: "Philip K.F. Hölzenspies" <p dot k dot f dot holzenspies at utwente dot nl>
- To: binutils at sourceware dot org
- Date: Mon, 7 Jan 2008 17:22:53 +0100
- Subject: Linking dependencies into static library / Partial linking
L.S.,
This may be a newbe question and it may already have been answered on this
mailing lists, in which case I may have used the wrong search terms. If this
is the case, I would be very satisfied with a reference to the relevant
thread. The problem is the following.
I am currently developing a program in C called RTSM. Someone else has written
a program, called HEBE, in C++. RTSM should use some of the code from HEBE.
To develop independently, I would like to write a C wrapper for HEBE and
compile HEBE with this wrapper to a static library to which I could link my
RTSM. For reasons I will not bore you with too much, I would really like to
have HEBE as a single static library with no further link dependencies. HEBE
links with glpk, so I would like to link in libglpk.a in some way. When I
compile HEBE as
gcc <misc_options> -lglpk *.cc -o hebe.o
the resulting object file still contains undefined symbols from glpk, i.e. nm
reports (randomly selected line for example):
U _glp_lpx_add_cols
whereas "nm /usr/local/lib/libglpk.a | grep x_add_cols" outputs:
U _glp_lpx_add_cols
U _glp_lpx_add_cols
00001020 T _glp_lpx_add_cols
U _glp_lpx_add_cols
U _glp_lpx_add_cols
U _glp_lpx_add_cols
U _glp_lpx_add_cols
I would expect there to be some "XXX T _glp_lpx_add_cols" in hebe.o, but there
isn't.
In the end, I would really like to have a libhebe.a file that only exports the
symbols of the wrapper AND does not contain unresolved / undefined symbols
that impose linker dependencies. Is this at all possible?
Regards,
Philip