From 3ce3e04d02aa6b8f1841b6faafa14260085fc350 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Sun, 7 Dec 2025 16:06:10 +0100 Subject: [PATCH] package/glibc: use DESTDIR instead of install_root to fix build issue Building a simple configuration such as: BR2_aarch64=y BR2_FORCE_HOST_BUILD=y Under our reference Docker container, as an out-of-tree build: ./utils/docker-run make O=output-test will fail during the glibc staging installation step with: /usr/bin/install -c -m 644 /home/thomas/buildroot/br/output-glibc/build/glibc-2.42-3-gbc13db73937730401d592b33092db6df806d193e/build/libc.a /usr/lib64/libc.a /usr/bin/install: cannot create regular file '/usr/lib64/libc.a': Permission denied The problem being that the install_root variable is for some reason lost along the way. We definitely pass it during the staging installation step, but then glibc calls a sub-make and in that submake, install_root is empty. Observations: - Building the same configuration inside the Docker container, but in-tree, doesn't exhibit the problem. - Building outside of the Docker container, but with the same make version as the one we build due to BR2_FORCE_HOST_BUILD=y doesn't exhibit the problem. However, it turns out that glibc sets install_root to $(DESTDIR). And passing DESTDIR just works. So we drop our custom GLIBC_INSTALL_STAGING_OPTS to rely on the default one, and this fixes the problem. It's not extremely satisfying to not fully understand what's going on, but after spending quite some time on this, and having a trivial and actually pretty nice workaround, we simply propose to use this solution. There is no autobuilder issue as we're not using our Docker container to do autobuild builds. Signed-off-by: Thomas Petazzoni Signed-off-by: Peter Korsgaard --- package/glibc/glibc.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk index b0fa66218a..a7727cbad8 100644 --- a/package/glibc/glibc.mk +++ b/package/glibc/glibc.mk @@ -60,8 +60,6 @@ GLIBC_SUBDIR = build GLIBC_INSTALL_STAGING = YES -GLIBC_INSTALL_STAGING_OPTS = install_root=$(STAGING_DIR) install - # Thumb build is broken, build in ARM mode ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y) GLIBC_EXTRA_CFLAGS += -marm