This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] link java tools with -rpath $(dbexecdir)


When installing two different gcj versions under the same prefix, the
libgcj_bc.so.1 symlink is overwritten. Assume that you install 4.3.0 first, then
reinstall an older version (having the libgcj_bc.so.1 symlink), java programs
cannot be run anymore, because you get an ABI mismatch. This affects all java
tools, including ecj1. It would be nice to make an installation more robust:

 - Install a copy of libgcj_bc.so.1 into $(dbexecdir)
 - Link the java tools with -rpath $(dbexecdir)

The attached patch does this for ecj1 and gcj-dbtool; gij already is linked in
this way. Other tools could be extended in the same way.

  Matthias

2007-09-02  Matthias Klose  <doko@ubuntu.com>

	* Makefile.am
	* Makefile.in: Regenerate.

Index: Makefile.am
===================================================================
--- Makefile.am	(revision 128023)
+++ Makefile.am	(working copy)
@@ -459,6 +459,10 @@
 	-o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -lgcj || exit; \
 	rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
 	$(LN_S) libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
+	rm $(DESTDIR)$(dbexecdir)/libgcj_bc.so; \
+	cp $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so $(DESTDIR)$(dbexecdir)/; \
+	rm $(DESTDIR)$(dbexecdir)/libgcj_bc.so.1; \
+	cp $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1 $(DESTDIR)$(dbexecdir)/; \
 	rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.la;
 endif
 if BUILD_ECJ1
@@ -641,7 +645,7 @@
 ## need this because we are explicitly using libtool to link using the
 ## `.la' file.
 gcj_dbtool_LDFLAGS = --main=gnu.gcj.tools.gcj_dbtool.Main \
-	-rpath $(toolexeclibdir) -shared-libgcc $(THREADLDFLAGS)
+	-rpath $(dbexecdir) -rpath $(toolexeclibdir) -shared-libgcc $(THREADLDFLAGS)
 gcj_dbtool_LINK = $(GCJLINK)
 ## We don't explicitly link in the libraries we need; libgcj.la brings
 ## in all dependencies.  We need the -L so that gcj can find libgcj
@@ -697,7 +701,8 @@
 
 if ENABLE_SHARED
 ## Use ecj.jar at runtime.
-ecjx_LDFLAGS = $(ECJX_BASE_FLAGS) -Djava.class.path=$(ECJ_JAR)
+ecjx_LDFLAGS = $(ECJX_BASE_FLAGS) -Djava.class.path=$(ECJ_JAR) \
+	-rpath $(dbexecdir) -rpath $(toolexeclibdir)
 else !ENABLE_SHARED
 ## Use ecj.jar at compile time.
 ecjx_LDFLAGS = $(ECJX_BASE_FLAGS) $(ECJ_BUILD_JAR) -fbootclasspath=$(BOOTCLASSPATH)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]