<?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>13375</bug_id>
          
          <creation_ts>2019-06-03 23:55:35 +0000</creation_ts>
          <short_desc>CONFIG_SITE is not consistent across do_configure / do_compile / do_install</short_desc>
          <delta_ts>2019-09-12 14:59:27 +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>OE-Core</product>
          <component>core</component>
          <version>2.6.3</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.8 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dan Callaghan">dan.callaghan</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84051</commentid>
    <comment_count>0</comment_count>
    <who name="Dan Callaghan">dan.callaghan</who>
    <bug_when>2019-06-03 23:55:35 +0000</bug_when>
    <thetext>We noticed a strange problem when building one of our custom recipes. The autotools.bbclass does not fill in CONFIG_SITE consistently across different tasks.

We have a custom lua recipe which uses a SYSROOT_PREPROCESS_FUNCS function to drop a config_site file into ${TARGET_SYS}_config_site.d with some autoconf cache variables prepopulated, to help the AX_PROG_LUA macro find lua interpreter paths without executing the target interpreter:

SYSROOT_PREPROCESS_FUNCS += &quot;do_siteconfig&quot;
do_siteconfig() {
    mkdir -p ${SYSROOT_DESTDIR}${datadir}/${TARGET_SYS}_config_site.d
    cat &gt;${SYSROOT_DESTDIR}${datadir}/${TARGET_SYS}_config_site.d/lua_config &lt;&lt;EOF
ax_cv_pathless_LUA=lua
ax_cv_lua_version=5.1
ax_cv_lua_platform=unknown
ax_cv_lua_luadir=${datadir}/lua/5.1
ax_cv_lua_luaexecdir=${libdir}/lua/5.1
EOF
}

Then we have a recipe for a proprietary package which depends on lua and uses AX_PROG_LUA in its configure.ac. The autotools.bbclass populates CONFIG_SITE based on what it finds in the sysroot, and it correctly sees the lua_config file in addition to all the others, when do_configure runs the ./configure script.

  configure: loading site script .../poky/meta/site/endian-little
  configure: loading site script .../poky/meta/site/common-linux
  configure: loading site script .../poky/meta/site/common-glibc
  configure: loading site script .../poky/meta/site/x86_64-linux
  configure: loading site script .../poky/meta/site/common
  configure: loading site script .../poky/../meta-openembedded/meta-networking/site/endian-little
  configure: loading site script build/tmp-glibc/work/puma-64-og-linux/ogconfig/1.0+git999-r0/recipe-sysroot/usr/share/x86_64-og-linux_config_site.d/glibc_config
  configure: loading site script build/tmp-glibc/work/puma-64-og-linux/ogconfig/1.0+git999-r0/recipe-sysroot/usr/share/x86_64-og-linux_config_site.d/lua_config
  configure: loading site script build/tmp-glibc/work/puma-64-og-linux/ogconfig/1.0+git999-r0/recipe-sysroot/usr/share/x86_64-og-linux_config_site.d/ncurses_config
  [...]

So far so good.

However, for local development of the proprietary package, we use externalsrc.bbclass and set EXTERNALSRC to point at a git checkout. The recipe has a native variant, so bitbake will build both $OURPACKAGE and $OURPACKAGE-native -- often concurrently.

As a consequence, it can happen that bitbake will do autoreconf for one variant of the recipe while the other variant has already completed do_configure and has moved onto do_compile or do_install. The autoreconf happens in the same source tree, even though the build directories are separate. That means the configure script in the source tree will be touched by both recipes variants, possibly while each is building.

automake has a rule to invoke ./config.status --recheck if the configure script changed since it was run. And so that rule can be triggered in do_compile or do_install for the concurrently running recipes.

Normally ./config.status --recheck just does a quick run through the cache variables to ensure nothing has changed and then the build continues. And nothing should have changed because bitbake gives us a consistent build environment. But something *does* change: the CONFIG_SITE environment variable is different in do_compile and do_install. It doesn&apos;t include any files from ${TARGET_SYS}_config_site.d, and so ./config.status --recheck fails.

The reason seems to be because CONFIG_SITE is populated in two different ways in autotools.bbclass. Globally there is:

  # Space separated list of shell scripts with variables defined to supply test
  # results for autoconf tests we cannot run at build time.
  export CONFIG_SITE = &quot;${@siteinfo_get_files(d)}&quot;

This is calling siteinfo_get_files with sysrootcache=False which intentionally omits everything from ${TARGET_SYS}_config_site.d in the sysroot. The variable is populated differently for do_configure:

  do_configure[prefuncs] += &quot;autotools_preconfigure autotools_aclocals ${EXTRACONFFUNCS}&quot;

  [...]

  python autotools_aclocals () {
      # Refresh variable with cache files
      d.setVar(&quot;CONFIG_SITE&quot;, siteinfo_get_files(d, sysrootcache=True))
  }

Here it passes sysrootcache=True and so it correctly picks up files from ${TARGET_SYS}_config_site.d in the sysroot.

The end result is that CONFIG_SITE is correct for do_configure but not for do_compile and do_install.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84052</commentid>
    <comment_count>1</comment_count>
      <attachid>4520</attachid>
    <who name="Dan Callaghan">dan.callaghan</who>
    <bug_when>2019-06-03 23:59:16 +0000</bug_when>
    <thetext>Created attachment 4520
proposed patch

I think this patch should fix the issue. It populates CONFIG_SITE the same for do_configure, do_compile, and do_install. But I&apos;m not sure if it&apos;s the best solution. Are there any other tasks which might need CONFIG_SITE to be set?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84567</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-08-01 15:18:28 +0000</bug_when>
    <thetext>Patch looks reasonable.  Can you post it to the mailing list at openembedded-core@lists.openembedded.org?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84582</commentid>
    <comment_count>3</comment_count>
    <who name="Dan Callaghan">dan.callaghan</who>
    <bug_when>2019-08-05 01:16:14 +0000</bug_when>
    <thetext>Sure, posted:
https://patchwork.openembedded.org/patch/163660/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84940</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-09-12 14:59:27 +0000</bug_when>
    <thetext>Merged in oe-core e60c170b451a4aa561d08bfce97dca05508c2106</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4520</attachid>
            <date>2019-06-03 23:59:16 +0000</date>
            <delta_ts>2019-06-03 23:59:16 +0000</delta_ts>
            <desc>proposed patch</desc>
            <filename>0001-autotools-always-include-config_site.d-files-in-CONF.patch</filename>
            <type>text/plain</type>
            <size>1773</size>
            <attacher name="Dan Callaghan">dan.callaghan</attacher>
            
              <data encoding="base64">RnJvbSAyN2Q0MzE3ZWVkMWQxY2FhOTFmNmRiM2ViYzg3OTAxMWU0NzdjNDIzIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBEYW4gQ2FsbGFnaGFuIDxkYW4uY2FsbGFnaGFuQG9wZW5nZWFy
LmNvbT4KRGF0ZTogVHVlLCA0IEp1biAyMDE5IDA5OjU3OjA1ICsxMDAwClN1YmplY3Q6IFtQQVRD
SF0gYXV0b3Rvb2xzOiBhbHdheXMgaW5jbHVkZSBjb25maWdfc2l0ZS5kIGZpbGVzIGluIENPTkZJ
R19TSVRFCgpGaXhlczogaHR0cHM6Ly9idWd6aWxsYS55b2N0b3Byb2plY3Qub3JnL3Nob3dfYnVn
LmNnaT9pZD0xMzM3NQoKU2lnbmVkLW9mZi1ieTogRGFuIENhbGxhZ2hhbiA8ZGFuLmNhbGxhZ2hh
bkBvcGVuZ2Vhci5jb20+Ci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