Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 937868 (slamd64) - gnome-base/gnome-shell-45.5 fails to build on musl - gnome-shell-45.5/src/main.c:149:14: error: '_DYNAMIC' undeclared (first use in this function); did you mean 'PT_DYNAMIC'?
Summary: gnome-base/gnome-shell-45.5 fails to build on musl - gnome-shell-45.5/src/mai...
Status: UNCONFIRMED
Alias: slamd64
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2024-08-13 10:12 UTC by Dino
Modified: 2024-10-08 20:52 UTC (History)
3 users (show)

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


Attachments
Proposed patch (file_937868.txt,112 bytes, patch)
2024-08-13 10:14 UTC, Dino
Details | Diff
emerge --info log (emerge-info,5.76 KB, text/plain)
2024-08-13 10:15 UTC, Dino
Details
gnome-shell-45.5 build log (gnome-shell-45.5-build-log.txt,168.49 KB, text/plain)
2024-08-13 10:18 UTC, Dino
Details
gnome-shell-45.6-r1 with patch (gnome-shell-45.6-r1-with-patch,243.51 KB, application/octet-stream)
2024-08-13 11:06 UTC, Dino
Details
gnome-shell-45.6-r1 without patch (gnome-shell-45.6-r1-without-patch,169.54 KB, application/octet-stream)
2024-08-13 11:07 UTC, Dino
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dino 2024-08-13 10:12:24 UTC
When building gnome-shell-45.5 on Gentoo against musl it will fail at line src/gnome-shell.p/main.c.o with following message:

FAILED: src/gnome-shell.p/main.c.o 
../gnome-shell-45.5/src/main.c: In function 'maybe_add_rpath_introspection_paths':
../gnome-shell-45.5/src/main.c:149:14: error: '_DYNAMIC' undeclared (first use in this function); did you mean 'PT_DYNAMIC'?
  149 |   for (dyn = _DYNAMIC; dyn->d_tag != DT_NULL; dyn++)
../gnome-shell-45.5/src/main.c:149:14: note: each undeclared identifier is reported only once for each function it appears in
../gnome-shell-45.5/src/main.c:162:7: warning: implicit declaration of function 'dladdr1'; did you mean 'dladdr'? [-Wimplicit-function-declaration]
  162 |   if (dladdr1 (_DYNAMIC, &dl_info, (void **) &link_map, RTLD_DL_LINKMAP))
      |       ^~~~~~~
      |       dladdr
../gnome-shell-45.5/src/main.c:162:57: error: 'RTLD_DL_LINKMAP' undeclared (first use in this function); did you mean 'RTLD_DI_LINKMAP'?
  162 |   if (dladdr1 (_DYNAMIC, &dl_info, (void **) &link_map, RTLD_DL_LINKMAP))

During an investigation it seems that the following patch needs to be applied (also ChimeraOS and Void Linux provide this patch on musl): https://github.com/void-linux/void-packages/blob/master/srcpkgs/gnome-shell/patches/no-exe-introspection.patch
After applying this patch, build finishes successfully.

emerge --info log: https://bpa.st/BWJA
gnome-shell-45.5 build log: https://bpa.st/5VSA

flags: 

COMMON_FLAGS="-O2 -march=alderlake -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"

CHOST="x86_64-pc-linux-musl
Comment 1 Dino 2024-08-13 10:14:58 UTC
Created attachment 900051 [details, diff]
Proposed patch
Comment 2 Dino 2024-08-13 10:15:40 UTC
Created attachment 900052 [details]
emerge --info log
Comment 3 Dino 2024-08-13 10:18:48 UTC
Created attachment 900053 [details]
gnome-shell-45.5 build log
Comment 4 immolo 2024-08-13 10:53:27 UTC
Thanks for the report and testing of this patch.

Would you also be able to test if gnome-base/gnome-shell-45.6-r1 works with and without this patch please?
Comment 5 Dino 2024-08-13 11:06:55 UTC
Created attachment 900056 [details]
gnome-shell-45.6-r1 with patch
Comment 6 Dino 2024-08-13 11:07:19 UTC
Created attachment 900057 [details]
gnome-shell-45.6-r1 without patch
Comment 7 Dino 2024-08-13 11:08:54 UTC
Thanks for your comment. Tested also with gnome-shell-45.6-r1 with and without patch. Produces exactly the same result. With patch - source compiled, without patch - same error. Logs attached.
Comment 8 Dino 2024-08-13 11:09:40 UTC
Command used: 

ebuild /var/db/repos/gentoo/gnome-base/gnome-shell/gnome-shell-45.6-r1.ebuild clean compile
Comment 9 Sven E. 2024-10-08 19:11:51 UTC
I can at least second the build failure for now.
As far as I can tell, the patch (in a very crude manner) simply disables the feature.

IMHO it would be much better, if the build system would not set HAVE_EXE_INTROSPECTION in the first place.
Comment 10 Sven E. 2024-10-08 20:52:47 UTC
For whatever reason I cannot attach with pybugz and since the system with musl is headless, I will do it this way:

diff -Naur gnome-shell-45.6-orig/meson.build gnome-shell-45.6-new/meson.build
--- gnome-shell-45.6-orig/meson.build   2024-04-21 12:32:39.000000000 +0000
+++ gnome-shell-45.6-new/meson.build    2024-10-08 20:06:17.844381514 +0000
@@ -160,7 +160,7 @@
 cdata.set('HAVE_MALLINFO2', cc.has_function('mallinfo2'))
 cdata.set('HAVE_SYS_RESOURCE_H', cc.has_header('sys/resource.h'))
 cdata.set('HAVE_EXE_INTROSPECTION',
-  cc.has_header('elf.h') and cc.has_header('link.h'))
+  cc.has_header('elf.h') and cc.has_header('link.h') and cc.has_header_symbol('link.h','_DYNAMIC'))
 cdata.set('HAVE__NL_TIME_FIRST_WEEKDAY',
   cc.has_header_symbol('langinfo.h', '_NL_TIME_FIRST_WEEKDAY')
 )

This checks link.h for _DYNAMIC which musl does not provide. Fixing the _DYNAMIC issue is trivial, however, musl also does not seem to provide for dladdr1() which is used aswell.