Various paths to files are hardcoded in either helper scripts or the resulting binaries (like path to Java class libraries). While this works well when using the files on the build machine, things start breaking down when the sstate gets shared between multiple workers in CI, as the paths between workers can differ.
Instead of using these hardcoded paths, form the paths at runtime and pass them as parameters when required. Signed-off-by: Erkka Kääriä <erkka.kaa...@intel.com> --- ...cacao-1.6.1-do-not-rely-on-absolute-paths.patch | 41 ++++++++++++++++++++++ recipes-core/cacao/cacao-initial-native_0.98.bb | 1 + recipes-core/cacao/cacao_1.6.1.bb | 21 ++++------- ...cacao-0.9.8-do-not-rely-on-absolute-paths.patch | 33 +++++++++++++++++ recipes-core/ecj/ecj-bootstrap-native.bb | 8 ++++- recipes-core/ecj/ecj-initial-native.bb | 9 ++++- 6 files changed, 96 insertions(+), 17 deletions(-) create mode 100644 recipes-core/cacao/cacao-1.6.1/cacao-1.6.1-do-not-rely-on-absolute-paths.patch create mode 100644 recipes-core/cacao/files/cacao-0.9.8-do-not-rely-on-absolute-paths.patch diff --git a/recipes-core/cacao/cacao-1.6.1/cacao-1.6.1-do-not-rely-on-absolute-paths.patch b/recipes-core/cacao/cacao-1.6.1/cacao-1.6.1-do-not-rely-on-absolute-paths.patch new file mode 100644 index 0000000..2b046cf --- /dev/null +++ b/recipes-core/cacao/cacao-1.6.1/cacao-1.6.1-do-not-rely-on-absolute-paths.patch @@ -0,0 +1,41 @@ +java.in: Do not use hardcode paths + +Cacao uses hardcoded paths to various files, if these paths are not +provided. This causes issues when sharing sstate with otherwise +identical workers, if build time paths are not identical. + +Signed-off-by: Erkka Kääriä <erkka.kaa...@intel.com> + +Upstream-Status: Inappropriate [Yocto-specific fixes] + +--- + cacao-1.6.1/src/scripts/java.in | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git cacao-1.6.1/src/scripts/java.in cacao-1.6.1/src/scripts/java.in +index 0790f02..2118de7 100644 +--- cacao-1.6.1/src/scripts/java.in ++++ cacao-1.6.1/src/scripts/java.in +@@ -22,5 +22,17 @@ + ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + ## 02110-1301, USA. + +-IFS="" +-exec $(dirname ${0})/cacao ${1+"$@"} ++SH_DIR=`dirname "$0"` ++CURRENT_DIR=`cd "${SH_DIR}" && pwd` ++ ++# if this shell script is invoked through symlink, we get invalid paths. As getting the real path to this file is ++# very painful using only /bin/sh, python is used instead. ++PYTHON_STR="import os; print os.path.dirname(os.path.realpath(os.readlink(\"${CURRENT_DIR}/java\"))) if os.path.islink(\"${CURRENT_DIR}/java\") else \"${CURRENT_DIR}\"" ++REAL_DIR=`python -c "${PYTHON_STR}"` ++ ++PARENT_DIR=`dirname ${REAL_DIR}` ++ ++export BOOTCLASSPATH="${PARENT_DIR}/share/cacao/vm.zip:${PARENT_DIR}/share/classpath/glibj.zip" ++LIBRARY_PATH="-Djava.library.path=${PARENT_DIR}/lib/classpath" ++exec ${REAL_DIR}/cacao ${LIBRARY_PATH} ${1+"$@"} ++ +-- +2.7.4 + diff --git a/recipes-core/cacao/cacao-initial-native_0.98.bb b/recipes-core/cacao/cacao-initial-native_0.98.bb index 2a8ced5..caaf53c 100644 --- a/recipes-core/cacao/cacao-initial-native_0.98.bb +++ b/recipes-core/cacao/cacao-initial-native_0.98.bb @@ -15,6 +15,7 @@ SRC_URI = "\ file://cacao-0.98-initial.patch \ file://disable_hw_exceptions.patch \ file://cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch \ + file://cacao-0.9.8-do-not-rely-on-absolute-paths.patch \ " # libjvm disabled - it would conflict with cacao-native installations diff --git a/recipes-core/cacao/cacao_1.6.1.bb b/recipes-core/cacao/cacao_1.6.1.bb index 83f216c..ec13cc5 100644 --- a/recipes-core/cacao/cacao_1.6.1.bb +++ b/recipes-core/cacao/cacao_1.6.1.bb @@ -11,7 +11,10 @@ DEPENDS = "zlib libtool classpath virtual/javac-native bdwgc" RPROVIDES_${PN} = "java2-runtime" SRC_URI = "http://www.complang.tuwien.ac.at/cacaojvm/download/cacao-${PV}/cacao-${PV}.tar.xz \ - file://system-boehm-gc.patch" + file://system-boehm-gc.patch \ + file://cacao-1.6.1-do-not-rely-on-absolute-paths.patch \ +" + SRC_URI[md5sum] = "2c18478404afd1cffdd15ad1e9d85a57" SRC_URI[sha256sum] = "eecc8bd1b528a028f43d9d1d0c06b97855bbf1d40e03826d911ebbc0b6971e12" @@ -23,13 +26,12 @@ REQUIRED_DISTRO_FEATURES_class-native := "" EXTRA_OECONF_class-native = "\ --enable-debug \ --with-vm-zip=${datadir}/cacao/vm.zip \ - --disable-libjvm \ - \ --with-java-runtime-library-classes=${datadir}/classpath/glibj.zip \ --with-java-runtime-library-libdir=${libdir_jni}:${libdir} \ --with-jni_md_h=${includedir}/classpath \ --with-jni_h=${includedir}/classpath \ --disable-test-dependency-checks \ + --disable-libjvm \ " CACHED_CONFIGUREVARS_class-native += "ac_cv_prog_JAVAC=${STAGING_BINDIR_NATIVE}/ecj-initial" @@ -37,11 +39,9 @@ CACHED_CONFIGUREVARS_class-native += "ac_cv_prog_JAVAC=${STAGING_BINDIR_NATIVE}/ EXTRA_OECONF = "\ --with-vm-zip=${datadir}/cacao/vm.zip \ --disable-libjvm \ - \ --with-build-java-runtime-library-classes=${STAGING_DATADIR}/classpath/glibj.zip \ --with-jni_h=${STAGING_INCDIR}/classpath \ --with-jni_md_h=${STAGING_INCDIR}/classpath \ - \ --with-java-runtime-library-classes=${datadir}/classpath/glibj.zip \ --with-java-runtime-library-libdir=${libdir_jni}:${libdir} \ --disable-test-dependency-checks \ @@ -54,21 +54,12 @@ do_configure_prepend () { mkdir -p src/mm/boehm-gc/m4 } -do_install_append () { +do_install_append_class-target() { rm ${D}/${bindir}/java } -do_install_append_class-native () { - ln -sf cacao ${D}/${bindir}/java -} - FILES_${PN} = "${bindir}/${PN} ${libdir}/cacao/lib*.so ${libdir}/lib*.so* ${datadir}/${PN}" FILES_${PN}-dbg += "${bindir}/.debug ${libdir}/.debug/lib*.so*" FILES_${PN}-doc += "${datadir}/gc" -ALTERNATIVE_${PN} = "java" -ALTERNATIVE_LINK = "${bindir}/java" -ALTERNATIVE_TARGET = "${bindir}/cacao" -ALTERNATIVE_PRIORITY = "10" - BBCLASSEXTEND = "native" diff --git a/recipes-core/cacao/files/cacao-0.9.8-do-not-rely-on-absolute-paths.patch b/recipes-core/cacao/files/cacao-0.9.8-do-not-rely-on-absolute-paths.patch new file mode 100644 index 0000000..93bcc3e --- /dev/null +++ b/recipes-core/cacao/files/cacao-0.9.8-do-not-rely-on-absolute-paths.patch @@ -0,0 +1,33 @@ +java.in: Do not use hardcode paths + +Cacao uses hardcoded paths to various files, if these paths are not +provided. This causes issues when sharing sstate with otherwise +identical workers, if build time paths are not identical. + +Signed-off-by: Erkka Kääriä <erkka.kaa...@intel.com> + +Upstream-Status: Inappropriate [Yocto-specific fixes] + +--- + cacao-0.98/src/scripts/java.in | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git cacao-0.98/src/scripts/java.in cacao-0.98/src/scripts/java.in +index 8a402e4..1738897 100644 +--- cacao-0.98/src/scripts/java.in ++++ cacao-0.98/src/scripts/java.in +@@ -32,4 +32,10 @@ + ## + ## $Id: java.in 5659 2006-10-04 10:37:09Z twisti $ + +-exec cacao ${1+"$@"} ++SH_DIR=`dirname "$0"` ++CURRENT_DIR=`cd "${SH_DIR}" && pwd` ++PARENT_DIR=`dirname ${CURRENT_DIR}` ++export BOOTCLASSPATH="${PARENT_DIR}/share/cacao-initial/vm.zip:${PARENT_DIR}/share/classpath-initial/glibj.zip" ++ ++LIBRARY_PATH="-Djava.library.path=${PARENT_DIR}/lib/classpath-initial" ++exec cacao ${LIBRARY_PATH} ${1+"$@"} ++ +-- +2.7.4 diff --git a/recipes-core/ecj/ecj-bootstrap-native.bb b/recipes-core/ecj/ecj-bootstrap-native.bb index e159c9d..276a8f0 100644 --- a/recipes-core/ecj/ecj-bootstrap-native.bb +++ b/recipes-core/ecj/ecj-bootstrap-native.bb @@ -27,7 +27,13 @@ inherit native do_compile() { # Create the start script echo "#!/bin/sh" > ecj-bootstrap - echo "ECJ_JAR=${STAGING_DATADIR}/java/${JAR}" >> ecj-bootstrap + + # get absolute path to parent directory, and use that as base path for the jar + echo "SH_DIR=\`dirname "\$0"\`" >> ecj-bootstrap + echo "CURRENT_DIR=\`cd "\${SH_DIR}" && pwd\`" >> ecj-bootstrap + echo "PARENT_DIR=\`dirname \${CURRENT_DIR}\`" >> ecj-bootstrap + + echo "ECJ_JAR=\${PARENT_DIR}/share/java/${JAR}" >> ecj-bootstrap echo "RUNTIME=java" >> ecj-bootstrap cat ecj.in >> ecj-bootstrap } diff --git a/recipes-core/ecj/ecj-initial-native.bb b/recipes-core/ecj/ecj-initial-native.bb index ed334ed..1792390 100644 --- a/recipes-core/ecj/ecj-initial-native.bb +++ b/recipes-core/ecj/ecj-initial-native.bb @@ -21,11 +21,18 @@ JAR = "ecj-bootstrap.jar" do_compile() { # Create the start script echo "#!/bin/sh" > ecj-initial - echo "ECJ_JAR=${STAGING_DATADIR}/java/${JAR}" >> ecj-initial + + # get absolute path to parent directory, and use that as base path for the jar + echo "SH_DIR=\`dirname "\$0"\`" >> ecj-initial + echo "CURRENT_DIR=\`cd "\${SH_DIR}" && pwd\`" >> ecj-initial + echo "PARENT_DIR=\`dirname \${CURRENT_DIR}\`" >> ecj-initial + + echo "ECJ_JAR=\${PARENT_DIR}/share/java/${JAR}" >> ecj-initial echo "RUNTIME=java-initial" >> ecj-initial cat ecj-initial.in >> ecj-initial } + do_install() { install -d ${D}${bindir} install -m 755 ${S}/ecj-initial ${D}${bindir} -- 2.7.4 --------------------------------------------------------------------- Intel Finland Oy Registered Address: PL 281, 00181 Helsinki Business Identity Code: 0357606 - 4 Domiciled in Helsinki This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -- _______________________________________________ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel