Bug 691450

Summary: [Regression] Trunk fails to build unless -fPIC is explicitly added to CFLAGS when configuring
Product: Ghostscript Reporter: James Cloos <cloos>
Component: Build ProcessAssignee: Hin-Tak Leung <htl10>
Status: RESOLVED DUPLICATE    
Severity: major    
Priority: P4    
Version: master   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: The part of patch to bug 690009 relevant to this bug

Description James Cloos 2010-07-11 17:57:36 UTC
This is new; it has been probably a couple of weeks since I last compiled trunk.

The X11 device fails to link because it was not compiled with -fPIC.  The recent changes to the cairo device, to also be a shared object -- may make it fail, too.

Gcc suggests adding -fPIC; doing so in CFLAGS allows the compile to finish.

I only tested on an amd64 box, using gcc-4.4.
Comment 1 James Cloos 2010-07-11 20:15:15 UTC
> it has been probably a couple of weeks since I last compiled trunk.

A further check shows that it was June 28, so sometime between revs 11435 or so and 11502 is when the build broke.

The configure I use is based on the one used by Gentoo’s ebuild:

CFLAGS="-O2 -ggdb -pipe -march=native -fPIC" ./configure --prefix=/opt/iccgs --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --enable-cairo --disable-cups --enable-gtk --with-jasper --with-x --disable-compile-inits --enable-dynamic --enable-fontconfig --with-drivers=ALL --with-ijs --with-jbig2dec --with-libpaper --with-jbig2dec --with-system-libtiff

(As you might guess, the prefix is what I had been using for testing the icc_work branch, but that version was never installed on this — 64 bit — box.)
Comment 2 Hin-Tak Leung 2010-07-11 20:35:52 UTC
(In reply to comment #0)
> This is new; it has been probably a couple of weeks since I last compiled
> trunk.
> 
> The X11 device fails to link because it was not compiled with -fPIC.  The
> recent changes to the cairo device, to also be a shared object -- may make it
> fail, too.
> 
> Gcc suggests adding -fPIC; doing so in CFLAGS allows the compile to finish.
> 
> I only tested on an amd64 box, using gcc-4.4.

This is not new? - also the cairo as shared object patch hasn't been applied yet - in fact if you do apply it (bug 690009), it probably will fix this problem.
Comment 3 Hin-Tak Leung 2010-07-11 22:57:40 UTC
Created attachment 6452 [details]
The part of patch to bug 690009 relevant to this bug

This is a small part of the patch posted for bug 690009 relevant to this bug. See the analysis over there. 

AFAIK, this has never worked properly - every object files constituting a shared library needed to be compiled with -fPIC and this was not the case (and it occasionally works but there is no gaurantee).
Comment 4 Hin-Tak Leung 2010-07-11 22:59:31 UTC
The patch and analysis posted for modularizing the cairo device also fixes the issues reported here, so marked as duplicate. The part of that patch relevant to this bug is attached above.

*** This bug has been marked as a duplicate of bug 690009 ***