
On Thu, 8 Mar 2012 12:55:51 +0100, Yves Parès
Thanks Mark! It works also here, and even without the "-fpic" flag. Was it necessary for you?
Hi Yves, Yes it is necessary for me to use -fpic when building C/C++ shared libraries as: - I'm on amd64 - Its a Gentoo developer policy to compile C/C++ shared libraries with -fPIC (same as -fpic on amd64) on amd64: http://devmanual.gentoo.org/archs/amd64/index.html Its normal to compile and link all the C/C++ with -fpic or -fPIC when building shared libraries. It might work without -fpic on x86 (32 bit): http://www.mail-archive.com/gentoo-dev@gentoo.org/msg01420.html "2) If it needs an -fPIC to compile on a non-x86 arch, it actually also needs -fPIC on x86 -- not to get the thing to compile correctly of course but for another reason: to avoid wasting memory when the code is used. Non-PIC library code on x86 wastes memory when used, even though it technically "works". The dynamic loader is forced to create a private copy for each process using the non-PIC code, defeating one of the main reasons of using shared libraries in the first place -- to conserve RAM." Thanks, Mark