Skip to contentSkip to conversation

dependencies: Reject gcj in BR2_NEEDS_HOST_JAVA check

PATCH Superseded Bernd Kuhls 2 participants 6 messages Aug 6, 2014 – Aug 16, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dependencies: Reject gcj in BR2_NEEDS_HOST_JAVA check

Xbmc uses the Groovy java package to generate API code, for details see
http://wiki.xbmc.org/index.php?title=Codegeneration#How_it_works

Groovy itself is broken when used with gcj:
http://jira.codehaus.org/browse/GROOVY-3701

Xbmc recommends to use another java package instead, like openjdk:
http://forum.xbmc.org/showthread.php?tid=199742

Until we come up with a host package to provide a java setup and in order to make autobuilder happy let?s reject gcj when we check for a java installation on the host.

Currently Xbmc is the only package using BR2_NEEDS_HOST_JAVA so changing the behaviour of dependencies.sh has no side effects.

Fixes
http://autobuild.buildroot.net/results/213/213d7454a1dc68cfb8f4c8d9508f52ebf8e58e33/
http://autobuild.buildroot.net/results/639/639cda872cf36c122cbd6139dd76f6b51ac1864e/
http://autobuild.buildroot.net/results/c9e/c9eb12c95b2939c64590692a82af8d84bbd90956/

---
 support/dependencies/dependencies.sh |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
support/dependencies/dependencies.sh +13 -1
index 88e5ad2..b09e376 100755
@@ -188,7 +188,19 @@ if grep ^BR2_TOOLCHAIN_BUILDROOT=y $BR2_CONFIG > /dev/null && \
 fi
 
 if grep -q ^BR2_NEEDS_HOST_JAVA=y $BR2_CONFIG ; then
-	check_prog_host "java"
+	JAVA=$(which java 2> /dev/null)
+	if [ -z "$JAVA" ] ; then
+		echo
+		echo "You must install 'java' on your build machine";
+		exit 1;
+	fi;
+	JAVA_GCJ=$($JAVA -version 2>&1 | grep gcj)
+	if [ ! -z "$JAVA_GCJ" ] ; then
+		echo
+		echo "$JAVA_GCJ is not sufficient to compile your package selection."
+		echo "Please install OpenJDK/IcedTea/Oracle Java."
+		exit 1 ;
+	fi
 fi
 
 if grep -q ^BR2_NEEDS_HOST_JAVAC=y $BR2_CONFIG ; then
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 dependencies: Reject gcj in BR2_NEEDS_HOST_JAVA check

Bernd, All,

On 2014-08-06 22:26 +0200, Bernd Kuhls spake thusly:

Quoted 31 lines

Xbmc uses the Groovy java package to generate API code, for details see
http://wiki.xbmc.org/index.php?title=Codegeneration#How_it_works

Groovy itself is broken when used with gcj:
http://jira.codehaus.org/browse/GROOVY-3701

Xbmc recommends to use another java package instead, like openjdk:
http://forum.xbmc.org/showthread.php?tid=199742

Until we come up with a host package to provide a java setup and in order to make autobuilder happy let?s reject gcj when we check for a java installation on the host.

Currently Xbmc is the only package using BR2_NEEDS_HOST_JAVA so changing the behaviour of dependencies.sh has no side effects.

Fixes
http://autobuild.buildroot.net/results/213/213d7454a1dc68cfb8f4c8d9508f52ebf8e58e33/
http://autobuild.buildroot.net/results/639/639cda872cf36c122cbd6139dd76f6b51ac1864e/
http://autobuild.buildroot.net/results/c9e/c9eb12c95b2939c64590692a82af8d84bbd90956/

---
 support/dependencies/dependencies.sh |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
support/dependencies/dependencies.sh +0 -0
index 88e5ad2..b09e376 100755

support/dependencies/dependencies.sh if grep ^BR2_TOOLCHAIN_BUILDROOT=y $BR2_CONFIG > /dev/null && \ · line 196

Quoted 10 lines
support/dependencies/dependencies.sh +6 -1
@@ -188,7 +188,19 @@ if grep ^BR2_TOOLCHAIN_BUILDROOT=y $BR2_CONFIG > /dev/null && \
 fi
 
 if grep -q ^BR2_NEEDS_HOST_JAVA=y $BR2_CONFIG ; then
-	check_prog_host "java"
+	JAVA=$(which java 2> /dev/null)
+	if [ -z "$JAVA" ] ; then
+		echo
+		echo "You must install 'java' on your build machine";
+		exit 1;
+	fi;

Well, I'd keep the 'check_prog_host "java"' line, and would just add the lines below, replacing $JAVA witrh just 'java'.

Regards,
Yann E. MORIN.

Quoted 17 lines
support/dependencies/dependencies.sh +7 -0
+	JAVA_GCJ=$($JAVA -version 2>&1 | grep gcj)
+	if [ ! -z "$JAVA_GCJ" ] ; then
+		echo
+		echo "$JAVA_GCJ is not sufficient to compile your package selection."
+		echo "Please install OpenJDK/IcedTea/Oracle Java."
+		exit 1 ;
+	fi
 fi
 
 if grep -q ^BR2_NEEDS_HOST_JAVAC=y $BR2_CONFIG ; then
Signature · 6 lines
1.7.10.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 dependencies: Reject gcj in BR2_NEEDS_HOST_JAVA check

In reply to Bernd Kuhls

Bernd, All,

I forgot some part of my review in my previous reply...

On 2014-08-06 22:26 +0200, Bernd Kuhls spake thusly:

Quoted 32 lines

Xbmc uses the Groovy java package to generate API code, for details see
http://wiki.xbmc.org/index.php?title=Codegeneration#How_it_works

Groovy itself is broken when used with gcj:
http://jira.codehaus.org/browse/GROOVY-3701

Xbmc recommends to use another java package instead, like openjdk:
http://forum.xbmc.org/showthread.php?tid=199742

Until we come up with a host package to provide a java setup and in order to make autobuilder happy let?s reject gcj when we check for a java installation on the host.

Currently Xbmc is the only package using BR2_NEEDS_HOST_JAVA so changing the behaviour of dependencies.sh has no side effects.

Fixes
http://autobuild.buildroot.net/results/213/213d7454a1dc68cfb8f4c8d9508f52ebf8e58e33/
http://autobuild.buildroot.net/results/639/639cda872cf36c122cbd6139dd76f6b51ac1864e/
http://autobuild.buildroot.net/results/c9e/c9eb12c95b2939c64590692a82af8d84bbd90956/

---
 support/dependencies/dependencies.sh |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
support/dependencies/dependencies.sh +0 -0
index 88e5ad2..b09e376 100755
@@ -188,7 +188,19 @@ if grep ^BR2_TOOLCHAIN_BUILDROOT=y $BR2_CONFIG > /dev/null && \
 fi

support/dependencies/dependencies.sh if grep ^BR2_TOOLCHAIN_BUILDROOT=y $BR2_CONFIG > /dev/null && \ · line 197

Quoted 10 lines
support/dependencies/dependencies.sh +7 -1
 
 if grep -q ^BR2_NEEDS_HOST_JAVA=y $BR2_CONFIG ; then
-	check_prog_host "java"
+	JAVA=$(which java 2> /dev/null)
+	if [ -z "$JAVA" ] ; then
+		echo
+		echo "You must install 'java' on your build machine";
+		exit 1;
+	fi;
+	JAVA_GCJ=$($JAVA -version 2>&1 | grep gcj)
$ gcj -version
gcj: error: unrecognized command line option ?-version?

So I guess we should have:

    JAVA_GCJ="$(java --version 2>/dev/null |grep gcj)"

Which would be empty for the JDK's java, but not for gcj. I prefer we rely on that, rather than the error mesage from gcj.

Regards,
Yann E. MORIN.

Quoted 16 lines
support/dependencies/dependencies.sh +6 -0
+	if [ ! -z "$JAVA_GCJ" ] ; then
+		echo
+		echo "$JAVA_GCJ is not sufficient to compile your package selection."
+		echo "Please install OpenJDK/IcedTea/Oracle Java."
+		exit 1 ;
+	fi
 fi
 
 if grep -q ^BR2_NEEDS_HOST_JAVAC=y $BR2_CONFIG ; then
Signature · 6 lines
1.7.10.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/1 dependencies: Reject gcj in BR2_NEEDS_HOST_JAVA check

"Yann E. MORIN" <[email protected]> wrote in news:20140813141110.GF3939 at free.fr:

Quoted 7 lines

support/dependencies/dependencies.sh if grep ^BR2_TOOLCHAIN_BUILDROOT=y $BR2_CONFIG > /dev/null && \ · line 197

Quoted 7 lines
support/dependencies/dependencies.sh +7 -0
+     JAVA=$(which java 2> /dev/null)
+     if [ -z "$JAVA" ] ; then
+          echo
+          echo "You must install 'java' on your build machine";
+          exit 1;
+     fi;
+     JAVA_GCJ=$($JAVA -version 2>&1 | grep gcj)
Quoted 6 lines
$ gcj -version
gcj: error: unrecognized command line option ???-version???
So I guess we should have:
    JAVA_GCJ="$(java --version 2>/dev/null |grep gcj)"
Which would be empty for the JDK's java, but not for gcj. I prefer we
rely on that, rather than the error mesage from gcj.

Hi,

$JAVA contains the result of "which java" which is /usr/bin/java here. This corresponds to xbmc/codegenerator.mk, which also calls

JAVA ?= $(shell which java)

Executing /usr/bin/gcj directly is not desired ;)

/usr/bin/java -version resolves to either

$ /usr/bin/java -version
java version "1.5.0"
gij (GNU libgcj) version 4.7.2

or

$ /usr/bin/java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.1) (7u65-2.5.1-2~deb7u1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

on my system (Debian 7.6).

Regards, Bernd

#4 lore raw

PATCH 1/1 dependencies: Reject gcj in BR2_NEEDS_HOST_JAVA check

Bernd, All,

On 2014-08-13 19:13 +0200, Bernd Kuhls spake thusly:

Quoted 32 lines

"Yann E. MORIN" <[email protected]> wrote in news:20140813141110.GF3939 at free.fr:

Quoted 7 lines

support/dependencies/dependencies.sh if grep ^BR2_TOOLCHAIN_BUILDROOT=y $BR2_CONFIG > /dev/null && \ · line 197

Quoted 7 lines
support/dependencies/dependencies.sh +7 -0
+     JAVA=$(which java 2> /dev/null)
+     if [ -z "$JAVA" ] ; then
+          echo
+          echo "You must install 'java' on your build machine";
+          exit 1;
+     fi;
+     JAVA_GCJ=$($JAVA -version 2>&1 | grep gcj)
Quoted 6 lines
$ gcj -version
gcj: error: unrecognized command line option ???-version???
So I guess we should have:
    JAVA_GCJ="$(java --version 2>/dev/null |grep gcj)"
Which would be empty for the JDK's java, but not for gcj. I prefer we
rely on that, rather than the error mesage from gcj.

Hi,

$JAVA contains the result of "which java" which is /usr/bin/java here. This corresponds to xbmc/codegenerator.mk, which also calls

JAVA ?= $(shell which java)

Executing /usr/bin/gcj directly is not desired ;)

/usr/bin/java -version resolves to either

$ /usr/bin/java -version
java version "1.5.0"
gij (GNU libgcj) version 4.7.2
Quoted 6 lines

or

$ /usr/bin/java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.1) (7u65-2.5.1-2~deb7u1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

OK, so 'java' from gcj accepts the same args as 'java' from the JDK. OK.

So, I still say we should keep the original check, and then check that java is not from gcj :

    check_prog_host "java"
    if java -version 2>&1 |grep gcj >/dev/null 2>&1; then
        echo "Failed"
        exit 1
    fi

check_prog_host already calls 'which $1' so we're sure we can call 'java'.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH 1/1 dependencies: Reject gcj in BR2_NEEDS_HOST_JAVA check

"Yann E. MORIN" <[email protected]> wrote in news:20140813212312.GI3939 at free.fr:

Quoted 1 line

check_prog_host already calls 'which $1' so we're sure we can call 'java'.

Hi,

ok, I am going to send v2 with your suggestion added, but I would like to keep the $JAVA_GCJ part to have a nicer looking error message, examples:

gij (GNU libgcj) version 4.7.2 is not sufficient to compile your package selection.
Please install an OpenJDK/IcedTea/Oracle Java.

gij (GNU libgcj) version 4.6.3 is not sufficient to compile your package selection.
Please install an OpenJDK/IcedTea/Oracle Java.

Regards, Bernd