<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>2074</bug_id>
          
          <creation_ts>2012-03-12 20:36:47 +0000</creation_ts>
          <short_desc>Unable to use compiler generated as one user with another user via the sstate-cache</short_desc>
          <delta_ts>2012-04-13 15:43:46 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Meta-yocto</product>
          <component>meta-yocto</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>(1.2) Patch out for review</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.2 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Hatle">mark.hatle</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>jessica.zhang</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>raj.khem</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>18970</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-03-12 20:36:47 +0000</bug_when>
    <thetext>I attempted to reproduce this failure with the current Poky master.  I did NOT receive a failure following the steps that lead to one in Edison.  However, I got a different failure.  I don&apos;t believe it&apos;s related, but will include it and the steps here just in case it is.

Build as user &quot;test1&quot;, in /home/test1/poky/build.  Run core-image-minimal... Store off the downloads and sstate-cache for use by another user -- remove the poky (and build) directories.

Log in as user &quot;test2&quot;.  Using PREMIRRORS and SSTATE_MIRROR setup the new build to the copied downloads and sstate-cache location.  Run a core-image-minimal build -- (it will succeed, unlike edison).

Then run a &quot;psplash&quot; build, it will fail with:


configure:3038: ccache i586-poky-linux-gcc -m32 -march=i586 --sysroot=/home/test2/poky/build/tmp/sysroots/qemux86 -c -O2 -pipe -g -feliminate-unused-debug-types conftest.c &gt;&amp;5

cc1: error: /home/test1/poky/build/tmp/sysroots/qemux86/home/test1/poky/build/tmp/sysroots/qemux86/usr/include: Permission denied
cc1: error: /home/test1/poky/build/tmp/sysroots/qemux86/usr/include: Permission denied

----

The compiler is still looking into the older location(s) for items tat should only be coming from the new user code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18972</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-03-12 20:38:18 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; I attempted to reproduce this failure with the current Poky master.  I did NOT
&gt; receive a failure following the steps that lead to one in Edison.  However, I
&gt; got a different failure.  I don&apos;t believe it&apos;s related, but will include it and
&gt; the steps here just in case it is.

Ignore the first paragraph, that was supposed to be part of a different bug report.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20027</commentid>
    <comment_count>2</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2012-04-06 22:49:52 +0000</bug_when>
    <thetext>I have tried to reproduce this using 2 users on the same machine with a sstate-cache and then using SSTATE_MIRROR, using own-mirrors and PREMIRROR setup.

I build core-image-minimal for qemuppc as first user, then built it again as
the second user, both of these completed correctly, not except the final image build duplicated, everything used sstate.

I then built psplash in the second user&apos;s build area and it built correctly.  

In a different set of build areas I attempted to do the same thing with a patch that Khem did to remove the local-prefix, these also build correctly with no failures.

I wanted to confirm if you are using any toolchain builds, I need to test that next.

I did see one build that had the linux-yocto kernel did a fetch instead of using sstate, still need to track down what happened there (see seperate thread)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20029</commentid>
    <comment_count>3</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-04-06 23:27:25 +0000</bug_when>
    <thetext>The failure is due to the toolchain still looking in the previous config/install location for files.

The error does not occur if the 2nd user has permissions to look at the target directory area.  If the files exist, they will be used -- if they don&apos;t exit the compiler will ignore that location.

The error only exists when the 2nd user does -not- have permissions to look into the user 1 directory structure.  (Thats the cause of the permission denied message, it&apos;s still looking in the old location and EPERM is a failure.. but it existing or not isn&apos;t.)

There was a related defect to this one that has the exact steps required to do the build and replicate the problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20031</commentid>
    <comment_count>4</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2012-04-07 21:32:11 +0000</bug_when>
    <thetext>I re-tried this with the removal of the build user1&apos;s tmp directory (sgw_ab/poky/build).  this is done as 2 different users.

My retry also succeeded both the core-image-minimal and the psplash build
I confirmed the compiler did not have permission to read the user1 sysroot
directory since it was removed, I also verified that the compiler was looking
for user1&apos;s sysroot via strings and strace.

I actually see it trying this pattern:

19909 stat(&quot;/srv/ssd/sgw_ab/sgw1_build/poky/build/tmp/sysroots/qemuppc/srv/ssd/sgw_ab/poky/build/tmp/sysroots/qemuppc/usr/include&quot;, 0x7fffe3113c60) = -1 ENOENT (No such file or directory)

It does ultimately find it correctly under sgw1_build/poky/build/tmp/sysroots/qemuppc/... here:

19909 stat(&quot;/srv/ssd/sgw_ab/sgw1_build/poky/build/tmp/sysroots/qemuppc/usr/include&quot;, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0


Hints on getting a good reproducer are always welcome!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20032</commentid>
    <comment_count>5</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2012-04-07 22:19:34 +0000</bug_when>
    <thetext>http://git.openembedded.org/openembedded-core-contrib/commit/?h=kraj/gcc-4.7&amp;id=2275888181dc1892cf130c0fcf67be182c19b2d5

should help

to reporoduce make usr1 dirs readable for usr1 only such that other can not even read it. the rebuild from sstate using usr2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20035</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-08 09:08:33 +0000</bug_when>
    <thetext>Note that I think this issue only occurs if the files exist but are unreadable. If they don&apos;t exist before, that hits different error code paths and has different behaviour.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20062</commentid>
    <comment_count>7</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-04-09 15:25:27 +0000</bug_when>
    <thetext>As Khem mentioned, you have to keep the old directory but make it unreadable to the second user.

-ENOENT goes through a different error path then the -ENOPERM.  The later causes the failure condition.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20063</commentid>
    <comment_count>8</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-04-09 15:27:32 +0000</bug_when>
    <thetext>Bug 2082 has the -exact- steps to reproduce this issue.  The (proposed) test case was shown to reproduce the problem on other peoples systems.

The local-prefix patch did -not- resolve the problem for me.

(I have not tested this within the last couple of weeks, so another patch may have resolved it.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20065</commentid>
    <comment_count>9</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2012-04-09 15:42:03 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; Bug 2082 has the -exact- steps to reproduce this issue.  The (proposed) test
&gt; case was shown to reproduce the problem on other peoples systems.
&gt; 
&gt; The local-prefix patch did -not- resolve the problem for me.
&gt; 

I presumed so since we also use --with-headers option. there could be other
static references that I have not run into yet. I am working on cleaning
this up but its turning out to be a big pile of changes. Even if it works
it will be too much of a change for 1.2

&gt; (I have not tested this within the last couple of weeks, so another patch may
&gt; have resolved it.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20066</commentid>
    <comment_count>10</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-04-09 16:01:13 +0000</bug_when>
    <thetext>Removing the with-local-prefix only appeared to stop the cross compiler from looking in:

&lt;path&gt;/sysroot/.../usr/local/include

I&apos;m not sure that removing that from the cross compiler is even a good idea.  Since some folks may want to populate the local/include  (even though we should never be at the system level)

The -EPERM was happening to me on the sysroot/.../usr/include and later on the sysroot/.../lib and usr/lib directories..  so every time it checked if a directory existed it failed..

In the case where something doesn&apos;t exist it falls back and appears to replace the first path of the path with the sysroot information that was passed in -- thus allowing the access of the directories.  It really looks to me like there is some kind of bug (feautre?) where it ignores the --sysroot parameter passed to glibc and tries to use the original locations first, then evaluates the sysroot..</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20154</commentid>
    <comment_count>11</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-04-10 22:25:57 +0000</bug_when>
    <thetext>I was unable to reproduce this on CentOS with a mips target, but was able to replicate this on an FC13 system w/ an x86_64 target.

See: http://gate.crashing.org/~fray/yocto/psplash-strace.log.bz2 (8 MB) log of information from the FC13 system.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20242</commentid>
    <comment_count>12</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2012-04-12 15:10:19 +0000</bug_when>
    <thetext>Centos Works for both users

http://gate.crashing.org/~fray/yocto/centos-out.bz2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20247</commentid>
    <comment_count>13</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-04-12 16:25:52 +0000</bug_when>
    <thetext>runs of just the configure step:


http://gate.crashing.org/~fray/yocto/fc13-configure-out.bz2
http://gate.crashing.org/~fray/yocto/centos-configure-out.bz2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20252</commentid>
    <comment_count>14</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2012-04-12 16:54:05 +0000</bug_when>
    <thetext>(In reply to comment #13)
&gt; runs of just the configure step:
&gt; 

Correction:

&gt; http://gate.crashing.org/~fray/yocto/fc13-configure-out.bz2
&gt; http://gate.crashing.org/~fray/yocto/centos62-configure-out.bz2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20258</commentid>
    <comment_count>15</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-12 18:47:19 +0000</bug_when>
    <thetext>From the logs, the 

execve(&quot;/home/usr2/oe-core/build-ia32-2/tmp-eglibc/sysroots/x86_64-linux/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/4.6.4/cc1&quot;, [&quot;/home/usr2/oe-core/build-ia32-2/tmp-eglibc/sysroots/x86_64-linux/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/4.6.4/cc1&quot;, &quot;-fpreprocessed&quot;, &quot;/home/usr2/oe-core/build-ia32-2/tmp-eglibc/ccache/x86_64-oe-linux/psplash/conftest.tmp.msp-mhatle-lx2.6733.i&quot;, &quot;-quiet&quot;, &quot;-dumpbase&quot;, &quot;conftest.tmp.msp-mhatle-lx2.6733.i&quot;, &quot;-m64&quot;, &quot;-mtune=generic&quot;, &quot;-march=x86-64&quot;, &quot;-auxbase-strip&quot;, &quot;/home/usr2/oe-core/build-ia32-2/tmp-eglibc/ccache/x86_64-oe-linux/psplash/tmp.hash.msp-mhatle-lx2.6733.o&quot;, &quot;-g&quot;, &quot;-O2&quot;, &quot;-feliminate-unused-debug-types&quot;, &quot;-o&quot;, &quot;-&quot;] 

made me suspicious contrasted to 

execve(&quot;/home/usr2/oe-core/build-ia32-2/tmp-eglibc/sysroots/x86_64-linux/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/4.6.4/cc1&quot;, [&quot;/home/usr2/oe-core/build-ia32-2/tmp-eglibc/sysroots/x86_64-linux/usr/bin/x86_64-oe-linux/../../libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/4.6.4/cc1&quot;, &quot;-quiet&quot;, &quot;-iprefix&quot;, &quot;/home/usr2/oe-core/build-ia32-2/tmp-eglibc/sysroots/x86_64-linux/usr/bin/x86_64-oe-linux/../../lib/x86_64-oe-linux/gcc/x86_64-oe-linux/4.6.4/&quot;, &quot;-isysroot&quot;, &quot;/home/usr2/oe-core/build-ia32-2/tmp-eglibc/sysroots/qemux86-64&quot;, &quot;conftest.c&quot;, &quot;-quiet&quot;, &quot;-dumpbase&quot;, &quot;conftest.c&quot;, &quot;-m64&quot;, &quot;-mtune=generic&quot;, &quot;-march=x86-64&quot;, &quot;-auxbase&quot;, &quot;conftest&quot;, &quot;-g&quot;, &quot;-O2&quot;, &quot;-feliminate-unused-debug-types&quot;, &quot;-o&quot;, &quot;-&quot;]

Mark confirmed that removing ccache causes the configure to complete successfully. Its a start to know where to look at least and starts to explain the behavior difference.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20259</commentid>
    <comment_count>16</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-12 18:54:34 +0000</bug_when>
    <thetext>I have a new way to reproduce what I think is the same issue on Ubuntu 11.10 64 bit. I ran a build in directory A, machine qemux86 with a sstate cache generated.

I then did &quot;sudo apt-get install ccache&quot;, chmod a-r and chown root.root on the tmp/sysroots/qemux86 directory for build A. 

I then setup a new build directory, B for machine qemux86, pointing at build A&apos;s sstate cache.

bitbake psplash -c cleansstate; bitbake psplash leads to a failure in eglibc-initial, &quot;cc1: error: /media/build1/poky/build/tmp/sysroots/qemux86/usr/include: Permission denied&quot; which is a reference to build A.

(eglibc-initial is rebuilding since it noticed the addition of ccache)

This should at least make the issue more debuggable for people without FC13.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20260</commentid>
    <comment_count>17</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-12 19:29:48 +0000</bug_when>
    <thetext>Further distilled down to their being some problem with our toolchain when provided with precompiled source:

richard@dax:/media/build1/poky/build3/tmp/work/i586-poky-linux/eglibc-initial-2.13-r23+svnr15508/build-i586-poky-linux$ /media/build1/poky/build3/tmp/sysroots/x86_64-linux/usr/bin/i586-poky-linux.gcc-cross-initial/i586-poky-linux-gcc -m32 -march=i586 --sysroot=/media/build1/poky/build3/tmp/sysroots/qemux86-tcbootstrap -c -I/media/build1/poky/build3/tmp/sysroots/qemux86 -o /home/richard/.ccache/b/7/bbc769bc628827f1d23de1a53d35d3-348.o.tmp.dax.11809 test.c

works

richard@dax:/media/build1/poky/build3/tmp/work/i586-poky-linux/eglibc-initial-2.13-r23+svnr15508/build-i586-poky-linux$ /media/build1/poky/build3/tmp/sysroots/x86_64-linux/usr/bin/i586-poky-linux.gcc-cross-initial/i586-poky-linux-gcc -m32 -march=i586 --sysroot=/media/build1/poky/build3/tmp/sysroots/qemux86-tcbootstrap -c -I/media/build1/poky/build3/tmp/sysroots/qemux86 -o /home/richard/.ccache/b/7/bbc769bc628827f1d23de1a53d35d3-348.o.tmp.dax.11809 test.i
cc1: error: /media/build1/poky/build/tmp/sysroots/qemux86/media/build1/poky/build/tmp/sysroots/qemux86/usr/include: Permission denied
cc1: error: /media/build1/poky/build/tmp/sysroots/qemux86/usr/include: Permission denied

does not

So its not ccache at fault, it just changes the workflow splitting the precompiled source out and this breaks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20261</commentid>
    <comment_count>18</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-12 19:33:12 +0000</bug_when>
    <thetext>(In reply to comment #17)
&gt; Further distilled down to their being some problem with our toolchain when
&gt; provided with precompiled source:

*preprocessed* source</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20265</commentid>
    <comment_count>19</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2012-04-12 21:04:43 +0000</bug_when>
    <thetext>(In reply to comment #18)
&gt; (In reply to comment #17)
&gt; &gt; Further distilled down to their being some problem with our toolchain when
&gt; &gt; provided with precompiled source:
&gt; 
&gt; *preprocessed* source

hmmm interesting. Can you find out the cmdline how ccache is invoking the compiler in turn ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20266</commentid>
    <comment_count>20</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2012-04-12 21:09:43 +0000</bug_when>
    <thetext>(In reply to comment #17)
&gt; Further distilled down to their being some problem with our toolchain when
&gt; provided with precompiled source:
&gt; 
&gt; richard@dax:/media/build1/poky/build3/tmp/work/i586-poky-linux/eglibc-initial-2.13-r23+svnr15508/build-i586-poky-linux$
&gt; /media/build1/poky/build3/tmp/sysroots/x86_64-linux/usr/bin/i586-poky-linux.gcc-cross-initial/i586-poky-linux-gcc
&gt; -m32 -march=i586
&gt; --sysroot=/media/build1/poky/build3/tmp/sysroots/qemux86-tcbootstrap -c
&gt; -I/media/build1/poky/build3/tmp/sysroots/qemux86 -o
&gt; /home/richard/.ccache/b/7/bbc769bc628827f1d23de1a53d35d3-348.o.tmp.dax.11809
&gt; test.c
&gt; 
&gt; works
&gt; 
&gt; richard@dax:/media/build1/poky/build3/tmp/work/i586-poky-linux/eglibc-initial-2.13-r23+svnr15508/build-i586-poky-linux$
&gt; /media/build1/poky/build3/tmp/sysroots/x86_64-linux/usr/bin/i586-poky-linux.gcc-cross-initial/i586-poky-linux-gcc
&gt; -m32 -march=i586
&gt; --sysroot=/media/build1/poky/build3/tmp/sysroots/qemux86-tcbootstrap -c
&gt; -I/media/build1/poky/build3/tmp/sysroots/qemux86 -o
&gt; /home/richard/.ccache/b/7/bbc769bc628827f1d23de1a53d35d3-348.o.tmp.dax.11809
&gt; test.i
&gt; cc1: error:
&gt; /media/build1/poky/build/tmp/sysroots/qemux86/media/build1/poky/build/tmp/sysroots/qemux86/usr/include:
&gt; Permission denied
&gt; cc1: error: /media/build1/poky/build/tmp/sysroots/qemux86/usr/include:
&gt; Permission denied
&gt; 
&gt; does not
&gt; 
&gt; So its not ccache at fault, it just changes the workflow splitting the
&gt; precompiled source out and this breaks.


Ah Interesting. I think the difference is .i and .c extention.
gcc driver when invoked with .i extention automatically passed -fpreprocessed</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20267</commentid>
    <comment_count>21</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2012-04-12 21:27:41 +0000</bug_when>
    <thetext>I bet the problem is due to line control direcitves which look like 

# 126 &quot;/usr/include/strings.h&quot; 2 3 4

and preprocessor has to read them and pass them on to compiler so compiler can
do better job at diagnostics and I think the paths has already been resolved
to point to previous sysroot.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20269</commentid>
    <comment_count>22</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2012-04-12 22:08:22 +0000</bug_when>
    <thetext>RP

Can you paste the .i file somewhere for me to look at ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20270</commentid>
    <comment_count>23</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2012-04-12 23:35:31 +0000</bug_when>
    <thetext>actually I see three paths which are hardcoded to paths where compiler was configured ( i.e. first sysroot)

usr/local/include
usr/include
x86_64-linux/usr/lib/armv5te-angstrom-linux-gnueabi/gcc/arm-angstrom-linux-gnueabi/specs

The first one is because of local-prefix being not sysroot relative
so one solution we have is either we nullify it by using a /tmp/ or /var 
for it during configure or we fix gcc to make it relative to sysroot but
thats a big change in behavior

The second one could be because of includedir or with-headers option that
we use during configure I have not verified yet

Third one I have no idea yet how that could be fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20272</commentid>
    <comment_count>24</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-12 23:49:51 +0000</bug_when>
    <thetext>I&apos;ve been poking around gcc but its not my area of expertise. I think the problem might &quot;disappear&quot; if we add %I to the cpp-output spec macro so it reads:

  {&quot;@cpp-output&quot;,
   &quot;%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}&quot;, 0, 0, 0},

(in gcc.c) since this means the -isysroot option gets preserved.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20273</commentid>
    <comment_count>25</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-12 23:50:41 +0000</bug_when>
    <thetext>test.i contents:
# 1 &quot;test.c&quot;
# 1 &quot;&lt;built-in&gt;&quot;
# 1 &quot;&lt;command-line&gt;&quot;
# 1 &quot;test.c&quot;
# 10 &quot;test.c&quot;
int
main ()
{

  ;
  return 0;
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20274</commentid>
    <comment_count>26</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-12 23:53:38 +0000</bug_when>
    <thetext>Simplest test case I have at the moment is to add a line like:

fprintf(stderr, &quot;Here 2 %s %d %s\n&quot;, sysroot, stdinc, iprefix);

to incpath.c register_include_chains()

and then &quot;gcc -m32 -march=i586 --sysroot=/media/build1/poky/build3/tmp/sysroots/qemux86-tcbootstrap -c -I/media/build1/poky/build3/tmp/sysroots/qemux86 -o test.o test.i&quot;. With .i files, sysroot is set to the gcc internal default, in the .c case it sets set to the commandline --sysroot option.

Somehow the --sysroot option isn&apos;t preserved for .i files.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20279</commentid>
    <comment_count>27</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2012-04-13 04:40:18 +0000</bug_when>
    <thetext>(In reply to comment #24)
&gt; I&apos;ve been poking around gcc but its not my area of expertise. I think the
&gt; problem might &quot;disappear&quot; if we add %I to the cpp-output spec macro so it
&gt; reads:
&gt; 
&gt;   {&quot;@cpp-output&quot;,
&gt;    &quot;%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options)
&gt; %{!fsyntax-only:%(invoke_as)}}}}&quot;, 0, 0, 0},
&gt; 
&gt; (in gcc.c) since this means the -isysroot option gets preserved.

yes this will work. I committed it for gcc-4.7 here
http://git.openembedded.org/openembedded-core-contrib/commit/?h=kraj/gcc-4.7&amp;id=a197cf9e3ac732d545ec2a36c9a50ed4dd5ac01f

the problem with specs file still remain though. It still accesses it
now I dont know if it solves the issue at hand or we are going to fail on
accessing specs file now that includes are straightened out.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20304</commentid>
    <comment_count>28</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-13 11:57:03 +0000</bug_when>
    <thetext>I&apos;ve confirmed this fixes the test case I was able to reproduce on Ubuntu 11.10 and have posted a patch for review</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20308</commentid>
    <comment_count>29</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-13 13:19:30 +0000</bug_when>
    <thetext>Further testing revealed the same problem for .ii files and c++. I&apos;ve updated the patch on the mailing list and this resolved the issue I saw in testing for that case too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20312</commentid>
    <comment_count>30</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-13 13:27:25 +0000</bug_when>
    <thetext>Fixed in master: http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=22aac28f28fe1e703fb66e304a41a31f7b600e8d</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20321</commentid>
    <comment_count>31</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2012-04-13 15:24:43 +0000</bug_when>
    <thetext>(In reply to comment #30)
&gt; Fixed in master:
&gt; http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=22aac28f28fe1e703fb66e304a41a31f7b600e8d

cool. There is still reference to specs file left into build time install path
hopefully we are not hitting it</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20322</commentid>
    <comment_count>32</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-04-13 15:43:46 +0000</bug_when>
    <thetext>The original issue described in this bug is resolved. Yes, the toolchain does try and open a specs file at the original location however we don&apos;t generate or use a specs file and this failed file open does not in any way adversely affect the build.

I&apos;d open a separate bug for the spec file issue as it has very different severity and priority characteristics.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>