Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 741912

Summary: sys-boot/lilo-24.2: edit.c:195:31: error: initializer element is not a compile-time constant
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Joshua Kinard <kumba>
Status: CONFIRMED ---    
Severity: normal CC: base-system, peter
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 792567    
Attachments: build.log
Patch to move the pointer calculation to runtime

Description Agostino Sarubbo gentoo-dev 2020-09-12 18:40:38 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: sys-boot/lilo-24.2 fails to compile.
Discovered on: amd64 (internal ref: tinderbox)

NOTE:
This machine uses a clang/LLVM toolchain.
If you think that this issue is strictly related to clang/LLVM please block bug 408963. If you think that this issue is strictly related to the LLD linker, please block bug 731004.
This machine uses also GLIBC-2.32. If you think that this issue is strictly related to GLIBC please block bug 736174.
Comment 1 Agostino Sarubbo gentoo-dev 2020-09-12 18:40:41 UTC
Created attachment 659817 [details]
build.log

build log and emerge --info
Comment 2 Peter Stuge 2021-06-02 01:37:24 UTC
Created attachment 713217 [details, diff]
Patch to move the pointer calculation to runtime
Comment 3 Joshua Kinard gentoo-dev 2021-06-06 19:43:03 UTC
I am not convinced that the attached patch fully resolves the issue.  The patch makes the runtime calculation only happen in function `bmp_file_open', but the 'lh' pointer is also accessed in `bmp_file_close' and `main'.

Some quick research suggests two possible solutions:

- Remove the 'static' initializer from the 'lh' definition, per this StackOverflow answer: https://stackoverflow.com/a/34450315/ and this commit in someone's personal repo: https://git.sr.ht/~kqz/repo/commit/b8808d8

- Change the assignment to the following code, sourced from a Reddit comment on making lilo build with clang and musl:
(void*)((char*)&tm + (offsetof(MENUTABLE, row) - offsetof(BITMAPLILOHEADER, row)))
Source: https://www.reddit.com/r/Gentoo/comments/nmq5o1/help_with_installing_a_bootloader_on_a_clangmusl/

I don't have a working clang compiler installation, so I cannot reliably test either of these solutions (gcc-11 seems content with either of them).

Thoughts?