A pkg-config file for OpenJDK

David Holmes david.holmes at oracle.com
Fri Jun 27 07:10:01 UTC 2014


On 27/06/2014 12:56 AM, Omair Majid wrote:
> Hi,
>
> Over in Fedora, we have received requests from developers asking that
> compiling JNI programs and liking against the JVM be made easier [0]
> [1]. Some of the current difficulties include that the VM type (server,
> client) is not known by other programs and so they have to fall back to
> guessing where the libjvm.so that they should link against is.
>
> One standard approach on Linux for making linking against programs
> easier is to use pkg-config [1] files.
>
> A pkg-config file essentially describes the CFLAGS and LDFLAGS that need
> to be passed to the compiler and the linker to compile and link a
> program successfully, without knowing anything other than the name of
> the program or library to compile/link against.
>
> On Fedora/x86_64, such a file might look like (for OpenJDK 8):
>
>> jdk=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.5.x86_64
>> jre=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.5.x86_64/jre
>> lib_arch=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.5.x86_64/jre/lib/amd64
>
>> Name: java-1.8.0-openjdk
>> Description: OpenJDK 8
>> Version: 1.8.0.5
>> Cflags: -I${jdk}/include -I${jdk}/include/linux
>> Libs: -L${lib_arch} -L${lib_arch}/server -ljvm -ljava

So you need one pkg-config file per VM type?

David


> Rather than doing something Fedora-specific, I would like to propose
> carrying a template of this file upstream as part of the OpenJDK
> project. Then, each distribution could modify it and change only the
> bits that are specific to that distribution, and clients can rely on
> having common or well-known names for everything else.
>
> One nice-to-have feature would be keep this file somewhat generic, so
> other JPackage-style non-OpenJDK JDKs could adapt it too. That's why I
> have used `java-1.8.0-openjdk` as the name above, but I am open to
> changing it to whatever the consensus is.
>
> Does anyone else have any thoughts or comments about this?
>
> Thanks,
> Omair
>
> [0] https://bugzilla.redhat.com/show_bug.cgi?id=449456
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=740762
> [2] http://people.freedesktop.org/~dbn/pkg-config-guide.html
>



More information about the discuss mailing list