Bug 690485 - $ORIGIN in LDFLAGS
Summary: $ORIGIN in LDFLAGS
Status: RESOLVED WONTFIX
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Build Process (show other bugs)
Version: 8.64
Hardware: PC Linux
: P4 normal
Assignee: Chris Liddell (chrisl)
URL: https://www.pooryorick.com/secure/wik...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-18 06:34 UTC by Poor Yorick
Modified: 2017-06-01 08:35 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Poor Yorick 2009-05-18 06:34:15 UTC
With the followihg LDFLAGS:

LDFLAGS="-Wl,-rpath,'\$\$ORIGIN/../lib' -Wl,-rpath,'\$\$ORIGIN/../lib64'
-Wl,-rpath,'\$\$ORIGIN/../../lib' -Wl,-rpath,'\$\$ORIGIN/../../lib64'
-Wl,-rpath,'/lib' -L/path/to/lib -L/path/to/lib64 -Wl,-z,origin
-Wl,--enable-new-dtags"

Extra quoting is needed for the echogs commands, which strip off a layer of
quotes, to preserve the literal dollar sihn in the $ORIGIN keyword (man ld):
into the embedded RPATH using LDFLAGS:

**************************** start patch ***********************************

--- Makefile.in 2009-05-17 23:36:38.000000000 -0400
+++ Makefile.in.new     2009-05-17 23:36:29.000000000 -0400
@@ -279,6 +279,8 @@
 
 LDFLAGS=@LDFLAGS@ $(XLDFLAGS)
 
+ECHOGS_LDFLAGS=$(subst $$ORIGIN,"\$$\$$ORIGIN", $(LDFLAGS))
+
 # Define any extra libraries to link into the executable.
 # ISC Unix 2.2 wants -linet.
 # SCO Unix needs -lsocket if you aren't including the X11 driver.

 
--- unixlink.mak        2009-05-17 23:38:17.000000000 -0400
+++ unixlink.mak.new    2009-05-17 23:38:14.000000000 -0400
@@ -50,7 +50,7 @@
 # which has limited environment space.
 ldt_tr=$(PSOBJ)ldt.tr
 $(GS_XE): $(ld_tr) $(ECHOGS_XE) $(XE_ALL) $(PSOBJ)gsromfs$(COMPILE_INITS).$(OBJ)
-       $(ECHOGS_XE) -w $(ldt_tr) -n - $(CCLD) $(LDFLAGS) -o $(GS_XE)
+       $(ECHOGS_XE) -w $(ldt_tr) -n - $(CCLD) $(ECHOGS_LDFLAGS) -o $(GS_XE)
        $(ECHOGS_XE) -a $(ldt_tr) -n -s $(PSOBJ)gsromfs$(COMPILE_INITS).$(OBJ)
$(PSOBJ)gs.$(OBJ) -s
        cat $(ld_tr) >>$(ldt_tr)
        $(ECHOGS_XE) -a $(ldt_tr) -s - $(EXTRALIBS) $(STDLIBS)

**************************** end patch *************************************

Similar changes may be needed for other echogs commands.
Comment 1 Poor Yorick 2009-05-18 07:54:52 UTC
oops, too many dollar signs.  Instead of

+ECHOGS_LDFLAGS=$(subst $$ORIGIN,"\$$\$$ORIGIN", $(LDFLAGS))


try

+ECHOGS_LDFLAGS=$(subst $$ORIGIN,"\$$ORIGIN", $(LDFLAGS))
Comment 2 Hin-Tak Leung 2010-08-02 00:17:52 UTC
Confirm and re-assign bugs with attached/in-line patches for another person to review.