This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: Compiling static and shared libraries
- From: "Andy Falanga (afalanga)" <afalanga at micron dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Mon, 29 Apr 2013 17:14:10 +0000
- Subject: RE: Compiling static and shared libraries
- References: <60F6FAE47D1BCE4380CC06D18F49789B3030D34B at NTXBOIMBX02 dot micron dot com> <CAH6eHdTr6tAi4cuJtHbwN7EDtf1-yx80ADDRQTDCiCizbXQBcg at mail dot gmail dot com>
> Does 'ldd shared.so' show any dependency on libboost_thread.so? (I'm
> assuming no)
>
> Have you tried fixing the link line so that the libraries are listed
> after the objects that depend on them?
>
> outputdir/shared.so: $(OBJECTS)
> $(CPP) -o $@ $(OBJECTS) -Wl,--whole-archive outputdir/archive.a
> -Wl,--no-whole-archive -L/path/to/boost -L/path/to/others -
> lboost_python -lboost_thread -lboost_regex -fPIC -shared
No, I had not tried this yet. Frankly, I'd forgotten about how important it is (this comes from the last 4 or 5 years being in nothing but Windows and using Visual Studio). I have tried your suggestion above, changing the order, and I can now import the python module without error. Many thanks Jonathan.
Andy