[oe] meta-java ant call is bound with ecj

Tamtamis, Panagiotis panagiotis.tamtamis at unify.com
Mon Nov 20 16:11:25 UTC 2017


Hello all,

I wanted to use ant from meta-java in order to compile certain java files.
After I executed the build.xml via ant I had the following strange error:
"Compliance level '1.5' is incompatible with source level '1.6'. A
compliance level '1.6' or better is required"

At first I thought that this was a problem with ant. And that version of ant
does not compile the code.
I thought that because when I compiled from sources the latest version of
ant my build worked fine.

So I upgraded meta-java ant to version 1.10.1. (Version now at master branch
is still 1.8.1)

And then I got the same error as above...

So I had to dig a little more to see what's was the real problem.
The problem was the javac been used from yocto and especially the ecj
compiler.

Ant when it is invoked by a shell script is invoked via a certain classpath
env value.
One of the paths is classpath/tools.zip and ecj-bootstrap. Written on the
recipe of ant-native_1.8.1.bb

This invocation binds ant with ecj and then you can't do anything in order
to correct the problem. Even if set another JAVA_HOME or call ant with
-Djava.home nothing works....

Finally I solved my problem with manual invocation of ant:
I write as a reference in case someone else needs it in the future:

export JAVA="${STAGING_LIBDIR_NATIVE}/jvm/icedtea7-native/jre/bin/java"

do_compile() {
        # invoke ant manual since ant call is bound with the ecj compiler
which cannot build our code
        ${JAVA} -classpath
${STAGING_DATADIR_NATIVE}/java/ant.jar:${STAGING_LIBDIR_NATIVE}/jvm/icedtea7
-native/lib/tools.jar \
        -Dant.library.dir=${STAGING_DATADIR_NATIVE}/java
org.apache.tools.ant.launch.Launcher -f build.xml
}

So I wanted to ask why ant invocation has to be bind with ecj invocation and
not with the java / javac been in PATH or even JAVA_HOME?
I tried to find out on the net what's the latest version of java that ecj
3.6.2 compiles. I guess its 1.5 (and thus the compliance error) but I
couldn't find it.
Can someone confirm it?

Thanks,
Tamis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4874 bytes
Desc: not available
URL: <http://lists.openembedded.org/pipermail/openembedded-devel/attachments/20171120/95852aee/attachment-0002.p7s>


More information about the Openembedded-devel mailing list