Rereading my message, I think I can see the confusion. Modules (and possibly other dynamic libraries) will be linking against this static library.
Here's more background for the PIC: Proton is needed to provide the AMQP 1.0 support in Qpid. Qpid provides this support via the amqp.so module. This (dynamic) module links against proton. I don't want to have to distribute libqpid-proton.so (for v0.6), so I build it statically (libqpid-proton.a) and link it into the amqp.so module and to do that, libqpid-proton.a needs to be PIC. If you remove that from the patch, then you will not be able to link libqpid-proton.a into amqp.so. I didn't mention security implications because it wasn't the reason for needing the PIC. Hope it helps! On Tue, Jan 21, 2014 at 10:03 AM, Shearer, Davin <dshea...@novetta.com>wrote: > Hi Andrew, thanks for your reply! > > The PIC is because proton will be linked against amqp.so in qpid, which is > a module (dynamic) that will be linked against this static library, > therefore the PIC is required. Could I have worded that better? > > > On Tue, Jan 21, 2014 at 9:57 AM, Andrew Stitcher <astitc...@redhat.com>wrote: > >> On Mon, 2014-01-20 at 12:09 -0500, Shearer, Davin wrote: >> > I would like to share my experience with building proton version 0.6 as >> a >> > static library. >> > ... >> >> > and since we'll want to support linking this against >> > modules and/or dynamic libraries, we want to build using >> > position-independent code (PIC), >> >> I'm pretty sure this is mistaken: You only need to build -fPIC if the >> code you are building will end up in a dynamic library itself, not if >> you are merely linking against a dynamic library (There are also PIC >> executables for some security purposes but you don't mention that). >> >> The reason for this is that the main executable (including any static >> libraries linked to it) is loaded at a fixed address, whereas dynamic >> libraries could be loaded at any location in the memory map. >> >> Other than the -fPIC I think your patch looks good, and is probably >> generally applicable. >> >> Andrew >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org >> For additional commands, e-mail: users-h...@qpid.apache.org >> >> > > > -- > Davin Shearer > Engineer > > 8830 Stanford Blvd, Suite 306 > Columbia, MD 21045 > > 443-741-4517 > -- Davin Shearer Engineer 8830 Stanford Blvd, Suite 306 Columbia, MD 21045 443-741-4517