diff mbox series

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

Message ID 20210527145118.31373-1-juergen@jstuber.net
State Accepted
Headers show
Series [1/1] toolchain/toolchain-external: Allow relative paths in BR2_TOOLCHAIN_EXTERNAL_PATH. | expand

Commit Message

Juergen Stuber May 27, 2021, 2:51 p.m. UTC
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.

Signed-off-by: Juergen Stuber <juergen@jstuber.net>
---
 toolchain/toolchain-external/pkg-toolchain-external.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Romain Naour Jan. 8, 2022, 6:25 p.m. UTC | #1
Hello Juergen,

Le 27/05/2021 à 16:51, Juergen Stuber a écrit :
> 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).

Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain

> 
> Signed-off-by: Juergen Stuber <juergen@jstuber.net>
> ---
>  toolchain/toolchain-external/pkg-toolchain-external.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> index 6d91cb5d1e..2b70007a34 100644
> --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> @@ -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),)
>
Arnout Vandecappelle Feb. 8, 2022, 8:56 p.m. UTC | #2
On 27/05/2021 16:51, Juergen Stuber wrote:
> 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

> 
> Signed-off-by: Juergen Stuber <juergen@jstuber.net>
> ---
>   toolchain/toolchain-external/pkg-toolchain-external.mk | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> index 6d91cb5d1e..2b70007a34 100644
> --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> @@ -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),)
diff mbox series

Patch

diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index 6d91cb5d1e..2b70007a34 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -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),)