Skip to contentSkip to conversation

toolchain/toolchain-external: Allow relative paths in BR2_TOOLCHAIN_EXTERNAL_PATH.

PATCH In review Juergen Stuber 3 participants 3 messages May 27, 2021 – Feb 8, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toolchain/toolchain-external: Allow relative paths in BR2_TOOLCHAIN_EXTERNAL_PATH.

Convert BR2_TOOLCHAIN_EXTERNAL_PATH to an absolute path when used.

Otherwise the symbolic links to the external toolchain binaries are not installed in host/bin when BR2_TOOLCHAIN_EXTERNAL_PATH is relative. This happens because TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER changes directory into host/bin to create the symbolic links. From there the tools are no longer found via the relative path and a single symbolic link host/bin/$(prefix)-* is created instead.

---
 toolchain/toolchain-external/pkg-toolchain-external.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
toolchain/toolchain-external/pkg-toolchain-external.mk +1 -1
index 6d91cb5d1e..2b70007a34 100644
@@ -68,7 +68,7 @@ TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR = $(HOST_DIR)/opt/ext-toolchain
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y)
 TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR)
 else
-TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH))
+TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(abspath $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH)))
 endif
 
 ifeq ($(TOOLCHAIN_EXTERNAL_INSTALL_DIR),)
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw

Hello Juergen,

Le 27/05/2021 à 16:51, Juergen Stuber a écrit :

Quoted 8 lines

Convert BR2_TOOLCHAIN_EXTERNAL_PATH to an absolute path when used.

Otherwise the symbolic links to the external toolchain binaries are not installed in host/bin when BR2_TOOLCHAIN_EXTERNAL_PATH is relative. This happens because TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER changes directory into host/bin to create the symbolic links. From there the tools are no longer found via the relative path and a single symbolic link host/bin/$(prefix)-* is created instead.

Indeed, using a relative path for BR2_TOOLCHAIN_EXTERNAL_PATH doesn't work

$ ls -l test/ext-preinstalled-relative-toolchain/host/bin/*
lrwxrwxrwx. 1 romnao romnao    95  8 janv. 19:18
'test/ext-preinstalled-relative-toolchain/host/bin/arm-none-linux-gnueabihf-*'
->
'../toolchain/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-*'
-rwxr-xr-x. 1 romnao romnao 21288  8 janv. 19:17
test/ext-preinstalled-relative-toolchain/host/bin/toolchain-wrapper

With your patch applied the toolchain is imported correctly (busybox build).

Best regards,
Romain

Quoted 12 lines
---
 toolchain/toolchain-external/pkg-toolchain-external.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
toolchain/toolchain-external/pkg-toolchain-external.mk +0 -0
index 6d91cb5d1e..2b70007a34 100644

toolchain/toolchain-external/pkg-toolchain-external.mk TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR = $(HOST_DIR)/opt/ext-toolchain · line 74

Quoted 8 lines
toolchain/toolchain-external/pkg-toolchain-external.mk +1 -1
@@ -68,7 +68,7 @@ TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR = $(HOST_DIR)/opt/ext-toolchain
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y)
 TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR)
 else
-TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH))
+TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(abspath $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH)))
 endif
 
 ifeq ($(TOOLCHAIN_EXTERNAL_INSTALL_DIR),)

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

#2 lore raw
In reply to Juergen Stuber
Quoted 8 lines · Juergen Stuber

Convert BR2_TOOLCHAIN_EXTERNAL_PATH to an absolute path when used.

Otherwise the symbolic links to the external toolchain binaries are not installed in host/bin when BR2_TOOLCHAIN_EXTERNAL_PATH is relative. This happens because TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER changes directory into host/bin to create the symbolic links.
From there the tools are no longer found via the relative path and
a single symbolic link host/bin/$(prefix)-* is created instead.

I've extended the commit message a bit to explain a use case where relative
paths may be useful, and applied to master, thanks.

Regards,
Arnout

Quoted 11 lines
---
  toolchain/toolchain-external/pkg-toolchain-external.mk | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
toolchain/toolchain-external/pkg-toolchain-external.mk +0 -0
index 6d91cb5d1e..2b70007a34 100644

toolchain/toolchain-external/pkg-toolchain-external.mk TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR = $(HOST_DIR)/opt/ext-toolchain · line 74

Quoted 8 lines
toolchain/toolchain-external/pkg-toolchain-external.mk +1 -1
@@ -68,7 +68,7 @@ TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR = $(HOST_DIR)/opt/ext-toolchain
  ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y)
  TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(TOOLCHAIN_EXTERNAL_DOWNLOAD_INSTALL_DIR)
  else
-TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH))
+TOOLCHAIN_EXTERNAL_INSTALL_DIR = $(abspath $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH)))
  endif
 
  ifeq ($(TOOLCHAIN_EXTERNAL_INSTALL_DIR),)

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