Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] ccache problem when compiling with different toolchains in different projects
@ 2013-04-19  1:50 Danomi Manchego
  2013-04-19 11:41 ` Mathias De Maré
  0 siblings, 1 reply; 13+ messages in thread
From: Danomi Manchego @ 2013-04-19  1:50 UTC (permalink / raw)
  To: buildroot

All,

Let me preface this by saying that I know that we are supposed to manually
flush the ccache when changing toolchain configuration.  This post is not
about that (I think) - it's about building different configurations, in
different locations, on the same machine.  (Emphasis on "in different
locations".)

Recently, I found a case where ccache was being fooled during the building
of kmod (a dependency of udev), in the following circumstance:

1. I compiled buildroot with O=cs2012, with a downloaded codesourcery
2012.03 toolchain.

   Defconfig:
      BR2_arm=y
      BR2_CCACHE=y
      BR2_TOOLCHAIN_EXTERNAL=y
      BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
      BR2_PACKAGE_KMOD=y

2. I attempted to compile buildroot with O=cs2009, with a pre-installed
codesourcery 2009q1 toolchain

   Defconfig:
      BR2_arm=y
      BR2_CCACHE=y
      BR2_TOOLCHAIN_EXTERNAL=y
      BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y

BR2_TOOLCHAIN_EXTERNAL_PATH="/opt/codesourcery/arm-2009q1-203-arm-none-linux-gnueabi"
      BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-none-linux-gnueabi"
      BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
      BR2_TOOLCHAIN_EXTERNAL_CXX=y
      BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
      BR2_PACKAGE_KMOD=y

3. Then kmod build failed, due to "Unknown mandatory EABI object attribute
44".

After examining ccache stats at each stage, I think what is happening is
that when the compile line has only relative paths, and hashing on the
compiler itself is disabled (as it is in buildroot's build of ccache), then
the compile under the cs2009 directory cannot be distinguished from the
compile in the cs2012 directory (i.e., the computed hash values are
identical), so the cs2012 objects are used, leading to disaster.

Another variation occurred when I compiled first using a 2010q1 cs
toolchain (O=cs2010), which supports -Wno-unsused-result, followed by
2009q1, which does not.  When configure compiled its little programs to
test the c-flags in cs2009, it pulled cs2010's object, and erroneously
concluded that -Wno-unsused-result was supported.  The compile of the
actual kmod source with -Wno-unsused-result then failed.

As it turns out, ccache will include the current directory in the hash when
the environment variable CCACHE_HASHDIR is defined.  I have confirmed that
defining CCACHE_HASHDIR makes the above scenario compile correctly -
different files get cached for the cs2012 and cs2009 builds, since the
source files live in different locations.  So I think that I will probably
force the behavior activated by CCACHE_HASHDIR for our project - similar to
how the CCACHE_COMPILERCHECK selection is forced to "none".

If others think that this is a good idea, then I would be happy to submit a
patch to this effect.

Danomi -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130418/1052814f/attachment.html>

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-10-24 14:55 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-19  1:50 [Buildroot] ccache problem when compiling with different toolchains in different projects Danomi Manchego
2013-04-19 11:41 ` Mathias De Maré
2013-04-19 20:54   ` Arnout Vandecappelle
2013-04-19 23:00     ` Danomi Manchego
2013-04-19 23:05       ` Danomi Manchego
2013-04-19 23:41       ` Arnout Vandecappelle
2013-04-20 16:08         ` Danomi Manchego
2013-04-21 21:05           ` Mathias De Maré
2013-04-22  5:59           ` Arnout Vandecappelle
2013-04-22 12:32             ` Danomi Manchego
2013-04-22 21:26               ` Arnout Vandecappelle
2013-10-24 10:31                 ` Thomas De Schampheleire
2013-10-24 14:55                   ` Danomi Manchego

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox