Skip to contentSkip to conversation

task i was asked about: "Fix java build to not use host java"

DISCUSSION Robert P. J. Day 2 participants 2 messages Feb 16, 2020

lore
Share & tools
lore
#0 lore raw

(NOTE: while this was asked in the context of the latest wind river
linux, i'm guessing it applies to stock OE/YP.)

regarding a WRL project that i haven't actually seen yet, one of the
items on a TO DO list reads, "Fix java build to not use host java", and i'm trying to clarify what that might mean without yet seeing the project.

as i read that brief item, i'm assuming that this is a java-based
project wherein some java recipes must be compiled and added to the image and, currently, it's the host java compiler that is being used, whereas they want a java compiler to be compiled, added to the native sysroot, and used for all java compilation.

i'm aware of bitbake.conf's ASSUME_PROVIDED variable which says
nothing about java, and i've never worked on a java-flavoured OE project before, so i'm curious as to whether the host java would be used by default, and how to override that.

does this make sense? a pointer to some reasonable example of a
java-infused YP project would probably suffice, and i'm aware of the meta-java layer, which i assume will be dragged in. i have no details beyond this at the moment, just trying to figure out what that task might mean.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                         http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw
Quoted 21 lines · Robert P. J. Day

(NOTE: while this was asked in the context of the latest wind river
linux, i'm guessing it applies to stock OE/YP.)

regarding a WRL project that i haven't actually seen yet, one of the
items on a TO DO list reads, "Fix java build to not use host java", and i'm trying to clarify what that might mean without yet seeing the project.

as i read that brief item, i'm assuming that this is a java-based
project wherein some java recipes must be compiled and added to the image and, currently, it's the host java compiler that is being used, whereas they want a java compiler to be compiled, added to the native sysroot, and used for all java compilation.

i'm aware of bitbake.conf's ASSUME_PROVIDED variable which says
nothing about java, and i've never worked on a java-flavoured OE project before, so i'm curious as to whether the host java would be used by default, and how to override that.

Quoted 6 lines

does this make sense? a pointer to some reasonable example of a
java-infused YP project would probably suffice, and i'm aware of the meta-java layer, which i assume will be dragged in. i have no details beyond this at the moment, just trying to figure out what that task might mean.

We run java in our builds, but we're pulling in embedded Zulu rather than building from scratch, but I doubt that's anything more than a detail.

We just have a recipe that can build java for both target and native and have a native bbclassextend in there, with symlinks across to the java components from /usr/bin. At that point it pretty much just works. Relevant bits from a recipe consuming it then look like:

inherit java

DEPENDS = "virtual/javac-native"

export JAVA_HOME = "${STAGING_LIBDIR_JVM_NATIVE}/java"

RDEPENDS_${PN} = " \
    java2-runtime \

"

We've certainly tripped over a number of places where the host java leaks in, which is annoying. The only thing we're really using out of the inherit java is the paths it defines.

One problem we've found is that building both JNI and java components at the same time is tricky because most things don't distinguish between native and target JAVA_HOME.

Signature · 1 line
Alex Kiernan