Skip to contentSkip to conversation

address failing qemu-arm runs in openjdk-7-jre build

RFC New Max Krummenacher 1 participant 4 messages Jan 15, 2015

lore
Share & tools
lore
#0 lore raw

cover address failing qemu-arm runs in openjdk-7-jre build

With at least one cross compiler configuration we get a segmentation fault from the qemu-arm binary during do_compile of openjdk-7-jre.
See the following thread:
http://lists.openembedded.org/pipermail/openembedded-devel/2015-January/099795.html

1/3 addresses the issue, i.e. compiles all binaries for qemu dynamically linked. 2/3 is a simple receipe which also shows the segmentation fault in a simple
hello world application.
3/3 reenables xawt, so we can run the java demos to test if java works on a
target since probably all demos use the XToolkit, e.g.
java -jar /usr/lib/jvm/java-7-openjdk/demo/jfc/Font2DTest/Font2DTest.jar

Max Krummenacher (3):
binaries run by qemu: remove linking with -static
gcc-static-test: initial commit
openjdk-7: enable xawt

 .../openjdk-6-6b24/icedtea-zero-hotspotfix.patch   |  2 +-
 .../openjdk-6-6b27/icedtea-crosscompile-fix.patch  |  2 +-
 .../openjdk-6-6b32/icedtea-crosscompile-fix.patch  |  2 +-
 .../openjdk-6-6b32/icedtea-zero-hotspotfix.patch   |  2 +-
 .../openjdk-6/fix_hotspot_crosscompile.patch       |  2 +-
 .../icedtea-jdk-nio-use-host-cc.patch              | 22 ------------
 .../openjdk-7-25b30/icedtea-zero-hotspotfix.patch  |  4 +--
 recipes-test/gcc-static-test/gcc-static-test.bb    | 40 ++++++++++++++++++++++
 .../gcc-static-test/gcc-static-test/hello.c        |  6 ++++
 9 files changed, 53 insertions(+), 29 deletions(-)
 create mode 100644 recipes-test/gcc-static-test/gcc-static-test.bb
 create mode 100644 recipes-test/gcc-static-test/gcc-static-test/hello.c
Signature · 1 line
1.9.3
#1 lore raw

RFC 1/3 binaries run by qemu: remove linking with -static

For the machine colibri-t20 a build of openjdk-7 fails with segmentation faults during the qemu-arm runs.
e.g.
Segmentation fault (core dumped) | qemu-arm -cpu cortex-a8 -s 2097152
-L .../sysroots/colibri-t20 \
-E LD_LIBRARY_PATH=.../sysroots/colibri-t20/lib ./mkbc - bytecodes_arm.s

The machine uses the following tunes and (through angstrom) a Linaro toolchain:
DEFAULTTUNE = "armv7athf"
TUNE_CCARGS += "-mfpu=vfpv3-d16"

Resulting in:
TUNE_FEATURES = "armv7a vfp thumb callconvention-hard"
TARGET_FPU = "vfp"

I found that qemu-arm can not execute any binary which is compiled with the compiler for Colibri-T20 and is linked with the -static flag. Even a simple hello world program does not work. When executing that hello world on the real hardware it also generates a segmentation fault.

Removing the -static flag fixed this.

Note that other machines, colibri-t30 or i.mx6 based ones with neon but otherwise identical setup do not suffer from the issue. DEFAULTTUNE = "armv7athf-neon"

---
 recipes-core/openjdk/openjdk-6-6b24/icedtea-zero-hotspotfix.patch  | 2 +-
 recipes-core/openjdk/openjdk-6-6b27/icedtea-crosscompile-fix.patch | 2 +-
 recipes-core/openjdk/openjdk-6-6b32/icedtea-crosscompile-fix.patch | 2 +-
 recipes-core/openjdk/openjdk-6-6b32/icedtea-zero-hotspotfix.patch  | 2 +-
 recipes-core/openjdk/openjdk-6/fix_hotspot_crosscompile.patch      | 2 +-
 recipes-core/openjdk/openjdk-7-25b30/icedtea-zero-hotspotfix.patch | 4 ++--
 6 files changed, 7 insertions(+), 7 deletions(-)
recipes-core/openjdk/openjdk-6-6b24/icedtea-zero-hotspotfix.patch +1 -1
index ec10e69..a67106b 100644
@@ -35,7 +35,7 @@ Index: openjdk/hotspot/make/linux/makefiles/zeroshark.make
  	@echo Compiling offset generator
  	$(QUIETLY) $(REMOVE_TARGET)
 -	$(CC_COMPILE) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
-+	$(CC_COMPILE) -static -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
++	$(CC_COMPILE) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
  
  endif
  
recipes-core/openjdk/openjdk-6-6b27/icedtea-crosscompile-fix.patch +1 -1
index 9a60bd6..2f952d9 100644
@@ -463,7 +463,7 @@ index 1fa311d..f3d06ad 100644
  $(SIZERS): $(SIZERS_C) 
  	$(prep-target)
 -	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
-+	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -static -o $@ $(SIZER)$(suffix $@).c
++	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
  
  $(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA)
  	$(prep-target)
recipes-core/openjdk/openjdk-6-6b32/icedtea-crosscompile-fix.patch +1 -1
index 3b34160..ddc9bc2 100644
@@ -247,7 +247,7 @@ index 1fa311d..f3d06ad 100644
  $(SIZERS): $(SIZERS_C) 
  	$(prep-target)
 -	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
-+	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -static -o $@ $(SIZER)$(suffix $@).c
++	$(CC) $(CFLAGS_$(subst .,,$(suffix $@))) $(CPPFLAGS) -o $@ $(SIZER)$(suffix $@).c
  
  $(WRAPPER_GENERATOR_CLASS): $(WRAPPER_GENERATOR_JAVA)
  	$(prep-target)
recipes-core/openjdk/openjdk-6-6b32/icedtea-zero-hotspotfix.patch +1 -1
index 91ace0e..0bca9b1 100644
@@ -35,7 +35,7 @@ index c2a1484..f460d85 100644
  	@echo Compiling offset generator
  	$(QUIETLY) $(REMOVE_TARGET)
 -	$(CC_COMPILE) $(CFLAGS) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
-+	$(CC_COMPILE) $(CFLAGS) -static -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
++	$(CC_COMPILE) $(CFLAGS) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
  
  endif
  
recipes-core/openjdk/openjdk-6/fix_hotspot_crosscompile.patch +1 -1
index 38fb191..4ab9c7f 100644
@@ -88,7 +88,7 @@ Index: icedtea6-1.8/ports/hotspot/make/linux/makefiles/zeroshark.make
  	@echo Compiling offset generator
  	$(QUIETLY) $(REMOVE_TARGET)
 -	$(CC_COMPILE) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
-+	$(CC_COMPILE) -static -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
++	$(CC_COMPILE) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
  
  endif
  
recipes-core/openjdk/openjdk-7-25b30/icedtea-zero-hotspotfix.patch +2 -2
index 83dba2b..7275d17 100644
@@ -25,13 +25,13 @@ index c2a1484..156bdd0 100644
  mkbc:	$(GAMMADIR)/tools/mkbc.c
  	@echo Compiling mkbc tool
 -	$(CC_COMPILE) -o $@ $< $(COMPILE_DONE)
-+	$(CC_COMPILE) -static -o $@ $< $(COMPILE_DONE)
++	$(CC_COMPILE) -o $@ $< $(COMPILE_DONE)
  
  mkoffsets:	asm_helper.cpp
  	@echo Compiling offset generator
  	$(QUIETLY) $(REMOVE_TARGET)
 -	$(CC_COMPILE) $(CFLAGS) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
-+	$(CC_COMPILE) $(CFLAGS) -DSTATIC_OFFSETS -static -o $@ $< $(COMPILE_DONE)
++	$(CC_COMPILE) $(CFLAGS) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
  
  endif
  
Signature · 1 line
1.9.3
#2 lore raw

RFC 2/3 gcc-static-test: initial commit

In reply to Max Krummenacher
---
 recipes-test/gcc-static-test/gcc-static-test.bb    | 40 ++++++++++++++++++++++
 .../gcc-static-test/gcc-static-test/hello.c        |  6 ++++
 2 files changed, 46 insertions(+)
 create mode 100644 recipes-test/gcc-static-test/gcc-static-test.bb
 create mode 100644 recipes-test/gcc-static-test/gcc-static-test/hello.c
recipes-test/gcc-static-test/gcc-static-test.bb new file +40 -0
new file mode 100644
index 0000000..c0fd852
@@ -0,0 +1,40 @@
+SUMMARY = "Test if cross-gcc can compile a linked binary which runs on qemu"
+DESCRIPTION = \
+"Have cross-gcc compile a simple helloworld style program linked statically \
+and dynamically and then test if qemu is able to run it without segfaulting. \
+Should help in hunting the following bug in building java: \
+http://lists.openembedded.org/pipermail/openembedded-devel/2015-January/099795.html"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+DEPENDS = ""
+
+SRC_URI = "file://hello.c"
+
+QEMU = "${@qemu_target_binary(d)} ${QEMU_OPTIONS} -s 2097152 -L ${STAGING_DIR_TARGET} -E LD_LIBRARY_PATH=${STAGING_BASELIBDIR}"
+
+trapsegfault() {
+    echo "We have a segmenation fault!"
+
+    # Reset handler
+    trap - 11
+}
+
+do_compile() {
+    #disable the trap built into run.do_compile by default
+    set +e
+    trap '' 0
+    trap 'trapsegfault' 11
+    ${CC} -static hello.c -o hello
+    ${QEMU} hello ; FAILED_STATIC=$?
+    ${CC} hello.c -o hello
+    ${QEMU} hello ; FAILED_DYNAMIC=$?
+    echo FAILED_STATIC $FAILED_STATIC
+    echo FAILED_DYNAMIC $FAILED_DYNAMIC
+    ( [ $FAILED_STATIC -eq 0 ] && [ $FAILED_DYNAMIC -eq 0 ] ) || exit -1
+}
+
+S = "${WORKDIR}"
+
+inherit qemu
recipes-test/gcc-static-test/gcc-static-test/hello.c new file +6 -0
new file mode 100644
index 0000000..5bd0da7
@@ -0,0 +1,6 @@
+#include <stdio.h>
+int main (void) {
+  printf("Hi\n");
+  return 0;
+}
+
Signature · 1 line
1.9.3
#3 lore raw

RFC 3/3 openjdk-7: enable xawt

In reply to Max Krummenacher

The build of xawt has been disabled as its build seemed to fail during a qemu call to generate a file with information on variable sizes.

This patch reenables xawt in the hope that changes to the qemu calls fixed the issues.

---
 .../icedtea-jdk-nio-use-host-cc.patch              | 22 ----------------------
 1 file changed, 22 deletions(-)
recipes-core/openjdk/openjdk-7-25b30/icedtea-jdk-nio-use-host-cc.patch +0 -22
index 94416bb..8e5da82 100644
@@ -49,25 +49,3 @@ Index: openjdk/jdk/make/java/nio/Makefile
 -endif
  
  .PHONY: sources 
-Index: openjdk/jdk/make/sun/Makefile
-===================================================================
---- openjdk/jdk/make/sun/Makefile	2013-07-25 09:10:09.000000000 -0700
-+++ openjdk/jdk/make/sun/Makefile	2013-10-01 21:32:01.625839149 -0700
-@@ -55,7 +55,7 @@
-     endif
-   endif
-   HEADLESS_SUBDIR = headless
--  XAWT_SUBDIR     = xawt
-+  XAWT_SUBDIR     =
- endif
- 
- ifeq ($(PLATFORM), macosx)
-@@ -87,7 +87,7 @@
- endif
- SUBDIRS_desktop    = audio $(RENDER_SUBDIR) image \
-                      $(LWAWT_PRE_SUBDIR) $(DISPLAY_LIBS) $(DGA_SUBDIR) $(LWAWT_SUBDIR) \
--                     jawt font jpeg cmm $(DISPLAY_TOOLS) beans
-+                     font jpeg cmm $(DISPLAY_TOOLS) beans
- SUBDIRS_management = management
- SUBDIRS_misc       = $(ORG_SUBDIR) rmi $(JDBC_SUBDIR) tracing
- SUBDIRS_tools      = native2ascii serialver tools jconsole
Signature · 1 line
1.9.3