The musl Makefile installs the dynamic loader as a symlink to libc.so with the following rule: $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so $(INSTALL) -D -l $(libdir)/libc.so $@ || true While it works, the drawback is that ld-musl-<arch>.so ends up being a symlink to /lib/libc.so. While it works on the target, it means we have a broken symlink in $(STAGING_DIR) and $(TARGET_DIR) as /lib/libc.so doesn't make sense on the build machine. This generally doesn't cause any problem *except* when we tell Qemu to use $(STAGING_DIR) as the library directory when running target programs through the Qemu user emulation mode. This is for example node inside the NodeJS build. Due to this broken symlink, Qemu can't find libc.so that is pointed to be the dynamic loader symlink causing this build error: qemu-arm: Could not open '/lib/ld-musl-armhf.so.1': No such file or directory Since this is not really a bug in the musl build system, we address this issue by overriding the symlink to be a relative path. The dynamic loader is always installed in /lib, and libc.so is also always installed in /lib because we pass libdir=/lib when configuring musl. So we can simply have a ld-musl* -> libc.so symbolic link. We use ld-musl* as a wildcard so that we don't need to have extra logic to determine the exact name of the dynamic loader symlink, and simply override the one that exists. Fixes: http://autobuild.buildroot.net/results/9ff23f2e3c97e9af410617de3e7376f9d45a7d63/ https://bugs.busybox.net/show_bug.cgi?id=15061 Note that, for external toolchain, we already have a generic fixup that makes symlinks relative [0]. So in the external toolchain, even if the symlink is broken, it gets fixed when we import the toolchain into STAGING_DIR. [0] https://lore.kernel.org/buildroot/20221026205312.3f729eb8@windsurf/ Cc: hello.skyclo@gmail.com Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> [yann.morin.1998@free.fr: - add summary of Thomas' explanations for external toolchains ] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> |
||
---|---|---|
arch | ||
board | ||
boot | ||
configs | ||
docs | ||
fs | ||
linux | ||
package | ||
support | ||
system | ||
toolchain | ||
utils | ||
.clang-format | ||
.defconfig | ||
.flake8 | ||
.gitignore | ||
.gitlab-ci.yml | ||
.shellcheckrc | ||
CHANGES | ||
Config.in | ||
Config.in.legacy | ||
COPYING | ||
DEVELOPERS | ||
Makefile | ||
Makefile.legacy | ||
README |
Buildroot is a simple, efficient and easy-to-use tool to generate embedded Linux systems through cross-compilation. The documentation can be found in docs/manual. You can generate a text document with 'make manual-text' and read output/docs/manual/manual.text. Online documentation can be found at http://buildroot.org/docs.html To build and use the buildroot stuff, do the following: 1) run 'make menuconfig' 2) select the target architecture and the packages you wish to compile 3) run 'make' 4) wait while it compiles 5) find the kernel, bootloader, root filesystem, etc. in output/images You do not need to be root to build or run buildroot. Have fun! Buildroot comes with a basic configuration for a number of boards. Run 'make list-defconfigs' to view the list of provided configurations. Please feed suggestions, bug reports, insults, and bribes back to the buildroot mailing list: buildroot@buildroot.org You can also find us on #buildroot on OFTC IRC. If you would like to contribute patches, please read https://buildroot.org/manual.html#submitting-patches