Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 741912 - sys-boot/lilo-24.2: edit.c:195:31: error: initializer element is not a compile-time constant
Summary: sys-boot/lilo-24.2: edit.c:195:31: error: initializer element is not a compil...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Joshua Kinard
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 792567
  Show dependency tree
 
Reported: 2020-09-12 18:40 UTC by Agostino Sarubbo
Modified: 2021-06-06 20:28 UTC (History)
2 users (show)

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


Attachments
build.log (build.log,29.11 KB, text/plain)
2020-09-12 18:40 UTC, Agostino Sarubbo
Details
Patch to move the pointer calculation to runtime (runtime-pointer-calculation.patch,682 bytes, patch)
2021-06-02 01:37 UTC, Peter Stuge
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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?