Hello,
I have a non-java package (pl) which links to jvm. Build scripts of pl needs to locate directories with libjava.so, libjvm.so etc. and instruct native linker (ld) where to find them (-L option).
Current implementation in the pl.spec is uggly (a lot of ad-hoc hacks for each platform which requires tuning time to time https://bugzilla.redhat.com/show_bug.cgi?id=740897).
So I decided to find ultimate way how to obtain path for linker and Java home directory. Unfortunatelly, I did not find any. So I've written one. You can find it as attachment at the afore-mentioned bug report.
Usage is inspired by pkg-config:
$ javac JavaConfig.java $ java JavaConfig --home /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre $ java JavaConfig --libs-only-L -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64 -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib
I can bundle the tool to my `pl' package, but I think it could be helpful for others too. So I'd like to ask Java SIG whether it wants to adopt it (e.g. as a part of JDK).
-- Petr
* Petr Pisar ppisar@redhat.com [2011-09-27 11:00]:
Hello,
I have a non-java package (pl) which links to jvm. Build scripts of pl needs to locate directories with libjava.so, libjvm.so etc. and instruct native linker (ld) where to find them (-L option).
Current implementation in the pl.spec is uggly (a lot of ad-hoc hacks for each platform which requires tuning time to time https://bugzilla.redhat.com/show_bug.cgi?id=740897).
So I decided to find ultimate way how to obtain path for linker and Java home directory. Unfortunatelly, I did not find any. So I've written one. You can find it as attachment at the afore-mentioned bug report.
Usage is inspired by pkg-config:
$ javac JavaConfig.java $ java JavaConfig --home /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre $ java JavaConfig --libs-only-L -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64 -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib
I can bundle the tool to my `pl' package, but I think it could be helpful for others too. So I'd like to ask Java SIG whether it wants to adopt it (e.g. as a part of JDK).
Out of curiosity, is there a reason why the OpenJDK RPM on Fedora cannot install .pc files so that pkg-config itself can be used?
Adding Andrew Hughes to cc:
Cheers, Deepak
* Deepak Bhole dbhole@redhat.com [2011-09-27 11:22]:
- Petr Pisar ppisar@redhat.com [2011-09-27 11:00]:
Hello,
I have a non-java package (pl) which links to jvm. Build scripts of pl needs to locate directories with libjava.so, libjvm.so etc. and instruct native linker (ld) where to find them (-L option).
Current implementation in the pl.spec is uggly (a lot of ad-hoc hacks for each platform which requires tuning time to time https://bugzilla.redhat.com/show_bug.cgi?id=740897).
So I decided to find ultimate way how to obtain path for linker and Java home directory. Unfortunatelly, I did not find any. So I've written one. You can find it as attachment at the afore-mentioned bug report.
Usage is inspired by pkg-config:
$ javac JavaConfig.java $ java JavaConfig --home /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre $ java JavaConfig --libs-only-L -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64 -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib
I can bundle the tool to my `pl' package, but I think it could be helpful for others too. So I'd like to ask Java SIG whether it wants to adopt it (e.g. as a part of JDK).
Out of curiosity, is there a reason why the OpenJDK RPM on Fedora cannot install .pc files so that pkg-config itself can be used?
Adding Andrew Hughes to cc:
Andrew, ping?
Deepak
Cheers, Deepak
----- Original Message -----
- Deepak Bhole dbhole@redhat.com [2011-09-27 11:22]:
- Petr Pisar ppisar@redhat.com [2011-09-27 11:00]:
Hello,
I have a non-java package (pl) which links to jvm. Build scripts of pl needs to locate directories with libjava.so, libjvm.so etc. and instruct native linker (ld) where to find them (-L option).
Current implementation in the pl.spec is uggly (a lot of ad-hoc hacks for each platform which requires tuning time to time https://bugzilla.redhat.com/show_bug.cgi?id=740897).
So I decided to find ultimate way how to obtain path for linker and Java home directory. Unfortunatelly, I did not find any. So I've written one. You can find it as attachment at the afore-mentioned bug report.
Usage is inspired by pkg-config:
$ javac JavaConfig.java $ java JavaConfig --home /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre $ java JavaConfig --libs-only-L -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64 -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib
I can bundle the tool to my `pl' package, but I think it could be helpful for others too. So I'd like to ask Java SIG whether it wants to adopt it (e.g. as a part of JDK).
Out of curiosity, is there a reason why the OpenJDK RPM on Fedora cannot install .pc files so that pkg-config itself can be used?
Adding Andrew Hughes to cc:
Andrew, ping?
Deepak
Cheers, Deepak
Not sure why you're asking me. I don't have anything to do with the RPMs.
----- Original Message -----
----- Original Message -----
- Deepak Bhole dbhole@redhat.com [2011-09-27 11:22]:
- Petr Pisar ppisar@redhat.com [2011-09-27 11:00]:
Hello,
I have a non-java package (pl) which links to jvm. Build scripts of pl needs to locate directories with libjava.so, libjvm.so etc. and instruct native linker (ld) where to find them (-L option).
Current implementation in the pl.spec is uggly (a lot of ad-hoc hacks for each platform which requires tuning time to time https://bugzilla.redhat.com/show_bug.cgi?id=740897).
So I decided to find ultimate way how to obtain path for linker and Java home directory. Unfortunatelly, I did not find any. So I've written one. You can find it as attachment at the afore-mentioned bug report.
Usage is inspired by pkg-config:
$ javac JavaConfig.java $ java JavaConfig --home /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre $ java JavaConfig --libs-only-L -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64 -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib
I can bundle the tool to my `pl' package, but I think it could be helpful for others too. So I'd like to ask Java SIG whether it wants to adopt it (e.g. as a part of JDK).
Out of curiosity, is there a reason why the OpenJDK RPM on Fedora cannot install .pc files so that pkg-config itself can be used?
Adding Andrew Hughes to cc:
Andrew, ping?
Deepak
Cheers, Deepak
Not sure why you're asking me. I don't have anything to do with the RPMs. -- Andrew :)
Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com)
PGP Key: 248BDC07 (https://keys.indymedia.org/) Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07
-- java-devel mailing list java-devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/java-devel
To elucidate, IcedTea doesn't handle installation at present. There's a long-standing bug to add this:
http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=94
Adding it and the pkg-config feature need to be discussed on the appropriate mailing list: distro-pkg-dev@openjdk.java.net
You're welcome to trial a more immediate change in the RPM itself, and use the feedback from that to add the feature to IcedTea.
Well, I can not agree that this is a distro-only or OpenJDK-only problem. Noone will benefit if every distro starts to ship it's own pc file. We gain nothing from such approach. Take a look at e.g. http://git.gnome.org/browse/glib/tree/glib-2.0.pc.in - the right place for such file is OpenJDK even if it doesn't install it at all. Java land suffers from missing integration in so many places and so badly that it still feels like an alien on Linux and nothing will change if both upstream OpenJDK and Fedora maintainers step in and do the needed fixes because every party has do to its job. * we need OpenJDK upstream to define canonical pc.in file so we know how to query pkg-config * we need Fedora OpenJDK package maintainers to properly install a correct pc file for distro wide usage.
If we have both people what is stopping us to not make one more step to make JVM integration suck less?
Alex
----- Original Message -----
From: "Andrew Hughes" ahughes@redhat.com To: "Deepak Bhole" dbhole@redhat.com Cc: Java-devel@lists.fedoraproject.org, "Petr Pisar" ppisar@redhat.com Sent: Friday, January 20, 2012 6:19:41 PM Subject: Re: [fedora-java] Shared library paths for native linker
----- Original Message -----
----- Original Message -----
- Deepak Bhole dbhole@redhat.com [2011-09-27 11:22]:
- Petr Pisar ppisar@redhat.com [2011-09-27 11:00]:
Hello,
I have a non-java package (pl) which links to jvm. Build scripts of pl needs to locate directories with libjava.so, libjvm.so etc. and instruct native linker (ld) where to find them (-L option).
Current implementation in the pl.spec is uggly (a lot of ad-hoc hacks for each platform which requires tuning time to time https://bugzilla.redhat.com/show_bug.cgi?id=740897).
So I decided to find ultimate way how to obtain path for linker and Java home directory. Unfortunatelly, I did not find any. So I've written one. You can find it as attachment at the afore-mentioned bug report.
Usage is inspired by pkg-config:
$ javac JavaConfig.java $ java JavaConfig --home /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre $ java JavaConfig --libs-only-L -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64 -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib
I can bundle the tool to my `pl' package, but I think it could be helpful for others too. So I'd like to ask Java SIG whether it wants to adopt it (e.g. as a part of JDK).
Out of curiosity, is there a reason why the OpenJDK RPM on Fedora cannot install .pc files so that pkg-config itself can be used?
Adding Andrew Hughes to cc:
Andrew, ping?
Deepak
Cheers, Deepak
Not sure why you're asking me. I don't have anything to do with the RPMs. -- Andrew :)
Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com)
PGP Key: 248BDC07 (https://keys.indymedia.org/) Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07
-- java-devel mailing list java-devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/java-devel
To elucidate, IcedTea doesn't handle installation at present. There's a long-standing bug to add this:
http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=94
Adding it and the pkg-config feature need to be discussed on the appropriate mailing list: distro-pkg-dev@openjdk.java.net
You're welcome to trial a more immediate change in the RPM itself, and use the feedback from that to add the feature to IcedTea. -- Andrew :)
Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com)
PGP Key: 248BDC07 (https://keys.indymedia.org/) Fingerprint = EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07
-- java-devel mailing list java-devel@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/java-devel
----- Original Message -----
Well, I can not agree that this is a distro-only or OpenJDK-only problem. Noone will benefit if every distro starts to ship it's own pc file.
I agree. This is exactly why I said we should take the discussion to the IcedTea mailing list where representatives of other distributions can contribute, rather than discussing it here on a Fedora list.
On 09/27/2011 03:52 PM, Petr Pisar wrote:
I have a non-java package (pl) which links to jvm. Build scripts of pl needs to locate directories with libjava.so, libjvm.so etc. and instruct native linker (ld) where to find them (-L option).
Do you really need to link against a particular version of java? Would it make sense to use /usr/lib/jvm/jre/lib/arm/ etc? This is independent of JDK6, JDK7, etc.
Andrew.
Excerpts from Andrew Haley's message of Fri Jan 20 18:18:59 +0100 2012:
On 09/27/2011 03:52 PM, Petr Pisar wrote:
I have a non-java package (pl) which links to jvm. Build scripts of pl needs to locate directories with libjava.so, libjvm.so etc. and instruct native linker (ld) where to find them (-L option).
Do you really need to link against a particular version of java? Would it make sense to use /usr/lib/jvm/jre/lib/arm/ etc? This is independent of JDK6, JDK7, etc.
I expect Petr is not on the ML and it's been a while since his post, so I am adding him to CC
On 2012-01-20, Andrew Haley aph@redhat.com wrote:
On 09/27/2011 03:52 PM, Petr Pisar wrote:
I have a non-java package (pl) which links to jvm. Build scripts of pl needs to locate directories with libjava.so, libjvm.so etc. and instruct native linker (ld) where to find them (-L option).
Do you really need to link against a particular version of java?
As long as non-java package will work with any version of java, then I don't.
Would it make sense to use /usr/lib/jvm/jre/lib/arm/ etc? This is independent of JDK6, JDK7, etc.
It isn't. I investigated locations on different architectures with different JDK versions and I found there is no one place where header files and libraries reside. Even your example hardcodes archicture name into the path. See former `pl' spec file for the mess of conditions which has been needed before.
My approach allows to get proper paths for current JDK. It's absolutly independent on platform, JDK version, and distribution tweaks (like Fedora alternatives). I believe my tool works everywhere (even out side Fedora or with manually installed JDK).
-- Petr
java-devel@lists.fedoraproject.org