Bug 15227

Summary: bin_package.bbclass can not find objcopy or strip
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Thomas Roos <thomas>
Component: coreAssignee: Ross Burton <ross.burton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher, randy.macleod, ross.burton
Version: unspecified   
Target Milestone: 5.1 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Thomas Roos 2023-10-09 09:31:16 UTC
Only on master, since a few weeks!
We see those errors: 
ERROR: firecracker-bin-1.3.3-r0 do_package: Fatal errors occurred in subprocesses:
[Errno 2] No such file or directory: 'x86_64-poky-linux-objcopy': Traceback (most recent call last):
  File "/data/buildbot/worker/meta_aws_release_builder_master_qemux86_64/build/meta-aws-ci/meta-aws-tests/yocto_master/poky/meta/lib/oe/utils.py", line 288, in run
    ret = self._target(*self._args, **self._kwargs)
  File "/data/buildbot/worker/meta_aws_release_builder_master_qemux86_64/build/meta-aws-ci/meta-aws-tests/yocto_master/poky/meta/lib/oe/package.py", line 805, in splitdebuginfo
    subprocess.check_output([objcopy, '--only-keep-debug', file, debugfile], stderr=subprocess.STDOUT)
  File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'x86_64-poky-linux-objcopy'

and then when setting INHIBIT_PACKAGE_DEBUG_SPLIT = "1"

  File "/data/buildbot/worker/meta_aws_release_builder_master_qemuarm64/build/meta-aws-ci/meta-aws-tests/yocto_master/poky/meta/lib/oe/utils.py", line 288, in run
    ret = self._target(*self._args, **self._kwargs)
  File "/data/buildbot/worker/meta_aws_release_builder_master_qemuarm64/build/meta-aws-ci/meta-aws-tests/yocto_master/poky/meta/lib/oe/package.py", line 66, in runstrip
    output = subprocess.check_output(stripcmd, stderr=subprocess.STDOUT)
  File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 493, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'aarch64-poky-linux-strip'

so next try for a workaround
will be: INHIBIT_PACKAGE_STRIP

But might those options should be default in that class?
Comment 1 Ross Burton 2023-10-12 14:35:47 UTC
Do you set INHIBIT_DEFAULT_DEPS?
Comment 2 Ross Burton 2023-10-12 14:40:47 UTC
My mistake, bin_package sets it.

This means it can't find strip because it doesn't have the dependency on binutils...

I have a patch somewhere.
Comment 3 Ross Burton 2023-10-12 14:45:04 UTC
If you can replicate this on demand, try adding this to your recipe:

PACKAGE_DEPENDS:append:class-target = " virtual/${TARGET_PREFIX}binutils"
Comment 4 Ross Burton 2024-04-11 14:52:24 UTC
Bumping, but Thomas: please reply to the questions above.
Comment 5 Thomas Roos 2024-04-15 15:35:30 UTC
can not replicate on demand, but changed solution to suggested:
 PACKAGE_DEPENDS:append:class-target = " virtual/${TARGET_PREFIX}binutils"
will give feedback if it failed or does not fail anymore.
Comment 6 Ross Burton 2024-10-10 12:06:56 UTC
This can't be a problem in master (or the last few releases) because of these two commits.

First, the default deps were inhibited. This is what causes objdump to not be available:

commit b7b382101b401deda2df5e7f71e581d8ced51f5f
Author: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Date:   Fri Aug 18 18:09:19 2023 +0200

    bin_package.bbclass: Inhibit the default dependencies

    Nothing is being built so there is no need for the cross-compiler.

    (From OE-Core rev: d1d09bd4d7be88f0e341d5fccbfbefeb98d4b727)


But this was reverted because it also meant that file depends also failed:

commit 50c57ee367dcb32d664e315d8e812de57cd24060
Author: Max Krummenacher <max.krummenacher@toradex.com>
Date:   Sun Aug 27 10:09:53 2023 +0200

    Revert "bin_package.bbclass: Inhibit the default dependencies"

    This reverts commit d1d09bd4d7be88f0e341d5fccbfbefeb98d4b727.

    The commit not only removes the dependencies on the cross compiler
    but also does not depend on e.g. virtual/${TARGET_PREFIX}compilerlibs
    and virtual/libc which in turn makes the file-rdeps qa check fail
    if installing binaries linked against e.g. libc or libstdc++.

    (From OE-Core rev: ababf6ceebe360c5f59a57428566c27b7a97a9e6)

Closing as if this is broken in a stable branch then backport the revert.