Skip to contentSkip to conversation

package/glibc: use DESTDIR instead of install_root to fix build issue

PATCH Applied Thomas Petazzoni via buildroot 2 participants 3 messages Dec 7, 2025 – Dec 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 package/glibc/glibc.mk | 2 --
 1 file changed, 2 deletions(-)
package/glibc/glibc.mk +0 -2
index b0fa66218a..a7727cbad8 100644
@@ -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
Signature · 6 lines
2.51.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 29 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni via buildroot <[email protected]> writes:

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.

Quoted 7 lines

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.

Yes, I agree. Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Thomas Petazzoni via buildroot

In reply of:

Quoted 36 lines

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.

Quoted 4 lines

There is no autobuilder issue as we're not using our Docker container to do autobuild builds.

Applied to 2025.02.x and 2025.08.x. Thanks

Quoted 24 lines
---
 package/glibc/glibc.mk | 2 --
 1 file changed, 2 deletions(-)
package/glibc/glibc.mk +0 -2
index b0fa66218a..a7727cbad8 100644
@@ -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
Signature · 6 lines
2.51.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot