Bug 8144 - native strip issue on arm when running BuildImages
Summary: native strip issue on arm when running BuildImages
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 1.9
Hardware: Other arm
: Medium+ normal
Target Milestone: 2.0
Assignee: Ross Burton
QA Contact: Yi Zhao
URL:
Whiteboard:
Depends on:
Blocks: 7983
  Show dependency tree
 
Reported: 2015-08-10 23:08 UTC by Alex Franco
Modified: 2015-11-09 06:31 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments
results of nightly-arm build 428 (10.30 KB, text/plain)
2015-08-10 23:08 UTC, Alex Franco
no flags Details
contents of the offending pcre-config (165 bytes, text/plain)
2015-08-13 15:21 UTC, Alex Franco
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Franco 2015-08-10 23:08:11 UTC
Created attachment 2657 [details]
results of nightly-arm build 428

Builder: nightly-arm
Build: 428
Buildslave: fedora22.osl.yoctoproject.org
Failed task: build images fails due to a strip error
Branch: master-next
Commit: 005a5b60f00a...

URL: https://autobuilder.yoctoproject.org/main/builders/nightly-arm/builds/428/steps/BuildImages/logs/stdio/text
See atttachment [1]

Relevant log:

ERROR: split_and_strip_files: 'file /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-arm/build/build/tmp/work/x86_64-linux/libpcre-native/8.37-r0/sysroot-destdir/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-arm/build/build/tmp/sysroots/x86_64-linux/usr/bin/pcre-config' failed
Comment 1 Alex Franco 2015-08-13 15:21:19 UTC
Created attachment 2665 [details]
contents of the offending pcre-config
Comment 2 Richard Purdie 2015-09-26 07:13:59 UTC
Unfortunately I don't believe the right log was attached here. What I'd like to understand was whether file-native was being installed at the time this failed. Unfortunately the autobuilder has recycled the logs :(. Does anyone have the right ones?
Comment 3 Richard Purdie 2015-09-26 09:37:54 UTC
I found someone else seeing this issue and to quote their logs:

NOTE: recipe file-native-5.24-r0: task do_install: Succeeded
NOTE: Running task 925 of 3566 (ID: 181, virtual:native:/var/lib/jenkins/build/meta/recipes-devtools/file/file_5.24.bb, do_populate_sysroot)
NOTE: recipe elfutils-native-0.163-r0: task do_install: Succeeded
NOTE: Running task 926 of 3566 (ID: 1358, virtual:native:/var/lib/jenkins/build/meta/recipes-devtools/elfutils/elfutils_0.163.bb, do_populate_sysroot)
NOTE: recipe sqlite3-native-3_3.8.10.2-r0: task do_configure: Succeeded
NOTE: Running task 927 of 3566 (ID: 1121, virtual:native:/var/lib/jenkins/build/meta/recipes-support/sqlite/sqlite3_3.8.10.2.bb, do_compile)
NOTE: recipe file-native-5.24-r0: task do_populate_sysroot: Started
NOTE: recipe elfutils-native-0.163-r0: task do_populate_sysroot: Started
NOTE: recipe sqlite3-native-3_3.8.10.2-r0: task do_compile: Started
ERROR: split_and_strip_files: 'file /var/lib/jenkins/build/build/tmp-glibc/work/x86_64-linux/elfutils-native/0.163-r0/sysroot-destdir/var/lib/jenkins/build/build/tmp-glibc/sysroots/x86_64-linux/usr/lib/elfutils/libebl_sh-0.163.so' failed
NOTE: recipe file-native-5.24-r0: task do_populate_sysroot: Succeeded
NOTE: Running task 928 of 3566 (ID: 166, virtual:native:/var/lib/jenkins/build/meta/recipes-devtools/rpm/rpm_5.4.14.bb, do_unpack)
NOTE: recipe rpm-native-5.4.14-r0: task do_unpack: Started
NOTE: recipe elfutils-native-0.163-r0: task do_populate_sysroot: Succeeded
NOTE: Running task 929 of 3566 (ID: 3362, virtual:native:/var/lib/j

Note how file-native do_populate_sysroot is running when this error occurs. The issue is that file is being installed into the sysroot at the same time something is trying to run it. Its likely the binary gets installed, the file itself doesn't and then execution fails due to the missing lib.
Comment 4 Richard Purdie 2015-09-28 16:34:06 UTC
After a bit of thought and discussion, I believe we should:
a) add file-native to ASSUME_PROVIDED
b) extend the sanity tests in sanity.bbclass to check for the file command
c) change the file recipe to install file-native into a subdir (See NATIVE_PACKAGE_PATH_SUFFIX in tar recipe for example)
d) make file look for file-native in the subdirectory
e) may need to tweak file PROVIDES as the tar recipe does to add a file-replacement-native rather than DEPENDS on file-native which will no longer work)
Comment 5 Ross Burton 2015-09-28 19:54:45 UTC
Given (a) why do we need to do (d)?
Comment 6 Ross Burton 2015-09-28 19:55:43 UTC
And to answer my own question, because file needs an identical version of itself to build:

            v=$$(file --version | sed -e s/file-// -e q); \
            if [ "$$v" != "${PACKAGE_VERSION}" ]; then \
                echo "Cannot use the installed version of file ($$v) to"; \
                echo "cross-compile file ${PACKAGE_VERSION}"; \
                echo "Please install file ${PACKAGE_VERSION} locally first"; \
                exit 1; \
            fi; \

Ignore me.
Comment 7 Ross Burton 2015-09-28 19:56:45 UTC
That said, (c) through to (e) is probably more effort than changing the file build so it can build a host file if cross-compiling and not need the build-twice dance.
Comment 8 Ross Burton 2015-10-19 10:01:24 UTC
f) Don't install libmagic in file-replacement-native as it introduces build races with the host libmagic (by making libmagic noinst for the native build, so it just installs the binary and data).

Patch set incoming.
Comment 9 Ross Burton 2015-10-19 13:17:07 UTC
Patches sent.
Comment 10 Alex Franco 2015-10-19 16:03:25 UTC
The only case perhaps not covered by the patches is when not cross-compiling, and using the host's "file" (along with the host's libmagic although this shouldn't be relevant in this case) on hosts that aren't fully POSIX compliant.

I ran some tests and I came up with these results:

POSIX OK (file does not error out entirely when it fails to stat a file):
 fedora21
 debian8
 centos7
 centos6
 archlinux

NON POSIX:
 ubuntu1204
 opensuse131
 debian7

Granted, this shouldn't be an issue when file itself is causing a race condition, but it would be an issue when the file that is being checked with file is.
Comment 11 Ross Burton 2015-10-27 14:00:38 UTC
Fixed in oe-core 656f09accfd7651f179e02c12f40f4d3bec0be0c.
Comment 12 Yi Zhao 2015-11-09 06:31:39 UTC
Verified with 2.0 rc3 (jethro/fc45deac89ef63ca1c44e763c38ced7dfd72cbe1)