Bug 690914 - -fPIC missing in CFLAGS_STANDARD for libgs.so build
Summary: -fPIC missing in CFLAGS_STANDARD for libgs.so build
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Build Process (show other bugs)
Version: master
Hardware: PC Linux
: P4 normal
Assignee: Hin-Tak Leung
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-12 19:52 UTC by keinbiervorvier
Modified: 2010-06-29 05:51 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
minimal eps file which shows pdfwriter bug with glyph omission (10.19 KB, application/postscript)
2009-11-14 19:02 UTC, keinbiervorvier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description keinbiervorvier 2009-11-12 19:52:43 UTC
this applies to current svn HEAD on linux fedora/redhat x86_64 

the build system fails to build a shared library (libgs.so) because of missing
compiler flag -fPIC

> make distclean; ./autogen.sh && make so
...

        /bin/sh <./obj/../soobj/ldt.tr
/usr/bin/ld: ./obj/../soobj/gp_unix.o: relocation R_X86_64_32 against
`.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
./obj/../soobj/gp_unix.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[1]: *** [bin/../sobin/libgs.so.8.71] Error 1
make[1]: Leaving directory `/usr/local/src/ghost/gs'
make: *** [so] Error 2


I found that adding -fPIC in 2 places allows me to build libgs.so 
There is probably a better place in the build system to consolidate these flags.
Therefore I don't propose this to be a proper patch but simply a helpful observation

# svn diff base/Makefile.in
Index: base/Makefile.in
===================================================================
--- base/Makefile.in    (revision 10320)
+++ base/Makefile.in    (working copy)
@@ -254,7 +254,7 @@
 # Define the added flags for standard, debugging, profiling
 # and shared object builds.

-CFLAGS_STANDARD=@OPT_CFLAGS@
+CFLAGS_STANDARD=@OPT_CFLAGS@ -fPIC
 CFLAGS_DEBUG=-g -O0
 CFLAGS_PROFILE=-pg @OPT_CFLAGS@
 CFLAGS_SO=@DYNAMIC_CFLAGS@

# svn diff base/libtiff.mak
Index: base/libtiff.mak
===================================================================
--- base/libtiff.mak    (revision 10320)
+++ base/libtiff.mak    (working copy)
@@ -31,7 +31,7 @@
 # Define the name of this makefile.
 LIBTIFF_MAK=$(GLSRC)libtiff.mak

-TIFFCC=$(CC) $(I_)$(TI_) $(II)$(JI_)$(_I) $(PF_)
+TIFFCC=$(CC) -fPIC $(I_)$(TI_) $(II)$(JI_)$(_I) $(PF_)

 PDEP = $(AK) $(TIFFGEN)tif_config.h $(TIFFGEN)tiffconf.h


Cheers
T.
Comment 1 keinbiervorvier 2009-11-14 19:02:45 UTC
Created attachment 5670 [details]
minimal eps file which shows pdfwriter bug with glyph omission
Comment 2 keinbiervorvier 2009-11-14 19:10:41 UTC
apologies, wrong bug for the attached file. must have been a stale cookie or
something else in my browser history

ignore test.eps it was meant for bug 690738

Cheers
T.
Comment 3 Hin-Tak Leung 2010-05-02 03:13:06 UTC
Grabbing a Ralph's bugs.
Comment 4 Hin-Tak Leung 2010-06-29 05:51:52 UTC
The libtiff problem is known for some time and attempts to fix and reverts are r10520 , r10540, r11256, r11265 and r11398 . 

The general case (and lcms specific problems) were fixed again in r11450, r11451, r11452.

As of r11453, ./autogen.sh && ./configure && make so
on Linux Fedora/Redhat x86_64 should just work. (and hope it doesn't get broken again...).