A pkg-config file for OpenJDK

Andrew Haley aph at redhat.com
Fri Jun 27 07:55:29 UTC 2014


On 27/06/14 08:10, David Holmes wrote:
> 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?

Per VM, certainly.  I'm not sure there's any real need to be able, for
example, to link against the x86 client VM.  I suppose it would be nice
if such a thing could be accommodated, but hardly necessary.

Andrew.





More information about the discuss mailing list