Re: [Aqsis-development] shared vs static libraries; building on amd64 - bug 1456902
Brought to you by:
ltatkinson,
pgregory
From: Chris F. <fo...@ph...> - 2006-05-21 06:21:24
|
On Sun, May 21, 2006 at 12:42:28AM +1000, Chris Foster wrote: > Hi all. >- > I'm revisiting my kludgy "solution" to Bug 1456902 - that is, the > problem with the build system on amd64. Originally I'd assumed that > we > needed a way to put -fPIC into the CFLAGS explicitly, but studing the > scons manual shows that this is incorrect. Argh. Further trawling of the net shows I'm still wrong. That'll teach me to post in the middle of the night. Some further points: * Static libraries built without -fPIC are apparently "measurably more efficient" than those built with it, at least on x86. I'm not sure how big this effect is. * The fact that we don't need -fPIC on x86 is an accident of the architecture --- it's rather an unusual case. * The important bit: It's fine to build static libraries on amd64 with *or* without -fPIC. *However*, without -fPIC they cannot be linked into a shared library later on. So we need -fPIC for all the code linked into the shared lib aqsis.so on amd64. I propose that we simply add -fPIC to the CFLAGS for non-x86 platforms only. The problem is how to do this cleanly within scons? In particular, if anyone knows a portable way to detect the architecture, I'd be happy. Otherwise, we could provide a command line switch I guess. For an informative thread on the issue, see the post starting with http://lists.freebsd.org/pipermail/freebsd-ports/2006-March/030181.html on the freeBSD ports list. Since I've spent most of the day researching the issue and I've had problems with it in the past I thought I may as well write something to save other people/projects some frustration. I've put it on the web at http://www.physics.uq.edu.au/people/foster/amd64_porting.html ~Chris. |