Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 947826 - sys-boot/gnu-efi: fails to build with OBJCOPY="/usr/lib/llvm/19/bin/llvm-objcopy"
Summary: sys-boot/gnu-efi: fails to build with OBJCOPY="/usr/lib/llvm/19/bin/llvm-objc...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Viorel Munteanu
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-10 19:07 UTC by Sv. Lockal
Modified: 2025-03-22 14:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Build log (build.log,1.51 KB, text/plain)
2025-01-10 19:07 UTC, Sv. Lockal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sv. Lockal 2025-01-10 19:07:34 UTC
Created attachment 916258 [details]
Build log

sys-boot/gnu-efi fails to build if `OBJCOPY` in make.conf is set to absolute path of `llvm-objcopy`.

In https://bugs.gentoo.org/931792 there was a fix which forced use of binutils objcopy. However it works only with simple cases (like OBJCOPY=llvm-objcopy).

Step-by-step transformations in the current sys-boot/gnu-efi-4.0.0 ebuild:


Step 1:
  OBJCOPY="${OBJCOPY/llvm-/}"
  # replaces /usr/lib/llvm/19/bin/llvm-objcopy with /usr/lib/llvm/19/bin/objcopy

Step 2:
  LC_ALL=C "${OBJCOPY}" --help | grep -q '\<pei-' && return 0
  # fails as it is still llvm objcopy

Step 3:
  local binutils_objcopy="${EPREFIX}"/usr/bin/"${OBJCOPY}"
  if [[ -e "${binutils_objcopy}" ]]; then
      OBJCOPY="${binutils_objcopy}"
  fi
  # does nothing as /usr/bin//usr/lib/llvm/19/bin/objcopy does not exist

Step 4:
  LC_ALL=C "${OBJCOPY}" --help | grep -q '\<pei-' || die "${OBJCOPY} (objcopy) 
  does not support EFI target"
  # fails here with /usr/lib/llvm/19/bin/objcopy (objcopy) does not support EFI target


Proposed fix:

On step 3 use basename for OBJCOPY:
  local binutils_objcopy="${EPREFIX}/usr/bin/$(basename "$OBJCOPY")"
Comment 1 Larry the Git Cow gentoo-dev 2025-02-18 17:40:23 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee2d946961fb7174ffee8f5de8c75eacd982779e

commit ee2d946961fb7174ffee8f5de8c75eacd982779e
Author:     Viorel Munteanu <ceamac@gentoo.org>
AuthorDate: 2025-02-18 17:38:40 +0000
Commit:     Viorel Munteanu <ceamac@gentoo.org>
CommitDate: 2025-02-18 17:40:10 +0000

    sys-boot/gnu-efi: another fix for OBJCOPY
    
    Try to simplify wrong objcopy handling.
    
    Bug: https://bugs.gentoo.org/947826
    Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>

 sys-boot/gnu-efi/gnu-efi-4.0.0.ebuild | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
Comment 2 Viorel Munteanu gentoo-dev 2025-02-18 17:42:17 UTC
Please check.  If all goes well I'll backport this fix to 3.0.19 and stabilize it.
Comment 3 Larry the Git Cow gentoo-dev 2025-03-22 14:52:52 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f6da80af796482d9cd13a47180061fca9a8c66ad

commit f6da80af796482d9cd13a47180061fca9a8c66ad
Author:     Viorel Munteanu <ceamac@gentoo.org>
AuthorDate: 2025-03-22 08:58:58 +0000
Commit:     Viorel Munteanu <ceamac@gentoo.org>
CommitDate: 2025-03-22 14:52:26 +0000

    sys-boot/gnu-efi: simplify OBJCOPY handling
    
    Copy it from sys-boot/gnu-efi-4.0.0.
    
    Closes: https://bugs.gentoo.org/947826
    Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>

 sys-boot/gnu-efi/gnu-efi-3.0.19.ebuild | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)