Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 928907 - gui-libs/gtk-4.12.5: fails to compile with clang: /usr/lib/llvm/18/bin/llvm-objcopy: error: 'gtk/gtkresources_blob.o': Symbol table has link index of 5 which is not a valid index
Summary: gui-libs/gtk-4.12.5: fails to compile with clang: /usr/lib/llvm/18/bin/llvm-o...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL: https://gitlab.gnome.org/GNOME/gtk/-/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-07 21:22 UTC by Rahul Sandhu
Modified: 2024-05-01 22:57 UTC (History)
5 users (show)

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


Attachments
build.log (build.log,462.50 KB, text/x-log)
2024-04-07 21:22 UTC, Rahul Sandhu
Details
emerge --info (emerge-info,21.32 KB, text/plain)
2024-04-07 21:23 UTC, Rahul Sandhu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rahul Sandhu 2024-04-07 21:22:12 UTC
gui-libs/gtk doesn't compile when using llvm 18.

Reproducible: Always

Steps to Reproduce:
1. Compile gui-libs/gtk with clang
Actual Results:  
Fails to compile

Expected Results:  
Should compile
Comment 1 Rahul Sandhu 2024-04-07 21:22:49 UTC
Created attachment 889783 [details]
build.log
Comment 2 Rahul Sandhu 2024-04-07 21:23:16 UTC
Created attachment 889784 [details]
emerge --info
Comment 3 Mart Raudsepp gentoo-dev 2024-04-13 10:09:20 UTC
I was wondering why this doesn't happen for me, but that's apparently because it only uses objcopy on x86_64 and when binutils linker is used, but I'm on arm64 and us lld:

if not meson.is_cross_build() and build_machine.cpu_family() == 'x86_64' and build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and objcopy_supports_section_alignment and ld.fo
und() and ld_is_bfd
  can_use_objcopy_for_resources = true
else
  can_use_objcopy_for_resources = false
endif


That means I can't really reproduce this to investigate first-hand :(

Adding some CC's on who might. Those projects may feel free to un-CC themselves if they don't find it relevant.
Comment 4 Mart Raudsepp gentoo-dev 2024-04-13 10:12:47 UTC
Upstream added all these conditions to avoid this problem, apparently by ending up not using it with llvm-objcopy, but it seems to be used again now, maybe by having implemented --add-symbol and --set-section-alignment in more recent versions? But I see those options there in llvm-17 too...
Comment 5 Rahul Sandhu 2024-05-01 22:57:33 UTC
Upstream does not currently use binutils, so a workaround to compile with clang for now is to create a portage environment to use GNU objcopy:

mkdir -pv /etc/portage/{package.,}env
echo 'OBJCOPY="objcopy"' > /etc/portage/env/clang-no-llvm-objcopy # note this command will overwrite the contents of that file so ensure there is no current environment located there
echo 'gui-libs/gtk clang-no-llvm-objcopy' >> /etc/portage/package.env/gui-libs
emerge -va1 gui-libs/gtk