Bug 686865 - "make so" fails
Summary: "make so" fails
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Build Process (show other bugs)
Version: 8.00
Hardware: Sun Solaris
: P4 enhancement
Assignee: Chris Liddell (chrisl)
URL:
Keywords:
: 686849 688684 688785 689758 689872 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-05-10 06:56 UTC by Bob T.
Modified: 2011-01-04 12:21 UTC (History)
7 users (show)

See Also:
Customer:
Word Size: ---


Attachments
patch (hack) for unix-dll.mak (1.77 KB, patch)
2004-01-26 09:29 UTC, Adam Heinz
Details | Diff
changes made to ./configure generated Makefile (172 bytes, text/plain)
2004-01-26 09:30 UTC, Adam Heinz
Details
changes made to ./configure-generated Makefile (188 bytes, text/plain)
2004-01-26 14:51 UTC, Adam Heinz
Details
improved patch for unix-dll.mak (1.80 KB, patch)
2004-01-26 14:59 UTC, Adam Heinz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bob T. 2003-05-10 06:56:38 UTC
On this platform, "make" builds gs fine, but "make so" fails with the following
bizarre messages:

"make" builds gs fine; but a subsequent "make so" fails with the following
bizarre messages:

./obj/../soobj/echogs -a ./obj/../soobj/ldt.tr -n -s ./obj/../soobj/gs.o -s
cat ./obj/../soobj/ld.tr >>./obj/../soobj/ldt.tr
./obj/../soobj/echogs -a ./obj/../soobj/ldt.tr -s - -lnsl -lsocket -lposix4 -lm
if [ x != x ]; then LD_RUN_PATH=; export LD_RUN_PATH; fi; \
XCFLAGS= XINCLUDE= XLDFLAGS= XLIBDIRS= XLIBS= \
FEATURE_DEVS= DEVICE_DEVS= DEVICE_DEVS1= DEVICE_DEVS2= DEVICE_DEVS3= \
DEVICE_DEVS4= DEVICE_DEVS5= DEVICE_DEVS6= DEVICE_DEVS7= DEVICE_DEVS8= \
DEVICE_DEVS9= DEVICE_DEVS10= DEVICE_DEVS11= DEVICE_DEVS12= \
DEVICE_DEVS13= DEVICE_DEVS14= DEVICE_DEVS15= DEVICE_DEVS16= \
DEVICE_DEVS17= DEVICE_DEVS18= DEVICE_DEVS19= DEVICE_DEVS20= \
/bin/sh <./obj/../soobj/ldt.tr
ld: warning: option -o appears more than once, first setting taken
ld: fatal: file libgs.so.8: open failed: No such file or directory
ld: fatal: File processing errors. No output written to
./bin/../sobin/libgs.so.8.0
collect2: ld returned 1 exit status
gnumake[1]: *** [bin/../sobin/libgs.so.8.0] Error 1
gnumake[1]: Leaving directory `/cis/opt/src/tex/src/ghostscript-8.00'
gnumake: *** [so] Error 2


I get this using the Makefile produced by the configure script; I've also tried
adding 

XLDFLAGS=-R /opt/SUNWspro/lib:/usr/openwin/lib:/usr/local/tex/lib
EXTRALIBS=-lnsl -lsocket -lposix4

with the same result.
Comment 1 Alex Cherepanov 2003-05-15 16:25:28 UTC
*** Bug 686849 has been marked as a duplicate of this bug. ***
Comment 2 Bob T. 2003-09-03 19:42:08 UTC
This bug was first reported in May.  Since then nothing has happened except that
ghostscript-8.11 has been released and it has the same problem.  Hello out there!
Is anybody listening?  I suppose with almost 700000 bugs you've got enough to
do, but really, don't you think you could at least attempt to confirm the bug or
will it remain NEW forever?   
Comment 3 Ralph Giles 2003-09-04 17:49:34 UTC
Sorry for not responding.

We don't support the 'so' target on SunOS; I've just left this open to record
that fact until someone sends us a patch or we get around to fixing it.
Contributions welcome. :)
Comment 4 Bob T. 2003-09-05 04:05:22 UTC
The fix seems to be to change line 77 of src/unix-dll.mak from

SODEFS=LDFLAGS='$(LDFLAGS) $(CFLAGS_SO) -shared -Wl,-soname,$(GS_SONAME_MAJOR)'\

to

SODEFS=LDFLAGS='$(LDFLAGS) $(CFLAGS_SO) -shared -Wl,-soname=$(GS_SONAME_MAJOR)'\
Comment 5 Ralph Giles 2003-09-24 06:48:34 UTC
Thanks for the fix. It looks like this is a typo and -soname= is the proper
syntax for GNU ld; the solaris linker seems to just ignore the option. I've
committed.

Is that the only issue you have? I'm still getting:

   make: Fatal error: Don't know how to make target `bin/../sobin/gsc'
Comment 6 Adam Heinz 2004-01-26 09:29:38 UTC
Created attachment 469 [details]
patch (hack) for unix-dll.mak

I don't recommend applying this patch to CVS, but along with the following
diff, you should be able to "make bin/libgs.so" on Solaris
Comment 7 Adam Heinz 2004-01-26 09:30:52 UTC
Created attachment 470 [details]
changes made to ./configure generated Makefile
Comment 8 Adam Heinz 2004-01-26 13:05:47 UTC
What shells are other people trying to build this using?  I was initially using 
standard sh, but our sysadmin recently installed bash for me and a number of 
the problems I was having have disappeared.
Comment 9 Adam Heinz 2004-01-26 14:51:22 UTC
Created attachment 472 [details]
changes made to ./configure-generated Makefile

added optimization flag back in
Comment 10 Adam Heinz 2004-01-26 14:59:53 UTC
Created attachment 473 [details]
improved patch for unix-dll.mak

This patch allows a proper "make so", but I stubbed out gsc and gsx executable
builds.  Maybe add a separate "make so-all" for those?
Comment 11 Adam Heinz 2004-01-26 15:12:13 UTC
Ok, I just did a "make soclean" followed by a "make so" for 8.0.0 and 
everything was compiled properly into sobin.  Could somebody who knows 
autoconf/configure could take a look at the differences in the generated 
Makefile and get those in (for 8.14)?.  The definition of platform-specific 
flags in unix-dll.mak is bad, so maybe that should be moved into the generated 
Makefile (in some sort of LDFLAGS_SO field), but that still leaves 
GS_SONAME_MAJOR and friends.

Anyway, successful build with cc using:
Machine hardware:   sun4u
OS version:         5.7
Processor type:     sparc
Hardware:           SUNW,Ultra-5_10
Sun Visual WorkShop C++ 5.0
GNU bash, version 2.05.0(1)-release (sparc-sun-solaris2.7)
Comment 12 Ralph Giles 2004-01-26 15:14:48 UTC
It seems reasonable to always build gsc to me. Likewise with gsx provided we
check at configure time for gtk. Do you have a particular objection?

Re shells, the makefiles are supposed to use vanilla shell, but we all use bash
so it's easy for "bashisms" to creep in. If do do encounter a problem with a
non-bash sh, please file a bug for it.

(certainly if we did require bash we could simplify a lot of the code!)
Comment 13 Ralph Giles 2004-01-26 15:19:47 UTC
Adam: yes, a proper change would set the SO_LDFLAGS (and whatever else needed
doing) from the configure script through Makefile.in.

So do Bob T.'s fix with the slightly different -soname syntax not work for you?
I'm just curious about the difference.
Comment 14 Adam Heinz 2004-01-27 09:23:06 UTC
I have no opposition to gsc or gsx; at the end of the day I could get it 
compiling without them (and we don't use them), so I did.  I'm not sure "make 
so" respects the "exists(gtk)" logic you describe.

I'll see about performing the build in sh and identifying problems that do not 
exist for bash.  IIRC, my sh build was having trouble identifying build rules 
for targets like "./bin/../sobin/gsc".

The -soname syntax fix was exactly that; it fixed syntax, but not content.

http://developers.sun.com/tools/cc/documentation/s1s7cc_documentation/man1/CC.1.
html does not list -soname as a valid switch; instead -Bdynamic serves that 
purpose.  The other changes I made to unix-dll.mak were similar.  I just looked 
up the meaning of the gcc switch and then pored over the cc manual and Googled 
for the corresponding parameter.
Comment 15 Adam Heinz 2004-01-27 09:25:19 UTC
Whoops, I meant -h serves for -soname.  The -Bdynamic replaces -shared.
Comment 16 Adam Heinz 2004-01-30 07:43:09 UTC
With no additional changes to the Makefile or unix-dll.mak, the same "make so" 
that works for bash generates the following for sh:

make LDFLAGS=' -KPIC -Bdynamic -G -hlibgs.so.8' 
GS_XE=./bin/../sobin/libgs.so.8.0 STDIO_IMPLEMENTATION=c DISPLAY_DEV=./obj/../so
obj/display.dev BINDIR=./bin/../sobin GLGENDIR=./obj/../soobj 
GLOBJDIR=./obj/../soobj PSGENDIR=./obj/../soobj PSOBJDIR=./obj/../
soobj CFLAGS='-xO2 -KPIC -DGX_COLOR_INDEX_TYPE="unsigned long long" ' 
prefix=/usr/local ./bin/../sobin/libgs.so
make: Fatal error: Don't know how to make target `bin/../sobin/libgs.so'
Current working directory /engine_space/aheinz/gs-8.00
*** Error code 1
make: Fatal error: Command failed for target `so'
Comment 17 Ralph Giles 2006-05-01 15:03:19 UTC
*** Bug 688684 has been marked as a duplicate of this bug. ***
Comment 18 Ralph Giles 2006-07-10 08:05:14 UTC
*** Bug 688785 has been marked as a duplicate of this bug. ***
Comment 19 Hin-Tak Leung 2008-08-28 05:27:13 UTC
*** Bug 689872 has been marked as a duplicate of this bug. ***
Comment 20 Hin-Tak Leung 2008-08-28 05:56:29 UTC
*** Bug 689758 has been marked as a duplicate of this bug. ***
Comment 21 Jonathan Adams 2008-09-02 04:27:31 UTC
bug noted in Bug ID 689758 is still not resolved in the latest 8.63 version, and
the changes noted in this bug do not fix the problem (because they are already
implemented)

Last working Shared object version of ghostscript on solaris is 8.57 (available
via sourceforge.net)
Comment 22 Hin-Tak Leung 2010-05-02 03:12:54 UTC
Grabbing a Ralph's bugs.
Comment 23 Alex Cherepanov 2010-12-30 19:22:39 UTC
Rev. 11984 uses correct -fPIC option when Ghostscript is compiled by gcc
on Solaris. The rest seems to work just fine in the current development
version.

Configuration and build process has been tested for all combinations of
gcc 3.4.3 vs. Sun Studio 12.2, bash vs. sh, default, debug, and so targets.

$ uname -a
SunOS opensolaris 5.11 snv_111b i86pc i386 i86pc Solaris

Most likely, all build problems in Solaris are fixed now.
If not, feel free to re-open this bug report or file a new one.
Comment 24 Jonathan Adams 2011-01-04 12:21:26 UTC
Downloaded and compiled without a hitch on a OpenSolaris/OpenIndiana box.

I downloaded the 9.0.0 pdl, ran autogen.sh, configure --prefix ...

had to modify the Makefile manually to change to -fPIC ...

with that tweak "gmake so" compiled fine on a Solaris 10 u5 box (still had to tweak the compile LDFLAGS to add -R$(libdir), but that's a different issue).

cheers for your help.

Jon