<div dir="ltr"><div>Just a follow up to the first patch.  I did test the change in master, there was no &quot;dependency loop&quot; 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 &quot;dependency loop&quot; error is if I run &quot;bitbake icecc-create-env-native&quot;.  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">&lt;<a href="mailto:iyadkq@gmail.com" target="_blank">iyadkq@gmail.com</a>&gt;</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 &lt;<a href="mailto:iyadkq@gmail.com">iyadkq@gmail.com</a>&gt;<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=&quot;$name=$path&quot;<br>
   is_contained &quot;$toadd&quot; &amp;&amp; return<br>
   if test -z &quot;$silent&quot;; then<br>
-  echo &quot;adding file $toadd&quot;<br>
+    echo &quot;adding file $toadd&quot;<br>
   fi<br>
   target_files=&quot;$target_files $toadd&quot;<br>
   if test -x &quot;$path&quot;; then<br>
     # Only call ldd when it makes sense<br>
     if file -L &quot;$path&quot; | grep &#39;ELF&#39; &gt; /dev/null 2&gt;&amp;1; then<br>
-       if ! file -L &quot;$path&quot; | grep &#39;static&#39; &gt; /dev/null 2&gt;&amp;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 =&gt;  (0xffffe000)<br>
-               #         libc.so.6 =&gt; /lib/tls/libc.so.6 (0xb7e81000)<br>
-               #         /lib/ld-linux.so.2 (0xb7fe8000)<br>
-               # covering both situations ( with =&gt; and without )<br>
-          for lib in `ldd &quot;$path&quot; | sed -n &#39;s,^[^/]*\(/[^ ]*\).*,\1,p&#39;`; do<br>
-           test -f &quot;$lib&quot; || 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 &quot;$lib&quot; | sed &#39;s,\(/[^/]*\)/.*\(/[^/]*\)$,\1\2,&#39;`<br>
-           test -f &quot;$baselib&quot; &amp;&amp; lib=$baselib<br>
-         add_file &quot;$lib&quot;<br>
-        done<br>
+      if ! file -L &quot;$path&quot; | grep &#39;static&#39; &gt; /dev/null 2&gt;&amp;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 =&gt;  (0xffffe000)<br>
+           #         libc.so.6 =&gt; /lib/tls/libc.so.6 (0xb7e81000)<br>
+           #         /lib/ld-linux.so.2 (0xb7fe8000)<br>
+           # covering both situations ( with =&gt; and without )<br>
+           for lib in `ldd &quot;$path&quot; | sed -n &#39;s,^[^/]*\(/[^ ]*\).*,\1,p&#39;`; do<br>
+             test -f &quot;$lib&quot; || 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 &quot;$lib&quot; | sed &#39;s,\(/[^/]*\)/.*\(/[^/]*\)$,\1\2,&#39;`<br>
+             test -f &quot;$baselib&quot; &amp;&amp; lib=$baselib<br>
+             add_file &quot;$lib&quot;<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 &quot;$path&quot;; then<br>
+        pushd $(dirname $path) &gt; /dev/null 2&gt;&amp;1<br>
+        dir_path=`pwd -P`<br>
+        path=$dir_path/$(basename $path)<br>
+        popd &gt; /dev/null 2&gt;&amp;1<br>
+    elif test -d &quot;$path&quot;; then<br>
+        pushd $path &gt; /dev/null 2&gt;&amp;1<br>
+        path=`pwd -P`<br>
+        popd &gt; /dev/null 2&gt;&amp;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=&quot;&quot;<br>
+<br>
+    file=$($compiler -print-prog-name=$file_name)<br>
+<br>
+    if test -z &quot;$file&quot; || test &quot;$file&quot; = &quot;$file_name&quot; || ! test -e &quot;$file&quot;; then<br>
+        file=`$compiler -print-file-name=$file_name`<br>
+    fi<br>
+<br>
+    if ! test -e &quot;$file&quot;; then<br>
+        return 1<br>
+    fi<br>
+<br>
+    if test -z &quot;$file_installdir&quot;; 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 &quot;$file_installdir&quot; != &quot;$abs_installdir&quot;; 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&#39;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&#39;t work well with<br>
+            # relative path as installdir.<br>
+<br>
+            compiler_basedir=$(abs_path ${compiler%/*/*})<br>
+            file_installdir=${abs_installdir/$compiler_basedir/&quot;/usr&quot;}<br>
+        fi<br>
+    fi<br>
+<br>
+    add_file &quot;$file&quot; &quot;$file_installdir/$file_name&quot;<br>
+<br>
+    return 0<br>
+}<br>
+<br>
 # backward compat<br>
 if test &quot;$1&quot; = &quot;--respect-path&quot;; then<br>
   shift<br>
@@ -67,62 +129,148 @@ if test &quot;$1&quot; = &quot;--silent&quot;; 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 &quot;$added_gcc&quot; || test -z &quot;$added_gxx&quot; ; then<br>
-       echo &quot;usage: $0 &lt;gcc_path&gt; &lt;g++_path&gt;&quot;<br>
-       exit 1<br>
+if test &quot;$1&quot; != &quot;--gcc&quot; -a &quot;$1&quot; != &quot;--clang&quot;; 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 &quot;$1&quot; = &quot;--gcc&quot;; 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 &quot;$1&quot; = &quot;--clang&quot;; 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 &quot;$added_gcc&quot; ; then<br>
-  echo &quot;&#39;$added_gcc&#39; is no executable.&quot;<br>
-  exit 1<br>
+if test -n &quot;$gcc&quot;; then<br>
+    if test -z &quot;$added_gcc&quot; || test -z &quot;$added_gxx&quot;; then<br>
+        usage<br>
+        exit 1<br>
+    fi<br>
+    if ! test -x &quot;$added_gcc&quot; ; then<br>
+        echo &quot;&#39;$added_gcc&#39; is no executable.&quot;<br>
+        exit 1<br>
+    fi<br>
+    if ! test -x &quot;$added_gxx&quot; ; then<br>
+        echo &quot;&#39;$added_gxx&#39; is no executable.&quot;<br>
+        exit 1<br>
+    fi<br>
+    if test -z &quot;$added_as&quot; ; then<br>
+      add_file /usr/bin/as /usr/bin/as<br>
+    else<br>
+      if ! test -x &quot;$added_as&quot; ; then<br>
+        echo &quot;&#39;$added_as&#39; is no executable.&quot;<br>
+        exit 1<br>
+      fi<br>
+      add_file $added_as  /usr/bin/as<br>
+    fi<br>
 fi<br>
<br>
-if ! test -x &quot;$added_gxx&quot; ; then<br>
-  echo &quot;&#39;$added_gcc&#39; is no executable.&quot;<br>
-  exit 1<br>
+if test -n &quot;$clang&quot;; then<br>
+    if ! test -x &quot;$added_clang&quot; ; then<br>
+        echo &quot;&#39;$added_clang&#39; is no executable.&quot;<br>
+        exit 1<br>
+    fi<br>
+    if ! test -x &quot;$added_compilerwrapper&quot; ; then<br>
+        echo &quot;&#39;$added_compilerwrapper&#39; is no executable.&quot;<br>
+        exit 1<br>
+    fi<br>
 fi<br>
<br>
+extrafiles=<br>
+while test &quot;x$1&quot; = &quot;x--addfile&quot;; do<br>
+    shift<br>
+    extrafiles=&quot;$extrafiles $1&quot;<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 &quot;$added_as&quot; ; then<br>
- add_file /usr/bin/as /usr/bin/as<br>
-else<br>
- if ! test -x &quot;$added_as&quot; ; then<br>
-  echo &quot;&#39;$added_as&#39; is no executable.&quot;<br>
-  exit 1<br>
- fi<br>
+if test -n &quot;$gcc&quot;; 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 &quot;$clang&quot;; 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 &quot;$gcc_as&quot; = &quot;as&quot;; then<br>
+      add_file /usr/bin/as<br>
+    else<br>
+      add_file &quot;$gcc_as&quot; /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 &quot;$specfile&quot; &amp;&amp; test -e &quot;$specfile&quot;; then<br>
-  add_file &quot;$specfile&quot;<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=&quot;${ltofile%lto1}liblto_plugin.so&quot;<br>
-if test -r &quot;$pluginfile&quot;<br>
-then<br>
-  add_file $pluginfile  ${pluginfile#*usr}<br>
-  add_file $pluginfile  /usr${pluginfile#*usr}<br>
+if test -n &quot;$clang&quot;; then<br>
+    add_file $added_clang /usr/bin/clang<br>
+    # HACK: Older icecream remotes have /usr/bin/{gcc|g++} hardcoded and wouldn&#39;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 &lt;prefix&gt; to /usr if needed<br>
+      destfile=$(echo $destfile | sed &quot;s#$clangprefix#/usr#&quot; )<br>
+      add_file &quot;$file&quot; &quot;$destfile&quot;<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 &amp;&amp; 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 &quot;$archive_name&quot;; 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 = &quot;This is a modified version of the icecc-create-env script in order to\<br>
-make it work with OE.&quot;<br>
-SECTION = &quot;base&quot;<br>
-# source file has just a &quot;GPL&quot; word, but upstream is GPLv2+.<br>
-# most probably just GPL would be a mistake<br>
-LICENSE = &quot;GPLv2+&quot;<br>
-LIC_FILES_CHKSUM = &quot;file://icecc-create-env;beginline=2;endline=5;md5=ae1df3d6a058bfda40b66094c5f6065f&quot;<br>
-<br>
-PR = &quot;r2&quot;<br>
-<br>
-DEPENDS = &quot;&quot;<br>
-INHIBIT_DEFAULT_DEPS = &quot;1&quot;<br>
-<br>
-FILESPATH = &quot;${FILE_DIRNAME}/${PN}/&quot;<br>
-<br>
-inherit native<br>
-<br>
-PATCHTOOL = &quot;patch&quot;<br>
-SRC_URI = &quot;file://icecc-create-env&quot;<br>
-<br>
-S = &quot;${WORKDIR}&quot;<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 = &quot;This is a modified version of the icecc-create-env script in order to\<br>
+make it work with OE.&quot;<br>
+SECTION = &quot;base&quot;<br>
+# source file has just a &quot;GPL&quot; word, but upstream is GPLv2+.<br>
+# most probably just GPL would be a mistake<br>
+LICENSE = &quot;GPLv2+&quot;<br>
+LIC_FILES_CHKSUM = &quot;file://icecc-create-env;beginline=2;endline=5;md5=ae1df3d6a058bfda40b66094c5f6065f&quot;<br>
+<br>
+PR = &quot;r0&quot;<br>
+<br>
+DEPENDS = &quot;&quot;<br>
+INHIBIT_DEFAULT_DEPS = &quot;1&quot;<br>
+<br>
+FILESPATH = &quot;${FILE_DIRNAME}/${PN}/&quot;<br>
+<br>
+inherit native<br>
+<br>
+PATCHTOOL = &quot;patch&quot;<br>
+SRC_URI = &quot;file://icecc-create-env&quot;<br>
+<br>
+S = &quot;${WORKDIR}&quot;<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>