<div dir="ltr"><div>Just a follow up to the first patch. I did test the change in master, there was no "dependency loop" error when I built core-image-minimal, and I did check the content of icecc-create-env script in sysroot, it was identical to the updated version.<br>
<br></div>I repeated the build to confirm my original observation about the build, and they were identical. The only time I get the "dependency loop" error is if I run "bitbake icecc-create-env-native". However, I did overlook the first this warning message:<br>
<br>WARNING: Unable to get checksum for icecc-create-env-native SRC_URI entry icecc-create-env: file could not be found 00:00:29<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Dec 4, 2013 at 8:35 PM, Iyad Qumei <span dir="ltr"><<a href="mailto:iyadkq@gmail.com" target="_blank">iyadkq@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The original icecc script does not handle toolchain content<br>
properly, resulting in build failures, such as<br>
<br>
gxx: fatal error: -fuse-linker-plugin, but liblto_plugin.so not found<br>
<br>
This patch brings in the latest script form the icecream source, and<br>
modifies it for use in the OE build environment. The change was tested<br>
with OE-Core built toolchain, and external toolchain.<br>
<br>
Signed-off-by: Iyad Qumei <<a href="mailto:iyadkq@gmail.com">iyadkq@gmail.com</a>><br>
---<br>
.../icecc-create-env-native/icecc-create-env | 266 +++++++++++++++-----<br>
.../<a href="http://icecc-create-env-native_0.1.bb" target="_blank">icecc-create-env-native_0.1.bb</a> | 26 --<br>
.../<a href="http://icecc-create-env-native_1.0.1.bb" target="_blank">icecc-create-env-native_1.0.1.bb</a> | 26 ++<br>
3 files changed, 233 insertions(+), 85 deletions(-)<br>
delete mode 100644 meta/recipes-devtools/icecc-create-env/<a href="http://icecc-create-env-native_0.1.bb" target="_blank">icecc-create-env-native_0.1.bb</a><br>
create mode 100644 meta/recipes-devtools/icecc-create-env/<a href="http://icecc-create-env-native_1.0.1.bb" target="_blank">icecc-create-env-native_1.0.1.bb</a><br>
<br>
diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env-native/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env-native/icecc-create-env<br>
index 7e4dbc4..6d2e3c6 100755<br>
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env-native/icecc-create-env<br>
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env-native/icecc-create-env<br>
@@ -29,33 +29,95 @@ add_file ()<br>
toadd="$name=$path"<br>
is_contained "$toadd" && return<br>
if test -z "$silent"; then<br>
- echo "adding file $toadd"<br>
+ echo "adding file $toadd"<br>
fi<br>
target_files="$target_files $toadd"<br>
if test -x "$path"; then<br>
# Only call ldd when it makes sense<br>
if file -L "$path" | grep 'ELF' > /dev/null 2>&1; then<br>
- if ! file -L "$path" | grep 'static' > /dev/null 2>&1; then<br>
- # ldd now outputs ld as /lib/ld-linux.so.xx on current nptl based glibc<br>
- # this regexp parse the outputs like:<br>
- # ldd /usr/bin/gcc<br>
- # linux-gate.so.1 => (0xffffe000)<br>
- # libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000)<br>
- # /lib/ld-linux.so.2 (0xb7fe8000)<br>
- # covering both situations ( with => and without )<br>
- for lib in `ldd "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do<br>
- test -f "$lib" || continue<br>
- # Check wether the same library also exists in the parent directory,<br>
- # and prefer that on the assumption that it is a more generic one.<br>
- local baselib=`echo "$lib" | sed 's,\(/[^/]*\)/.*\(/[^/]*\)$,\1\2,'`<br>
- test -f "$baselib" && lib=$baselib<br>
- add_file "$lib"<br>
- done<br>
+ if ! file -L "$path" | grep 'static' > /dev/null 2>&1; then<br>
+ # ldd now outputs ld as /lib/ld-linux.so.xx on current nptl based glibc<br>
+ # this regexp parse the outputs like:<br>
+ # ldd /usr/bin/gcc<br>
+ # linux-gate.so.1 => (0xffffe000)<br>
+ # libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000)<br>
+ # /lib/ld-linux.so.2 (0xb7fe8000)<br>
+ # covering both situations ( with => and without )<br>
+ for lib in `ldd "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do<br>
+ test -f "$lib" || continue<br>
+ # Check wether the same library also exists in the parent directory,<br>
+ # and prefer that on the assumption that it is a more generic one.<br>
+ local baselib=`echo "$lib" | sed 's,\(/[^/]*\)/.*\(/[^/]*\)$,\1\2,'`<br>
+ test -f "$baselib" && lib=$baselib<br>
+ add_file "$lib"<br>
+ done<br>
fi<br>
fi<br>
fi<br>
}<br>
<br>
+# returns abs path to filedir<br>
+abs_path()<br>
+{<br>
+ local path=$1<br>
+ if test -f "$path"; then<br>
+ pushd $(dirname $path) > /dev/null 2>&1<br>
+ dir_path=`pwd -P`<br>
+ path=$dir_path/$(basename $path)<br>
+ popd > /dev/null 2>&1<br>
+ elif test -d "$path"; then<br>
+ pushd $path > /dev/null 2>&1<br>
+ path=`pwd -P`<br>
+ popd > /dev/null 2>&1<br>
+ fi<br>
+ echo $path<br>
+}<br>
+<br>
+# Search and add file to the tarball file.<br>
+search_addfile()<br>
+{<br>
+ local compiler=$1<br>
+ local file_name=$2<br>
+ local file_installdir=$3<br>
+ local file=""<br>
+<br>
+ file=$($compiler -print-prog-name=$file_name)<br>
+<br>
+ if test -z "$file" || test "$file" = "$file_name" || ! test -e "$file"; then<br>
+ file=`$compiler -print-file-name=$file_name`<br>
+ fi<br>
+<br>
+ if ! test -e "$file"; then<br>
+ return 1<br>
+ fi<br>
+<br>
+ if test -z "$file_installdir"; then<br>
+ # The file is going to be added to the tarball<br>
+ # in the same path where the compiler found it.<br>
+<br>
+ file_installdir=$(dirname $file)<br>
+ abs_installdir=$(abs_path $file_installdir)<br>
+<br>
+ if test "$file_installdir" != "$abs_installdir"; then<br>
+ # The path where the compiler found the file is relative!<br>
+ # If the path where the compiler found the file is relative<br>
+ # to compiler's path, we must change it to be relative to<br>
+ # /usr/bin path where the compiler is going to be installed<br>
+ # in the tarball file.<br>
+ # Replacing relative path by abs path because the tar command<br>
+ # used to create the tarball file doesn't work well with<br>
+ # relative path as installdir.<br>
+<br>
+ compiler_basedir=$(abs_path ${compiler%/*/*})<br>
+ file_installdir=${abs_installdir/$compiler_basedir/"/usr"}<br>
+ fi<br>
+ fi<br>
+<br>
+ add_file "$file" "$file_installdir/$file_name"<br>
+<br>
+ return 0<br>
+}<br>
+<br>
# backward compat<br>
if test "$1" = "--respect-path"; then<br>
shift<br>
@@ -67,62 +129,148 @@ if test "$1" = "--silent"; then<br>
shift<br>
fi<br>
<br>
-<br>
-added_gcc=$1<br>
-shift<br>
-added_gxx=$1<br>
-shift<br>
-added_as=$1<br>
-shift<br>
-archive_name=$1<br>
-<br>
-if test -z "$added_gcc" || test -z "$added_gxx" ; then<br>
- echo "usage: $0 <gcc_path> <g++_path>"<br>
- exit 1<br>
+if test "$1" != "--gcc" -a "$1" != "--clang"; then<br>
+ # backward compat<br>
+ added_gcc=$1<br>
+ shift<br>
+ added_gxx=$1<br>
+ shift<br>
+ added_as=$1<br>
+ shift<br>
+ archive_name=$1<br>
+ shift<br>
+ gcc=1<br>
+else<br>
+ if test "$1" = "--gcc"; then<br>
+ shift<br>
+ added_gcc=$1<br>
+ shift<br>
+ added_gxx=$1<br>
+ shift<br>
+ added_as=$1<br>
+ shift<br>
+ archive_name=$1<br>
+ shift<br>
+ gcc=1<br>
+ elif test "$1" = "--clang"; then<br>
+ shift<br>
+ added_clang=$1<br>
+ shift<br>
+ added_compilerwrapper=$1<br>
+ shift<br>
+ clang=1<br>
+ else<br>
+ usage<br>
+ exit 1<br>
+ fi<br>
fi<br>
<br>
-if ! test -x "$added_gcc" ; then<br>
- echo "'$added_gcc' is no executable."<br>
- exit 1<br>
+if test -n "$gcc"; then<br>
+ if test -z "$added_gcc" || test -z "$added_gxx"; then<br>
+ usage<br>
+ exit 1<br>
+ fi<br>
+ if ! test -x "$added_gcc" ; then<br>
+ echo "'$added_gcc' is no executable."<br>
+ exit 1<br>
+ fi<br>
+ if ! test -x "$added_gxx" ; then<br>
+ echo "'$added_gxx' is no executable."<br>
+ exit 1<br>
+ fi<br>
+ if test -z "$added_as" ; then<br>
+ add_file /usr/bin/as /usr/bin/as<br>
+ else<br>
+ if ! test -x "$added_as" ; then<br>
+ echo "'$added_as' is no executable."<br>
+ exit 1<br>
+ fi<br>
+ add_file $added_as /usr/bin/as<br>
+ fi<br>
fi<br>
<br>
-if ! test -x "$added_gxx" ; then<br>
- echo "'$added_gcc' is no executable."<br>
- exit 1<br>
+if test -n "$clang"; then<br>
+ if ! test -x "$added_clang" ; then<br>
+ echo "'$added_clang' is no executable."<br>
+ exit 1<br>
+ fi<br>
+ if ! test -x "$added_compilerwrapper" ; then<br>
+ echo "'$added_compilerwrapper' is no executable."<br>
+ exit 1<br>
+ fi<br>
fi<br>
<br>
+extrafiles=<br>
+while test "x$1" = "x--addfile"; do<br>
+ shift<br>
+ extrafiles="$extrafiles $1"<br>
+ shift<br>
+done<br>
<br>
+tempdir=`mktemp -d /tmp/iceccenvXXXXXX`<br>
<br>
-add_file $added_gcc /usr/bin/gcc<br>
-add_file $added_gxx /usr/bin/g++<br>
+# for testing the environment is usable at all<br>
+add_file /bin/true<br>
<br>
-if test -z "$added_as" ; then<br>
- add_file /usr/bin/as /usr/bin/as<br>
-else<br>
- if ! test -x "$added_as" ; then<br>
- echo "'$added_as' is no executable."<br>
- exit 1<br>
- fi<br>
+if test -n "$gcc"; then<br>
+ # getting compilers abs path<br>
+ added_gcc=$(abs_path $added_gcc)<br>
+ added_gxx=$(abs_path $added_gxx)<br>
<br>
- add_file $added_as /usr/bin/as<br>
-fi<br>
+ if test -z "$clang"; then<br>
+ add_file $added_gcc /usr/bin/gcc<br>
+ add_file $added_gxx /usr/bin/g++<br>
+ else<br>
+ # HACK: The clang case below will add a wrapper in place of gcc, so add the real<br>
+ # gcc under a different name that the wrapper will call.<br>
+ add_file $added_gcc /usr/bin/gcc.bin<br>
+ add_file $added_gxx /usr/bin/g++.bin<br>
+ fi<br>
+ add_file `$added_gcc -print-prog-name=cc1` /usr/bin/cc1<br>
+ add_file `$added_gxx -print-prog-name=cc1plus` /usr/bin/cc1plus<br>
+<br>
+ gcc_as=$($added_gcc -print-prog-name=as)<br>
+ if test "$gcc_as" = "as"; then<br>
+ add_file /usr/bin/as<br>
+ else<br>
+ add_file "$gcc_as" /usr/bin/as<br>
+ fi<br>
<br>
-add_file `$added_gcc -print-prog-name=cc1` /usr/bin/cc1<br>
-add_file `$added_gxx -print-prog-name=cc1plus` /usr/bin/cc1plus<br>
-specfile=`$added_gcc -print-file-name=specs`<br>
-if test -n "$specfile" && test -e "$specfile"; then<br>
- add_file "$specfile"<br>
+ search_addfile $added_gcc specs<br>
+ search_addfile $added_gcc liblto_plugin.so<br>
fi<br>
<br>
-ltofile=`$added_gcc -print-prog-name=lto1`<br>
-pluginfile="${ltofile%lto1}liblto_plugin.so"<br>
-if test -r "$pluginfile"<br>
-then<br>
- add_file $pluginfile ${pluginfile#*usr}<br>
- add_file $pluginfile /usr${pluginfile#*usr}<br>
+if test -n "$clang"; then<br>
+ add_file $added_clang /usr/bin/clang<br>
+ # HACK: Older icecream remotes have /usr/bin/{gcc|g++} hardcoded and wouldn't<br>
+ # call /usr/bin/clang at all. So include a wrapper binary that will call gcc or clang<br>
+ # depending on an extra argument added by icecream.<br>
+ add_file $added_compilerwrapper /usr/bin/gcc<br>
+ add_file $added_compilerwrapper /usr/bin/g++<br>
+<br>
+ add_file $($added_clang -print-prog-name=as) /usr/bin/as<br>
+<br>
+ # clang always uses its internal .h files<br>
+ clangincludes=$(dirname $($added_clang -print-file-name=include/limits.h))<br>
+ clangprefix=$(dirname $(dirname $added_clang))<br>
+ for file in $(find $clangincludes -type f); do<br>
+ # get path without ..<br>
+ destfile=$(readlink -e $file)<br>
+ # and convert from <prefix> to /usr if needed<br>
+ destfile=$(echo $destfile | sed "s#$clangprefix#/usr#" )<br>
+ add_file "$file" "$destfile"<br>
+ done<br>
fi<br>
<br>
-tempdir=`mktemp -d /tmp/iceccenvXXXXXX`<br>
+for extrafile in $extrafiles; do<br>
+ add_file $extrafile<br>
+done<br>
+<br>
+# special case for weird multilib setups<br>
+for dir in /lib /lib64 /usr/lib /usr/lib64; do<br>
+ test -L $dir && cp -p $dir $tempdir$dir<br>
+done<br>
+<br>
new_target_files=<br>
for i in $target_files; do<br>
case $i in<br>
@@ -151,7 +299,7 @@ target_files=`for i in $new_target_files; do echo $i; done | sort`<br>
#if not use the md5 of all files as the archive name<br>
if test -z "$archive_name"; then<br>
md5sum=NONE<br>
- for file in /usr/bin/md5sum /bin/md5 /usr/bin/md5; do<br>
+ for file in /usr/bin/md5sum /bin/md5 /usr/bin/md5 /sbin/md5; do<br>
if test -x $file; then<br>
md5sum=$file<br>
break<br>
diff --git a/meta/recipes-devtools/icecc-create-env/<a href="http://icecc-create-env-native_0.1.bb" target="_blank">icecc-create-env-native_0.1.bb</a> b/meta/recipes-devtools/icecc-create-env/<a href="http://icecc-create-env-native_0.1.bb" target="_blank">icecc-create-env-native_0.1.bb</a><br>
deleted file mode 100644<br>
index b04474e..0000000<br>
--- a/meta/recipes-devtools/icecc-create-env/<a href="http://icecc-create-env-native_0.1.bb" target="_blank">icecc-create-env-native_0.1.bb</a><br>
+++ /dev/null<br>
@@ -1,26 +0,0 @@<br>
-DESCRIPTION = "This is a modified version of the icecc-create-env script in order to\<br>
-make it work with OE."<br>
-SECTION = "base"<br>
-# source file has just a "GPL" word, but upstream is GPLv2+.<br>
-# most probably just GPL would be a mistake<br>
-LICENSE = "GPLv2+"<br>
-LIC_FILES_CHKSUM = "file://icecc-create-env;beginline=2;endline=5;md5=ae1df3d6a058bfda40b66094c5f6065f"<br>
-<br>
-PR = "r2"<br>
-<br>
-DEPENDS = ""<br>
-INHIBIT_DEFAULT_DEPS = "1"<br>
-<br>
-FILESPATH = "${FILE_DIRNAME}/${PN}/"<br>
-<br>
-inherit native<br>
-<br>
-PATCHTOOL = "patch"<br>
-SRC_URI = "file://icecc-create-env"<br>
-<br>
-S = "${WORKDIR}"<br>
-<br>
-do_install() {<br>
- install -d ${D}/${bindir}<br>
- install -m 0755 ${WORKDIR}/icecc-create-env ${D}/${bindir}<br>
-}<br>
diff --git a/meta/recipes-devtools/icecc-create-env/<a href="http://icecc-create-env-native_1.0.1.bb" target="_blank">icecc-create-env-native_1.0.1.bb</a> b/meta/recipes-devtools/icecc-create-env/<a href="http://icecc-create-env-native_1.0.1.bb" target="_blank">icecc-create-env-native_1.0.1.bb</a><br>
new file mode 100644<br>
index 0000000..9f5c9a2<br>
--- /dev/null<br>
+++ b/meta/recipes-devtools/icecc-create-env/<a href="http://icecc-create-env-native_1.0.1.bb" target="_blank">icecc-create-env-native_1.0.1.bb</a><br>
@@ -0,0 +1,26 @@<br>
+DESCRIPTION = "This is a modified version of the icecc-create-env script in order to\<br>
+make it work with OE."<br>
+SECTION = "base"<br>
+# source file has just a "GPL" word, but upstream is GPLv2+.<br>
+# most probably just GPL would be a mistake<br>
+LICENSE = "GPLv2+"<br>
+LIC_FILES_CHKSUM = "file://icecc-create-env;beginline=2;endline=5;md5=ae1df3d6a058bfda40b66094c5f6065f"<br>
+<br>
+PR = "r0"<br>
+<br>
+DEPENDS = ""<br>
+INHIBIT_DEFAULT_DEPS = "1"<br>
+<br>
+FILESPATH = "${FILE_DIRNAME}/${PN}/"<br>
+<br>
+inherit native<br>
+<br>
+PATCHTOOL = "patch"<br>
+SRC_URI = "file://icecc-create-env"<br>
+<br>
+S = "${WORKDIR}"<br>
+<br>
+do_install() {<br>
+ install -d ${D}/${bindir}<br>
+ install -m 0755 ${WORKDIR}/icecc-create-env ${D}/${bindir}<br>
+}<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.10.4<br>
<br>
</font></span></blockquote></div><br></div>