This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch: install libgtkpeer.so and libjawt.so in versioned library directory
- From: Andrew Haley <aph at redhat dot com>
- To: Thomas Fitzsimmons <fitzsim at redhat dot com>
- Cc: java-patches at gcc dot gnu dot org
- Date: Wed, 7 Jun 2006 14:34:12 +0100
- Subject: Re: Patch: install libgtkpeer.so and libjawt.so in versioned library directory
- References: <447B9883.6080705@redhat.com>
Thomas Fitzsimmons writes:
> +
> + // Check if LD_LIBRARY_PATH is already prefixed with
> + // GCJ_VERSIONED_LIBDIR. If not, export LD_LIBRARY_PATH prefixed
> + // with GCJ_VERSIONED_LIBDIR and re-spawn gij.
> + char *libpath = getenv (LTDL_SHLIBPATH_VAR);
> + char *newpath = _Jv_PrependVersionedLibdir (libpath);
> +
> + if (! libpath || strcmp (libpath, newpath))
> + {
> + setenv (LTDL_SHLIBPATH_VAR, newpath, 1);
> + JvFree (newpath);
> +
> + int error_code = execv (GIJ_EXECUTABLE, (char* const*) argv);
But, as discussed with Bryce, the version in svn is
int error_code = execvp (argv[0], (char* const*) argv);
This can break java-1.4.2-gcj-compat.
/usr/bin/java prefixes the LD_LIBRARY_PATH with the gij install dir.
Then, /usr/bin/java does an execv of PREFIX/gij, but it leaves argv[0]
pointing to /usr/bin/java rather than PREFIX/gij.
So, when you call execvp(), the /usr/bin/java wrapper is re-executed,
not gij. This in turn, re-executes gij, ad nauseam.
So, to make this clear:
/usr/bin/java prefixes LD_LIBRARY_PATH and execs gij
gij prefixes LD_LIBRARY_PATH and execs /usr/bin/java
/usr/bin/java prefixes LD_LIBRARY_PATH and execs gij
gij prefixes LD_LIBRARY_PATH and execs /usr/bin/java
...
This doesn't happen if you use GIJ_EXECUTABLE instead of argv[0].
Everything works correctly.
You either need to go back to using GIJ_EXECUTABLE or make the test
for the already prefixed GCJ_VERSIONED_LIBDIR better. Perhaps you
could set a special evironment variable and detect that?
Andrew.