patch: fix host ar abspath

This commit is contained in:
2026-09-13 20:08:34 +02:00
parent 9ed7bc9c1f
commit 63470b814f
@@ -2,8 +2,11 @@ From: rubenslte-builder <builder@rubenslte>
Date: Wed, 22 Jul 2026 10:30:00 +0200
Subject: [PATCH 2/8] build-core-fix-ar-absolute-paths
Fix ar absolute path issues by extracting to temp dir instead of per-member piping
Use $(abspath ...) for toolchain paths to survive cd in recipe
Fix ar absolute path issues by extracting to temp dir instead of per-member piping.
$(abspath ...) is only safe for TARGET_AR, which is a relative prebuilt path used
after `cd $$ldir`; HOST_AR is bare `ar` (GNU make built-in AR via combo/select.mk)
and is resolved through PATH, so it must NOT be abspath'd (abspath of `ar` yields
$TREE/ar, which does not exist).
---
diff --git a/build/core/definitions.mk b/build/core/definitions.mk
--- a/build/core/definitions.mk
@@ -39,9 +42,9 @@ diff --git a/build/core/definitions.mk b/build/core/definitions.mk
- $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_ARFLAGS) \
- $(PRIVATE_ARFLAGS) $@ $$filelist
+ cp $(1) $$ldir/input.a; \
+ cd $$ldir && $(abspath $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR)) x input.a; \
+ cd $$ldir && $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) x input.a; \
+ rm -f $$ldir/input.a; \
+ $(abspath $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR)) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_ARFLAGS) \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_ARFLAGS) \
+ $(PRIVATE_ARFLAGS) $@ $$ldir/*.o
endef