Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 173915
Alias:
Product:
Component:
Status: NEW
Resolution:
Assigned To: Java team <java@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Alon Bar-Lev (RETIRED) <alonbl@gentoo.org>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
Makefile Makefile text/plain Alon Bar-Lev (RETIRED) 2007-04-09 14:45 0000 304 bytes Details
jni-test.cpp jni-test.cpp text/plain Alon Bar-Lev (RETIRED) 2007-04-09 14:45 0000 909 bytes Details
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 173915 depends on: Show dependency tree
Bug 173915 blocks: 166711
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.








View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2007-04-09 14:44 0000
Hello,

Following the discussion on the mailing list.
generation-2 does not set LD_LIBRARY_PATH or /etc/ld.so.conf, so linkage with
java libraries do not work with the selected JVM/JDK.

I believe this should be addressed for system integrity, even if you do not
aware of executables that are written this way.

Thanks!

------- Comment #1 From Alon Bar-Lev (RETIRED) 2007-04-09 14:45:29 0000 -------
Created an attachment (id=115826) [details]
Makefile

Makefile of test program.

------- Comment #2 From Alon Bar-Lev (RETIRED) 2007-04-09 14:45:55 0000 -------
Created an attachment (id=115828) [details]
jni-test.cpp

Test program.

------- Comment #3 From Vlastimil Babka (Caster) 2007-05-10 16:45:38 0000 -------
Maybe we could add something based on /etc/java-config-2/current-system-vm/ to
the LDPATH.

------- Comment #4 From Petteri Räty 2007-05-10 16:47:14 0000 -------
(In reply to comment #3)
> Maybe we could add something based on /etc/java-config-2/current-system-vm/ to
> the LDPATH.
> 

yeah

------- Comment #5 From Alon Bar-Lev (RETIRED) 2007-05-10 21:21:06 0000 -------
Wouldn't it enforce system settings on user settings?

------- Comment #6 From Petteri Räty 2007-05-10 21:35:45 0000 -------
(In reply to comment #5)
> Wouldn't it enforce system settings on user settings?
> 

Well only one value can go to ld.so.conf and it should be the system setting.
We should just document this use case (I don't think any normal users are doing
what your example is about). Of course we could export LD_LIBRARY path to
prefer user vm over system vm but it would be a new environment variable and
that kind of sucks.

betelgeuse@pena ~ $ env | grep LD
betelgeuse@pena ~ $

------- Comment #7 From Vlastimil Babka (Caster) 2007-05-10 23:57:15 0000 -------
Been thinking how to determine the subdirs of
/etc/java-config-2/current-system-vm/ (/lib/i386/ and so on) and I see two
options:

1) java-config installs a superset of all known paths
2) each vm installs its own paths, as part of set_java_env, using the LDPATH
entry in env file, replacing JAVA_HOME with
/etc/java-config-2/current-system-vm/

The 2) seems better because it's not static list that we have to update
manually. There will be some duplication but env-update should uniquize it into
ld.so.conf, no? Or at least ld.so.cache should. There might be a case that
subdir added by another VM is not applicable for current system VM but that
shouldn't hurt, right.

------- Comment #8 From Vlastimil Babka (Caster) 2007-05-11 00:03:50 0000 -------
(In reply to comment #6)
> (In reply to comment #5)
> > Wouldn't it enforce system settings on user settings?
> > 
> 
> Well only one value can go to ld.so.conf and it should be the system setting.
> We should just document this use case (I don't think any normal users are doing
> what your example is about). Of course we could export LD_LIBRARY path to
> prefer user vm over system vm but it would be a new environment variable and
> that kind of sucks.

Mmm wonder if gjl launcher should set LD_LIBRARY_PATH to the VM that's
selected.

------- Comment #9 From Josh Nichols (RETIRED) 2007-05-11 11:41:32 0000 -------
(In reply to comment #8)
> Mmm wonder if gjl launcher should set LD_LIBRARY_PATH to the VM that's
> selected.
> 

While that would help for our stuff that uses the launcher, it isn't as useful
for user-created scripts and whatnot.

------- Comment #10 From Alistair Bush 2007-05-11 12:26:18 0000 -------
(In reply to comment #8)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > Wouldn't it enforce system settings on user settings?
> > > 
> > 
> > Well only one value can go to ld.so.conf and it should be the system setting.
> > We should just document this use case (I don't think any normal users are doing
> > what your example is about). Of course we could export LD_LIBRARY path to
> > prefer user vm over system vm but it would be a new environment variable and
> > that kind of sucks.
> 
> Mmm wonder if gjl launcher should set LD_LIBRARY_PATH to the VM that's
> selected.
> 

currently the gjl laucher does not even respect LD_LIBRARY_PATH when a package
has shared libraries.

why? 

-Djava.library.path trumps LB_LIBRARY_PATH

so an app being called by

LD_LIBRARY_PATH=blah java -Djava.library.path ...
will only see the contents of java.library.path

------- Comment #11 From Petteri Räty 2007-05-11 13:42:53 0000 -------
(In reply to comment #8)
> 
> Mmm wonder if gjl launcher should set LD_LIBRARY_PATH to the VM that's
> selected.
> 

I would think that calling the java binary in /opt would make sure the right
libraries get loaded.

------- Comment #12 From Vlastimil Babka (Caster) 2007-05-12 23:23:33 0000 -------
(In reply to comment #9)
> While that would help for our stuff that uses the launcher, it isn't as useful
> for user-created scripts and whatnot.

Is there then any other solution than setting LD_LIBRARY_PATH in say
/etc/profile.d/java-config-2.sh? I'd be for making this at most opt-in since 
this variable is said to be evil :)

(In reply to comment #10)
> currently the gjl laucher does not even respect LD_LIBRARY_PATH when a package
> has shared libraries.

Yeah, probably should append it the same way as we do about env's CLASSPATH.

(In reply to comment #11)
> I would think that calling the java binary in /opt would make sure the right
> libraries get loaded.

Right, so we don't need it in the launcher.

------- Comment #13 From Petteri Räty 2007-05-29 13:56:55 0000 -------
We should check how Fedora or Ubuntu packages behave. I would say that this is
not a case we want to support. If the use knowledgeable enough to know how to
start VM from C/C++ they should be able to set LD_LIBRARY_PATH themselves.
Ebuild installed stuff we can handle with wrappers etc.

------- Comment #14 From Petteri Räty 2007-12-26 21:17:10 0000 -------
I did some research into this matter and the JVM spec does not specify the JNI
library names. This means that you are tied to a specific implementation any
way if you link with something like -ljava. 

http://java.sun.com/docs/books/jni/html/invoke.html

------- Comment #15 From Nilton Volpato 2008-04-21 19:51:58 0000 -------
I have the same problem here. However it's when using a python library
(pylucene) that uses jni to call the lucene java API.

I think that java-config should set the correct path to libjava, libjvm, etc.
This can be done on a system wide by setting LDPATH in /etc/env.d/*, and on a
user basis by setting LD_LIBRARY_PATH. I don't see any harm in doing so.

Of course I myself can set LD_LIBRARY_PATH, but then I (and every other jni
user) would need to change it everytime I change my java vm, or when it gets
updated. But this can be done easily by java-config, so why not do it?

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug