All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/rustc: needs C++
@ 2022-07-25 15:36 Romain Naour
  2022-07-25 18:41 ` James Hilliard
  0 siblings, 1 reply; 6+ messages in thread
From: Romain Naour @ 2022-07-25 15:36 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

While building host-rust with a musl based toolchain without C++ compiler,
the build fail since libunwind bundled in rust sources needs a C++ compiler.

cargo:warning=i686-buildroot-linux-musl-gcc.br_real: error: [...]/host-rust-1.62.0/src/llvm-project/libunwind/src/Unwind-EHABI.cpp: C++ compiler not installed on this system

Note: the issues can't be reproduced with a glibc based toolchain without
C++ probaly due to extra steps required to support musl libc.

Actually, rust compiler is based on LLVM so it likely depends on the same
dependencies as host-llvm package.

Add C++ dependency to rustc virtual package and its reverse dependencies.

Fixes:
http://autobuild.buildroot.org/results/636/636fb39c8f1b8c05e4ca451ac506cd63c7166d82

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 package/bat/Config.in             | 4 ++++
 package/hyperfine/Config.in       | 4 ++++
 package/librsvg/Config.in         | 2 +-
 package/ripgrep/Config.in         | 4 ++++
 package/rustc/Config.in.host      | 4 ++++
 package/sentry-cli/Config.in.host | 4 ++++
 package/suricata/Config.in        | 5 +++--
 7 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/package/bat/Config.in b/package/bat/Config.in
index 515eaf591a..8b95f253ad 100644
--- a/package/bat/Config.in
+++ b/package/bat/Config.in
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_BAT
 	bool "bat"
 	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+	depends on BR2_INSTALL_LIBSTDCPP # host-rustc
 	select BR2_PACKAGE_HOST_RUSTC
 	# we need a full version of less
 	select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
@@ -9,3 +10,6 @@ config BR2_PACKAGE_BAT
 	  A cat(1) clone with syntax highlighting and Git integration.
 
 	  https://github.com/sharkdp/bat
+
+comment "bat needs a toolchain w/ C++"
+	depends on !BR2_INSTALL_LIBSTDCPP
diff --git a/package/hyperfine/Config.in b/package/hyperfine/Config.in
index 527e978146..c052ba8242 100644
--- a/package/hyperfine/Config.in
+++ b/package/hyperfine/Config.in
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_HYPERFINE
 	bool "hyperfine"
 	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+	depends on BR2_INSTALL_LIBSTDCPP # host-rustc
 	select BR2_PACKAGE_HOST_RUSTC
 	help
 	  hyperfine is a benchmark tool written in Rust. It evaluates
@@ -9,3 +10,6 @@ config BR2_PACKAGE_HYPERFINE
 	  same time.
 
 	  https://github.com/sharkdp/hyperfine
+
+comment "hyperfine needs a toolchain w/ C++"
+	depends on !BR2_INSTALL_LIBSTDCPP
diff --git a/package/librsvg/Config.in b/package/librsvg/Config.in
index 270b524b37..91a8d4fe95 100644
--- a/package/librsvg/Config.in
+++ b/package/librsvg/Config.in
@@ -4,7 +4,7 @@ config BR2_PACKAGE_LIBRSVG
 	depends on BR2_USE_WCHAR # glib2
 	depends on BR2_TOOLCHAIN_HAS_THREADS # glib2
 	depends on BR2_USE_MMU # glib2
-	depends on BR2_INSTALL_LIBSTDCPP # pango
+	depends on BR2_INSTALL_LIBSTDCPP # pango, host-rustc
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # pango -> harfbuzz
 	select BR2_PACKAGE_CAIRO
diff --git a/package/ripgrep/Config.in b/package/ripgrep/Config.in
index 0ea2902b34..352f38a9a4 100644
--- a/package/ripgrep/Config.in
+++ b/package/ripgrep/Config.in
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_RIPGREP
 	bool "ripgrep"
 	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+	depends on BR2_INSTALL_LIBSTDCPP # host-rustc
 	select BR2_PACKAGE_HOST_RUSTC
 	help
 	  ripgrep is a line-oriented search tool that
@@ -12,3 +13,6 @@ config BR2_PACKAGE_RIPGREP
 	  The Silver Searcher, ack and grep.
 
 	  https://github.com/BurntSushi/ripgrep
+
+comment "ripgrep needs a toolchain w/ C++"
+	depends on !BR2_INSTALL_LIBSTDCPP
diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
index fec8726aee..1aa5405abf 100644
--- a/package/rustc/Config.in.host
+++ b/package/rustc/Config.in.host
@@ -135,11 +135,15 @@ config BR2_PACKAGE_HOST_RUSTC_ABI
 config BR2_PACKAGE_HOST_RUSTC
 	bool "host rustc"
 	depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
+	depends on BR2_INSTALL_LIBSTDCPP # llvm
 	help
 	  Compiler for the Rust language
 
 	  http://www.rust-lang.org
 
+comment "host-rustc needs a toolchain w/ C++"
+	depends on !BR2_INSTALL_LIBSTDCPP
+
 if BR2_PACKAGE_HOST_RUSTC
 
 choice
diff --git a/package/sentry-cli/Config.in.host b/package/sentry-cli/Config.in.host
index 3124015367..d32c962338 100644
--- a/package/sentry-cli/Config.in.host
+++ b/package/sentry-cli/Config.in.host
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_HOST_SENTRY_CLI
 	bool "host sentry-cli"
 	depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
+	depends on BR2_INSTALL_LIBSTDCPP # host-rustc
 	select BR2_PACKAGE_HOST_RUSTC
 	help
 	  Official Sentry command line interface
@@ -8,3 +9,6 @@ config BR2_PACKAGE_HOST_SENTRY_CLI
 	  For managing debug information files and source maps.
 
 	  https://docs.sentry.io/cli/
+
+comment "host sentry-cli needs a toolchain w/ C++"
+	depends on !BR2_INSTALL_LIBSTDCPP
diff --git a/package/suricata/Config.in b/package/suricata/Config.in
index 5f7eb21da0..cdeba3f103 100644
--- a/package/suricata/Config.in
+++ b/package/suricata/Config.in
@@ -4,6 +4,7 @@ config BR2_PACKAGE_SURICATA
 	depends on BR2_USE_MMU # fork()
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_INSTALL_LIBSTDCPP # host-rustc
 	select BR2_PACKAGE_HOST_RUSTC
 	select BR2_PACKAGE_JANSSON
 	select BR2_PACKAGE_LIBHTP
@@ -20,7 +21,7 @@ config BR2_PACKAGE_SURICATA
 
 	  https://suricata-ids.org
 
-comment "suricata needs a toolchain w/ wchar, threads"
+comment "suricata needs a toolchain w/ C++, wchar, threads"
 	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
 	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
-- 
2.34.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH] package/rustc: needs C++
  2022-07-25 15:36 [Buildroot] [PATCH] package/rustc: needs C++ Romain Naour
@ 2022-07-25 18:41 ` James Hilliard
  2022-07-26  9:51   ` Romain Naour
  0 siblings, 1 reply; 6+ messages in thread
From: James Hilliard @ 2022-07-25 18:41 UTC (permalink / raw)
  To: Romain Naour; +Cc: buildroot

On Mon, Jul 25, 2022 at 9:36 AM Romain Naour <romain.naour@smile.fr> wrote:
>
> While building host-rust with a musl based toolchain without C++ compiler,
> the build fail since libunwind bundled in rust sources needs a C++ compiler.
>
> cargo:warning=i686-buildroot-linux-musl-gcc.br_real: error: [...]/host-rust-1.62.0/src/llvm-project/libunwind/src/Unwind-EHABI.cpp: C++ compiler not installed on this system
>
> Note: the issues can't be reproduced with a glibc based toolchain without
> C++ probaly due to extra steps required to support musl libc.

Is this because glibc provides libunwind so it's not required there?

>
> Actually, rust compiler is based on LLVM so it likely depends on the same
> dependencies as host-llvm package.

This doesn't really look correct, I mean we always assume the build host has
C++ support right? This patch adds a target C++ dependency not a host C++
build dependency.

>
> Add C++ dependency to rustc virtual package and its reverse dependencies.
>
> Fixes:
> http://autobuild.buildroot.org/results/636/636fb39c8f1b8c05e4ca451ac506cd63c7166d82
>
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> ---
>  package/bat/Config.in             | 4 ++++
>  package/hyperfine/Config.in       | 4 ++++
>  package/librsvg/Config.in         | 2 +-
>  package/ripgrep/Config.in         | 4 ++++
>  package/rustc/Config.in.host      | 4 ++++
>  package/sentry-cli/Config.in.host | 4 ++++
>  package/suricata/Config.in        | 5 +++--
>  7 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/package/bat/Config.in b/package/bat/Config.in
> index 515eaf591a..8b95f253ad 100644
> --- a/package/bat/Config.in
> +++ b/package/bat/Config.in
> @@ -1,6 +1,7 @@
>  config BR2_PACKAGE_BAT
>         bool "bat"
>         depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>         select BR2_PACKAGE_HOST_RUSTC
>         # we need a full version of less
>         select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
> @@ -9,3 +10,6 @@ config BR2_PACKAGE_BAT
>           A cat(1) clone with syntax highlighting and Git integration.
>
>           https://github.com/sharkdp/bat
> +
> +comment "bat needs a toolchain w/ C++"
> +       depends on !BR2_INSTALL_LIBSTDCPP
> diff --git a/package/hyperfine/Config.in b/package/hyperfine/Config.in
> index 527e978146..c052ba8242 100644
> --- a/package/hyperfine/Config.in
> +++ b/package/hyperfine/Config.in
> @@ -1,6 +1,7 @@
>  config BR2_PACKAGE_HYPERFINE
>         bool "hyperfine"
>         depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>         select BR2_PACKAGE_HOST_RUSTC
>         help
>           hyperfine is a benchmark tool written in Rust. It evaluates
> @@ -9,3 +10,6 @@ config BR2_PACKAGE_HYPERFINE
>           same time.
>
>           https://github.com/sharkdp/hyperfine
> +
> +comment "hyperfine needs a toolchain w/ C++"
> +       depends on !BR2_INSTALL_LIBSTDCPP
> diff --git a/package/librsvg/Config.in b/package/librsvg/Config.in
> index 270b524b37..91a8d4fe95 100644
> --- a/package/librsvg/Config.in
> +++ b/package/librsvg/Config.in
> @@ -4,7 +4,7 @@ config BR2_PACKAGE_LIBRSVG
>         depends on BR2_USE_WCHAR # glib2
>         depends on BR2_TOOLCHAIN_HAS_THREADS # glib2
>         depends on BR2_USE_MMU # glib2
> -       depends on BR2_INSTALL_LIBSTDCPP # pango
> +       depends on BR2_INSTALL_LIBSTDCPP # pango, host-rustc
>         depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
>         depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # pango -> harfbuzz
>         select BR2_PACKAGE_CAIRO
> diff --git a/package/ripgrep/Config.in b/package/ripgrep/Config.in
> index 0ea2902b34..352f38a9a4 100644
> --- a/package/ripgrep/Config.in
> +++ b/package/ripgrep/Config.in
> @@ -1,6 +1,7 @@
>  config BR2_PACKAGE_RIPGREP
>         bool "ripgrep"
>         depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>         select BR2_PACKAGE_HOST_RUSTC
>         help
>           ripgrep is a line-oriented search tool that
> @@ -12,3 +13,6 @@ config BR2_PACKAGE_RIPGREP
>           The Silver Searcher, ack and grep.
>
>           https://github.com/BurntSushi/ripgrep
> +
> +comment "ripgrep needs a toolchain w/ C++"
> +       depends on !BR2_INSTALL_LIBSTDCPP
> diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
> index fec8726aee..1aa5405abf 100644
> --- a/package/rustc/Config.in.host
> +++ b/package/rustc/Config.in.host
> @@ -135,11 +135,15 @@ config BR2_PACKAGE_HOST_RUSTC_ABI
>  config BR2_PACKAGE_HOST_RUSTC
>         bool "host rustc"
>         depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
> +       depends on BR2_INSTALL_LIBSTDCPP # llvm
>         help
>           Compiler for the Rust language
>
>           http://www.rust-lang.org
>
> +comment "host-rustc needs a toolchain w/ C++"
> +       depends on !BR2_INSTALL_LIBSTDCPP
> +
>  if BR2_PACKAGE_HOST_RUSTC
>
>  choice
> diff --git a/package/sentry-cli/Config.in.host b/package/sentry-cli/Config.in.host
> index 3124015367..d32c962338 100644
> --- a/package/sentry-cli/Config.in.host
> +++ b/package/sentry-cli/Config.in.host
> @@ -1,6 +1,7 @@
>  config BR2_PACKAGE_HOST_SENTRY_CLI
>         bool "host sentry-cli"
>         depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>         select BR2_PACKAGE_HOST_RUSTC
>         help
>           Official Sentry command line interface
> @@ -8,3 +9,6 @@ config BR2_PACKAGE_HOST_SENTRY_CLI
>           For managing debug information files and source maps.
>
>           https://docs.sentry.io/cli/
> +
> +comment "host sentry-cli needs a toolchain w/ C++"
> +       depends on !BR2_INSTALL_LIBSTDCPP
> diff --git a/package/suricata/Config.in b/package/suricata/Config.in
> index 5f7eb21da0..cdeba3f103 100644
> --- a/package/suricata/Config.in
> +++ b/package/suricata/Config.in
> @@ -4,6 +4,7 @@ config BR2_PACKAGE_SURICATA
>         depends on BR2_USE_MMU # fork()
>         depends on BR2_USE_WCHAR
>         depends on BR2_TOOLCHAIN_HAS_THREADS
> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>         select BR2_PACKAGE_HOST_RUSTC
>         select BR2_PACKAGE_JANSSON
>         select BR2_PACKAGE_LIBHTP
> @@ -20,7 +21,7 @@ config BR2_PACKAGE_SURICATA
>
>           https://suricata-ids.org
>
> -comment "suricata needs a toolchain w/ wchar, threads"
> +comment "suricata needs a toolchain w/ C++, wchar, threads"
>         depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
>         depends on BR2_USE_MMU
> -       depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
> +       depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
> --
> 2.34.3
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH] package/rustc: needs C++
  2022-07-25 18:41 ` James Hilliard
@ 2022-07-26  9:51   ` Romain Naour
  2022-07-26 18:17     ` James Hilliard
  0 siblings, 1 reply; 6+ messages in thread
From: Romain Naour @ 2022-07-26  9:51 UTC (permalink / raw)
  To: James Hilliard; +Cc: buildroot

Hello James,

Le 25/07/2022 à 20:41, James Hilliard a écrit :
> On Mon, Jul 25, 2022 at 9:36 AM Romain Naour <romain.naour@smile.fr> wrote:
>>
>> While building host-rust with a musl based toolchain without C++ compiler,
>> the build fail since libunwind bundled in rust sources needs a C++ compiler.
>>
>> cargo:warning=i686-buildroot-linux-musl-gcc.br_real: error: [...]/host-rust-1.62.0/src/llvm-project/libunwind/src/Unwind-EHABI.cpp: C++ compiler not installed on this system
>>
>> Note: the issues can't be reproduced with a glibc based toolchain without
>> C++ probaly due to extra steps required to support musl libc.
> 
> Is this because glibc provides libunwind so it's not required there?
> 
>>
>> Actually, rust compiler is based on LLVM so it likely depends on the same
>> dependencies as host-llvm package.
> 
> This doesn't really look correct, I mean we always assume the build host has
> C++ support right? This patch adds a target C++ dependency not a host C++
> build dependency.

Actually BR2_INSTALL_LIBSTDCPP is probably one of the oldest Buildroot option
(added by [1]) that means "Build/install c++ compiler and libstdc++".

So you're right when you say it add a target C++ dependency but the option also
means having a C++ compiler on the host.

In this patch we want to make sure to have a toolchain with C++ support to build
host-rust package. Adding C++ dependency globally (even if only musl is
affected) would avoid handly musl case with rust based packages.

But adding C++ reverse dependency is not nice either...

Instead we could add the C++ dependency directly on
BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS.

# All target rust packages should depend on this option
config BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
	bool
	default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER1_PLATFORMS && \
		(BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_USES_MUSL)
	default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_HOST_TOOLS_PLATFORMS && \
		(BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_USES_MUSL)
	default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_PLATFORMS && \
		(BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_USES_MUSL)
	depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS

Usually we should not add toolchain dependencies in a _ARCH_SUPPORTS option but
BR2_PACKAGE_HOST_RUSTC_TARGET_TIER... options contains already some
BR2_TOOLCHAIN_USES_GLIBC or BR2_TOOLCHAIN_USES_MUSL.

Doing so would avoid the C++ reverse dependencies and disable rustc for musl
toolchain without a C++ compiler.

I'll send a v2.

[1]
https://git.buildroot.net/buildroot/commit/?id=2d523c23175b8e8772c2e223d92513f836cde8a6

[2]
https://git.buildroot.net/buildroot/tree/package/rustc/Config.in.host?h=2022.05.1#n113

Best regards,
Romain


> 
>>
>> Add C++ dependency to rustc virtual package and its reverse dependencies.
>>
>> Fixes:
>> http://autobuild.buildroot.org/results/636/636fb39c8f1b8c05e4ca451ac506cd63c7166d82
>>
>> Signed-off-by: Romain Naour <romain.naour@smile.fr>
>> ---
>>  package/bat/Config.in             | 4 ++++
>>  package/hyperfine/Config.in       | 4 ++++
>>  package/librsvg/Config.in         | 2 +-
>>  package/ripgrep/Config.in         | 4 ++++
>>  package/rustc/Config.in.host      | 4 ++++
>>  package/sentry-cli/Config.in.host | 4 ++++
>>  package/suricata/Config.in        | 5 +++--
>>  7 files changed, 24 insertions(+), 3 deletions(-)
>>
>> diff --git a/package/bat/Config.in b/package/bat/Config.in
>> index 515eaf591a..8b95f253ad 100644
>> --- a/package/bat/Config.in
>> +++ b/package/bat/Config.in
>> @@ -1,6 +1,7 @@
>>  config BR2_PACKAGE_BAT
>>         bool "bat"
>>         depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
>> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>>         select BR2_PACKAGE_HOST_RUSTC
>>         # we need a full version of less
>>         select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
>> @@ -9,3 +10,6 @@ config BR2_PACKAGE_BAT
>>           A cat(1) clone with syntax highlighting and Git integration.
>>
>>           https://github.com/sharkdp/bat
>> +
>> +comment "bat needs a toolchain w/ C++"
>> +       depends on !BR2_INSTALL_LIBSTDCPP
>> diff --git a/package/hyperfine/Config.in b/package/hyperfine/Config.in
>> index 527e978146..c052ba8242 100644
>> --- a/package/hyperfine/Config.in
>> +++ b/package/hyperfine/Config.in
>> @@ -1,6 +1,7 @@
>>  config BR2_PACKAGE_HYPERFINE
>>         bool "hyperfine"
>>         depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
>> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>>         select BR2_PACKAGE_HOST_RUSTC
>>         help
>>           hyperfine is a benchmark tool written in Rust. It evaluates
>> @@ -9,3 +10,6 @@ config BR2_PACKAGE_HYPERFINE
>>           same time.
>>
>>           https://github.com/sharkdp/hyperfine
>> +
>> +comment "hyperfine needs a toolchain w/ C++"
>> +       depends on !BR2_INSTALL_LIBSTDCPP
>> diff --git a/package/librsvg/Config.in b/package/librsvg/Config.in
>> index 270b524b37..91a8d4fe95 100644
>> --- a/package/librsvg/Config.in
>> +++ b/package/librsvg/Config.in
>> @@ -4,7 +4,7 @@ config BR2_PACKAGE_LIBRSVG
>>         depends on BR2_USE_WCHAR # glib2
>>         depends on BR2_TOOLCHAIN_HAS_THREADS # glib2
>>         depends on BR2_USE_MMU # glib2
>> -       depends on BR2_INSTALL_LIBSTDCPP # pango
>> +       depends on BR2_INSTALL_LIBSTDCPP # pango, host-rustc
>>         depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
>>         depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # pango -> harfbuzz
>>         select BR2_PACKAGE_CAIRO
>> diff --git a/package/ripgrep/Config.in b/package/ripgrep/Config.in
>> index 0ea2902b34..352f38a9a4 100644
>> --- a/package/ripgrep/Config.in
>> +++ b/package/ripgrep/Config.in
>> @@ -1,6 +1,7 @@
>>  config BR2_PACKAGE_RIPGREP
>>         bool "ripgrep"
>>         depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
>> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>>         select BR2_PACKAGE_HOST_RUSTC
>>         help
>>           ripgrep is a line-oriented search tool that
>> @@ -12,3 +13,6 @@ config BR2_PACKAGE_RIPGREP
>>           The Silver Searcher, ack and grep.
>>
>>           https://github.com/BurntSushi/ripgrep
>> +
>> +comment "ripgrep needs a toolchain w/ C++"
>> +       depends on !BR2_INSTALL_LIBSTDCPP
>> diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
>> index fec8726aee..1aa5405abf 100644
>> --- a/package/rustc/Config.in.host
>> +++ b/package/rustc/Config.in.host
>> @@ -135,11 +135,15 @@ config BR2_PACKAGE_HOST_RUSTC_ABI
>>  config BR2_PACKAGE_HOST_RUSTC
>>         bool "host rustc"
>>         depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
>> +       depends on BR2_INSTALL_LIBSTDCPP # llvm
>>         help
>>           Compiler for the Rust language
>>
>>           http://www.rust-lang.org
>>
>> +comment "host-rustc needs a toolchain w/ C++"
>> +       depends on !BR2_INSTALL_LIBSTDCPP
>> +
>>  if BR2_PACKAGE_HOST_RUSTC
>>
>>  choice
>> diff --git a/package/sentry-cli/Config.in.host b/package/sentry-cli/Config.in.host
>> index 3124015367..d32c962338 100644
>> --- a/package/sentry-cli/Config.in.host
>> +++ b/package/sentry-cli/Config.in.host
>> @@ -1,6 +1,7 @@
>>  config BR2_PACKAGE_HOST_SENTRY_CLI
>>         bool "host sentry-cli"
>>         depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
>> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>>         select BR2_PACKAGE_HOST_RUSTC
>>         help
>>           Official Sentry command line interface
>> @@ -8,3 +9,6 @@ config BR2_PACKAGE_HOST_SENTRY_CLI
>>           For managing debug information files and source maps.
>>
>>           https://docs.sentry.io/cli/
>> +
>> +comment "host sentry-cli needs a toolchain w/ C++"
>> +       depends on !BR2_INSTALL_LIBSTDCPP
>> diff --git a/package/suricata/Config.in b/package/suricata/Config.in
>> index 5f7eb21da0..cdeba3f103 100644
>> --- a/package/suricata/Config.in
>> +++ b/package/suricata/Config.in
>> @@ -4,6 +4,7 @@ config BR2_PACKAGE_SURICATA
>>         depends on BR2_USE_MMU # fork()
>>         depends on BR2_USE_WCHAR
>>         depends on BR2_TOOLCHAIN_HAS_THREADS
>> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>>         select BR2_PACKAGE_HOST_RUSTC
>>         select BR2_PACKAGE_JANSSON
>>         select BR2_PACKAGE_LIBHTP
>> @@ -20,7 +21,7 @@ config BR2_PACKAGE_SURICATA
>>
>>           https://suricata-ids.org
>>
>> -comment "suricata needs a toolchain w/ wchar, threads"
>> +comment "suricata needs a toolchain w/ C++, wchar, threads"
>>         depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
>>         depends on BR2_USE_MMU
>> -       depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
>> +       depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
>> --
>> 2.34.3
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH] package/rustc: needs C++
  2022-07-26  9:51   ` Romain Naour
@ 2022-07-26 18:17     ` James Hilliard
  2022-07-26 18:59       ` Arnout Vandecappelle
  2022-07-26 19:00       ` Romain Naour
  0 siblings, 2 replies; 6+ messages in thread
From: James Hilliard @ 2022-07-26 18:17 UTC (permalink / raw)
  To: Romain Naour; +Cc: buildroot

On Tue, Jul 26, 2022 at 3:51 AM Romain Naour <romain.naour@smile.fr> wrote:
>
> Hello James,
>
> Le 25/07/2022 à 20:41, James Hilliard a écrit :
> > On Mon, Jul 25, 2022 at 9:36 AM Romain Naour <romain.naour@smile.fr> wrote:
> >>
> >> While building host-rust with a musl based toolchain without C++ compiler,
> >> the build fail since libunwind bundled in rust sources needs a C++ compiler.
> >>
> >> cargo:warning=i686-buildroot-linux-musl-gcc.br_real: error: [...]/host-rust-1.62.0/src/llvm-project/libunwind/src/Unwind-EHABI.cpp: C++ compiler not installed on this system
> >>
> >> Note: the issues can't be reproduced with a glibc based toolchain without
> >> C++ probaly due to extra steps required to support musl libc.
> >
> > Is this because glibc provides libunwind so it's not required there?
> >
> >>
> >> Actually, rust compiler is based on LLVM so it likely depends on the same
> >> dependencies as host-llvm package.
> >
> > This doesn't really look correct, I mean we always assume the build host has
> > C++ support right? This patch adds a target C++ dependency not a host C++
> > build dependency.
>
> Actually BR2_INSTALL_LIBSTDCPP is probably one of the oldest Buildroot option
> (added by [1]) that means "Build/install c++ compiler and libstdc++".
>
> So you're right when you say it add a target C++ dependency but the option also
> means having a C++ compiler on the host.

Aren't we always guaranteed to have a C++ compiler on the host?:
https://github.com/buildroot/buildroot/blob/2022.05.1/support/dependencies/dependencies.sh#L148

>
> In this patch we want to make sure to have a toolchain with C++ support to build
> host-rust package. Adding C++ dependency globally (even if only musl is
> affected) would avoid handly musl case with rust based packages.
>
> But adding C++ reverse dependency is not nice either...
>
> Instead we could add the C++ dependency directly on
> BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS.
>
> # All target rust packages should depend on this option
> config BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
>         bool
>         default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER1_PLATFORMS && \
>                 (BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_USES_MUSL)
>         default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_HOST_TOOLS_PLATFORMS && \
>                 (BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_USES_MUSL)
>         default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_PLATFORMS && \
>                 (BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_USES_MUSL)
>         depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
>
> Usually we should not add toolchain dependencies in a _ARCH_SUPPORTS option but
> BR2_PACKAGE_HOST_RUSTC_TARGET_TIER... options contains already some
> BR2_TOOLCHAIN_USES_GLIBC or BR2_TOOLCHAIN_USES_MUSL.
>
> Doing so would avoid the C++ reverse dependencies and disable rustc for musl
> toolchain without a C++ compiler.
>
> I'll send a v2.
>
> [1]
> https://git.buildroot.net/buildroot/commit/?id=2d523c23175b8e8772c2e223d92513f836cde8a6
>
> [2]
> https://git.buildroot.net/buildroot/tree/package/rustc/Config.in.host?h=2022.05.1#n113
>
> Best regards,
> Romain
>
>
> >
> >>
> >> Add C++ dependency to rustc virtual package and its reverse dependencies.
> >>
> >> Fixes:
> >> http://autobuild.buildroot.org/results/636/636fb39c8f1b8c05e4ca451ac506cd63c7166d82
> >>
> >> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> >> ---
> >>  package/bat/Config.in             | 4 ++++
> >>  package/hyperfine/Config.in       | 4 ++++
> >>  package/librsvg/Config.in         | 2 +-
> >>  package/ripgrep/Config.in         | 4 ++++
> >>  package/rustc/Config.in.host      | 4 ++++
> >>  package/sentry-cli/Config.in.host | 4 ++++
> >>  package/suricata/Config.in        | 5 +++--
> >>  7 files changed, 24 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/package/bat/Config.in b/package/bat/Config.in
> >> index 515eaf591a..8b95f253ad 100644
> >> --- a/package/bat/Config.in
> >> +++ b/package/bat/Config.in
> >> @@ -1,6 +1,7 @@
> >>  config BR2_PACKAGE_BAT
> >>         bool "bat"
> >>         depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
> >> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
> >>         select BR2_PACKAGE_HOST_RUSTC
> >>         # we need a full version of less
> >>         select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
> >> @@ -9,3 +10,6 @@ config BR2_PACKAGE_BAT
> >>           A cat(1) clone with syntax highlighting and Git integration.
> >>
> >>           https://github.com/sharkdp/bat
> >> +
> >> +comment "bat needs a toolchain w/ C++"
> >> +       depends on !BR2_INSTALL_LIBSTDCPP
> >> diff --git a/package/hyperfine/Config.in b/package/hyperfine/Config.in
> >> index 527e978146..c052ba8242 100644
> >> --- a/package/hyperfine/Config.in
> >> +++ b/package/hyperfine/Config.in
> >> @@ -1,6 +1,7 @@
> >>  config BR2_PACKAGE_HYPERFINE
> >>         bool "hyperfine"
> >>         depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
> >> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
> >>         select BR2_PACKAGE_HOST_RUSTC
> >>         help
> >>           hyperfine is a benchmark tool written in Rust. It evaluates
> >> @@ -9,3 +10,6 @@ config BR2_PACKAGE_HYPERFINE
> >>           same time.
> >>
> >>           https://github.com/sharkdp/hyperfine
> >> +
> >> +comment "hyperfine needs a toolchain w/ C++"
> >> +       depends on !BR2_INSTALL_LIBSTDCPP
> >> diff --git a/package/librsvg/Config.in b/package/librsvg/Config.in
> >> index 270b524b37..91a8d4fe95 100644
> >> --- a/package/librsvg/Config.in
> >> +++ b/package/librsvg/Config.in
> >> @@ -4,7 +4,7 @@ config BR2_PACKAGE_LIBRSVG
> >>         depends on BR2_USE_WCHAR # glib2
> >>         depends on BR2_TOOLCHAIN_HAS_THREADS # glib2
> >>         depends on BR2_USE_MMU # glib2
> >> -       depends on BR2_INSTALL_LIBSTDCPP # pango
> >> +       depends on BR2_INSTALL_LIBSTDCPP # pango, host-rustc
> >>         depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
> >>         depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # pango -> harfbuzz
> >>         select BR2_PACKAGE_CAIRO
> >> diff --git a/package/ripgrep/Config.in b/package/ripgrep/Config.in
> >> index 0ea2902b34..352f38a9a4 100644
> >> --- a/package/ripgrep/Config.in
> >> +++ b/package/ripgrep/Config.in
> >> @@ -1,6 +1,7 @@
> >>  config BR2_PACKAGE_RIPGREP
> >>         bool "ripgrep"
> >>         depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
> >> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
> >>         select BR2_PACKAGE_HOST_RUSTC
> >>         help
> >>           ripgrep is a line-oriented search tool that
> >> @@ -12,3 +13,6 @@ config BR2_PACKAGE_RIPGREP
> >>           The Silver Searcher, ack and grep.
> >>
> >>           https://github.com/BurntSushi/ripgrep
> >> +
> >> +comment "ripgrep needs a toolchain w/ C++"
> >> +       depends on !BR2_INSTALL_LIBSTDCPP
> >> diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
> >> index fec8726aee..1aa5405abf 100644
> >> --- a/package/rustc/Config.in.host
> >> +++ b/package/rustc/Config.in.host
> >> @@ -135,11 +135,15 @@ config BR2_PACKAGE_HOST_RUSTC_ABI
> >>  config BR2_PACKAGE_HOST_RUSTC
> >>         bool "host rustc"
> >>         depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
> >> +       depends on BR2_INSTALL_LIBSTDCPP # llvm
> >>         help
> >>           Compiler for the Rust language
> >>
> >>           http://www.rust-lang.org
> >>
> >> +comment "host-rustc needs a toolchain w/ C++"
> >> +       depends on !BR2_INSTALL_LIBSTDCPP
> >> +
> >>  if BR2_PACKAGE_HOST_RUSTC
> >>
> >>  choice
> >> diff --git a/package/sentry-cli/Config.in.host b/package/sentry-cli/Config.in.host
> >> index 3124015367..d32c962338 100644
> >> --- a/package/sentry-cli/Config.in.host
> >> +++ b/package/sentry-cli/Config.in.host
> >> @@ -1,6 +1,7 @@
> >>  config BR2_PACKAGE_HOST_SENTRY_CLI
> >>         bool "host sentry-cli"
> >>         depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
> >> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
> >>         select BR2_PACKAGE_HOST_RUSTC
> >>         help
> >>           Official Sentry command line interface
> >> @@ -8,3 +9,6 @@ config BR2_PACKAGE_HOST_SENTRY_CLI
> >>           For managing debug information files and source maps.
> >>
> >>           https://docs.sentry.io/cli/
> >> +
> >> +comment "host sentry-cli needs a toolchain w/ C++"
> >> +       depends on !BR2_INSTALL_LIBSTDCPP
> >> diff --git a/package/suricata/Config.in b/package/suricata/Config.in
> >> index 5f7eb21da0..cdeba3f103 100644
> >> --- a/package/suricata/Config.in
> >> +++ b/package/suricata/Config.in
> >> @@ -4,6 +4,7 @@ config BR2_PACKAGE_SURICATA
> >>         depends on BR2_USE_MMU # fork()
> >>         depends on BR2_USE_WCHAR
> >>         depends on BR2_TOOLCHAIN_HAS_THREADS
> >> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
> >>         select BR2_PACKAGE_HOST_RUSTC
> >>         select BR2_PACKAGE_JANSSON
> >>         select BR2_PACKAGE_LIBHTP
> >> @@ -20,7 +21,7 @@ config BR2_PACKAGE_SURICATA
> >>
> >>           https://suricata-ids.org
> >>
> >> -comment "suricata needs a toolchain w/ wchar, threads"
> >> +comment "suricata needs a toolchain w/ C++, wchar, threads"
> >>         depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
> >>         depends on BR2_USE_MMU
> >> -       depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
> >> +       depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
> >> --
> >> 2.34.3
> >>
> >> _______________________________________________
> >> buildroot mailing list
> >> buildroot@buildroot.org
> >> https://lists.buildroot.org/mailman/listinfo/buildroot
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH] package/rustc: needs C++
  2022-07-26 18:17     ` James Hilliard
@ 2022-07-26 18:59       ` Arnout Vandecappelle
  2022-07-26 19:00       ` Romain Naour
  1 sibling, 0 replies; 6+ messages in thread
From: Arnout Vandecappelle @ 2022-07-26 18:59 UTC (permalink / raw)
  To: James Hilliard, Romain Naour; +Cc: buildroot



On 26/07/2022 20:17, James Hilliard wrote:
> On Tue, Jul 26, 2022 at 3:51 AM Romain Naour <romain.naour@smile.fr> wrote:
>>
>> Hello James,
>>
>> Le 25/07/2022 à 20:41, James Hilliard a écrit :
>>> On Mon, Jul 25, 2022 at 9:36 AM Romain Naour <romain.naour@smile.fr> wrote:
>>>>
>>>> While building host-rust with a musl based toolchain without C++ compiler,
>>>> the build fail since libunwind bundled in rust sources needs a C++ compiler.
>>>>
>>>> cargo:warning=i686-buildroot-linux-musl-gcc.br_real: error: [...]/host-rust-1.62.0/src/llvm-project/libunwind/src/Unwind-EHABI.cpp: C++ compiler not installed on this system
>>>>
>>>> Note: the issues can't be reproduced with a glibc based toolchain without
>>>> C++ probaly due to extra steps required to support musl libc.
>>>
>>> Is this because glibc provides libunwind so it's not required there?
>>>
>>>>
>>>> Actually, rust compiler is based on LLVM so it likely depends on the same
>>>> dependencies as host-llvm package.
>>>
>>> This doesn't really look correct, I mean we always assume the build host has
>>> C++ support right? This patch adds a target C++ dependency not a host C++
>>> build dependency.
>>
>> Actually BR2_INSTALL_LIBSTDCPP is probably one of the oldest Buildroot option
>> (added by [1]) that means "Build/install c++ compiler and libstdc++".
>>
>> So you're right when you say it add a target C++ dependency but the option also
>> means having a C++ compiler on the host.
> 
> Aren't we always guaranteed to have a C++ compiler on the host?:
> https://github.com/buildroot/buildroot/blob/2022.05.1/support/dependencies/dependencies.sh#L148

  Romain means a C++ cross-compiler.

  While building LLVM for musl, rustc decides that it also needs target 
libunwind (the libunwind from LLVM, not the one in package/libunwind). This 
libunwind requires a C++ compiler for the target (but that runs on the host).

  We've looked a bit at rustc source code to find out why the hell it wants 
libunwind for musl but not for glibc, but we didn't manage to discover that.

  Regards,
  Arnout

> 
>>
>> In this patch we want to make sure to have a toolchain with C++ support to build
>> host-rust package. Adding C++ dependency globally (even if only musl is
>> affected) would avoid handly musl case with rust based packages.
>>
>> But adding C++ reverse dependency is not nice either...
>>
>> Instead we could add the C++ dependency directly on
>> BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS.
>>
>> # All target rust packages should depend on this option
>> config BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
>>          bool
>>          default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER1_PLATFORMS && \
>>                  (BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_USES_MUSL)
>>          default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_HOST_TOOLS_PLATFORMS && \
>>                  (BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_USES_MUSL)
>>          default y if BR2_PACKAGE_HOST_RUSTC_TARGET_TIER2_PLATFORMS && \
>>                  (BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_USES_MUSL)
>>          depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
>>
>> Usually we should not add toolchain dependencies in a _ARCH_SUPPORTS option but
>> BR2_PACKAGE_HOST_RUSTC_TARGET_TIER... options contains already some
>> BR2_TOOLCHAIN_USES_GLIBC or BR2_TOOLCHAIN_USES_MUSL.
>>
>> Doing so would avoid the C++ reverse dependencies and disable rustc for musl
>> toolchain without a C++ compiler.
>>
>> I'll send a v2.
>>
>> [1]
>> https://git.buildroot.net/buildroot/commit/?id=2d523c23175b8e8772c2e223d92513f836cde8a6
>>
>> [2]
>> https://git.buildroot.net/buildroot/tree/package/rustc/Config.in.host?h=2022.05.1#n113
>>
>> Best regards,
>> Romain
>>
>>
>>>
>>>>
>>>> Add C++ dependency to rustc virtual package and its reverse dependencies.
>>>>
>>>> Fixes:
>>>> http://autobuild.buildroot.org/results/636/636fb39c8f1b8c05e4ca451ac506cd63c7166d82
>>>>
>>>> Signed-off-by: Romain Naour <romain.naour@smile.fr>
>>>> ---
>>>>   package/bat/Config.in             | 4 ++++
>>>>   package/hyperfine/Config.in       | 4 ++++
>>>>   package/librsvg/Config.in         | 2 +-
>>>>   package/ripgrep/Config.in         | 4 ++++
>>>>   package/rustc/Config.in.host      | 4 ++++
>>>>   package/sentry-cli/Config.in.host | 4 ++++
>>>>   package/suricata/Config.in        | 5 +++--
>>>>   7 files changed, 24 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/package/bat/Config.in b/package/bat/Config.in
>>>> index 515eaf591a..8b95f253ad 100644
>>>> --- a/package/bat/Config.in
>>>> +++ b/package/bat/Config.in
>>>> @@ -1,6 +1,7 @@
>>>>   config BR2_PACKAGE_BAT
>>>>          bool "bat"
>>>>          depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
>>>> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>>>>          select BR2_PACKAGE_HOST_RUSTC
>>>>          # we need a full version of less
>>>>          select BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
>>>> @@ -9,3 +10,6 @@ config BR2_PACKAGE_BAT
>>>>            A cat(1) clone with syntax highlighting and Git integration.
>>>>
>>>>            https://github.com/sharkdp/bat
>>>> +
>>>> +comment "bat needs a toolchain w/ C++"
>>>> +       depends on !BR2_INSTALL_LIBSTDCPP
>>>> diff --git a/package/hyperfine/Config.in b/package/hyperfine/Config.in
>>>> index 527e978146..c052ba8242 100644
>>>> --- a/package/hyperfine/Config.in
>>>> +++ b/package/hyperfine/Config.in
>>>> @@ -1,6 +1,7 @@
>>>>   config BR2_PACKAGE_HYPERFINE
>>>>          bool "hyperfine"
>>>>          depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
>>>> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>>>>          select BR2_PACKAGE_HOST_RUSTC
>>>>          help
>>>>            hyperfine is a benchmark tool written in Rust. It evaluates
>>>> @@ -9,3 +10,6 @@ config BR2_PACKAGE_HYPERFINE
>>>>            same time.
>>>>
>>>>            https://github.com/sharkdp/hyperfine
>>>> +
>>>> +comment "hyperfine needs a toolchain w/ C++"
>>>> +       depends on !BR2_INSTALL_LIBSTDCPP
>>>> diff --git a/package/librsvg/Config.in b/package/librsvg/Config.in
>>>> index 270b524b37..91a8d4fe95 100644
>>>> --- a/package/librsvg/Config.in
>>>> +++ b/package/librsvg/Config.in
>>>> @@ -4,7 +4,7 @@ config BR2_PACKAGE_LIBRSVG
>>>>          depends on BR2_USE_WCHAR # glib2
>>>>          depends on BR2_TOOLCHAIN_HAS_THREADS # glib2
>>>>          depends on BR2_USE_MMU # glib2
>>>> -       depends on BR2_INSTALL_LIBSTDCPP # pango
>>>> +       depends on BR2_INSTALL_LIBSTDCPP # pango, host-rustc
>>>>          depends on BR2_TOOLCHAIN_HAS_SYNC_4 # pango -> harfbuzz
>>>>          depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # pango -> harfbuzz
>>>>          select BR2_PACKAGE_CAIRO
>>>> diff --git a/package/ripgrep/Config.in b/package/ripgrep/Config.in
>>>> index 0ea2902b34..352f38a9a4 100644
>>>> --- a/package/ripgrep/Config.in
>>>> +++ b/package/ripgrep/Config.in
>>>> @@ -1,6 +1,7 @@
>>>>   config BR2_PACKAGE_RIPGREP
>>>>          bool "ripgrep"
>>>>          depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
>>>> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>>>>          select BR2_PACKAGE_HOST_RUSTC
>>>>          help
>>>>            ripgrep is a line-oriented search tool that
>>>> @@ -12,3 +13,6 @@ config BR2_PACKAGE_RIPGREP
>>>>            The Silver Searcher, ack and grep.
>>>>
>>>>            https://github.com/BurntSushi/ripgrep
>>>> +
>>>> +comment "ripgrep needs a toolchain w/ C++"
>>>> +       depends on !BR2_INSTALL_LIBSTDCPP
>>>> diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host
>>>> index fec8726aee..1aa5405abf 100644
>>>> --- a/package/rustc/Config.in.host
>>>> +++ b/package/rustc/Config.in.host
>>>> @@ -135,11 +135,15 @@ config BR2_PACKAGE_HOST_RUSTC_ABI
>>>>   config BR2_PACKAGE_HOST_RUSTC
>>>>          bool "host rustc"
>>>>          depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
>>>> +       depends on BR2_INSTALL_LIBSTDCPP # llvm
>>>>          help
>>>>            Compiler for the Rust language
>>>>
>>>>            http://www.rust-lang.org
>>>>
>>>> +comment "host-rustc needs a toolchain w/ C++"
>>>> +       depends on !BR2_INSTALL_LIBSTDCPP
>>>> +
>>>>   if BR2_PACKAGE_HOST_RUSTC
>>>>
>>>>   choice
>>>> diff --git a/package/sentry-cli/Config.in.host b/package/sentry-cli/Config.in.host
>>>> index 3124015367..d32c962338 100644
>>>> --- a/package/sentry-cli/Config.in.host
>>>> +++ b/package/sentry-cli/Config.in.host
>>>> @@ -1,6 +1,7 @@
>>>>   config BR2_PACKAGE_HOST_SENTRY_CLI
>>>>          bool "host sentry-cli"
>>>>          depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
>>>> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>>>>          select BR2_PACKAGE_HOST_RUSTC
>>>>          help
>>>>            Official Sentry command line interface
>>>> @@ -8,3 +9,6 @@ config BR2_PACKAGE_HOST_SENTRY_CLI
>>>>            For managing debug information files and source maps.
>>>>
>>>>            https://docs.sentry.io/cli/
>>>> +
>>>> +comment "host sentry-cli needs a toolchain w/ C++"
>>>> +       depends on !BR2_INSTALL_LIBSTDCPP
>>>> diff --git a/package/suricata/Config.in b/package/suricata/Config.in
>>>> index 5f7eb21da0..cdeba3f103 100644
>>>> --- a/package/suricata/Config.in
>>>> +++ b/package/suricata/Config.in
>>>> @@ -4,6 +4,7 @@ config BR2_PACKAGE_SURICATA
>>>>          depends on BR2_USE_MMU # fork()
>>>>          depends on BR2_USE_WCHAR
>>>>          depends on BR2_TOOLCHAIN_HAS_THREADS
>>>> +       depends on BR2_INSTALL_LIBSTDCPP # host-rustc
>>>>          select BR2_PACKAGE_HOST_RUSTC
>>>>          select BR2_PACKAGE_JANSSON
>>>>          select BR2_PACKAGE_LIBHTP
>>>> @@ -20,7 +21,7 @@ config BR2_PACKAGE_SURICATA
>>>>
>>>>            https://suricata-ids.org
>>>>
>>>> -comment "suricata needs a toolchain w/ wchar, threads"
>>>> +comment "suricata needs a toolchain w/ C++, wchar, threads"
>>>>          depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
>>>>          depends on BR2_USE_MMU
>>>> -       depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
>>>> +       depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
>>>> --
>>>> 2.34.3
>>>>
>>>> _______________________________________________
>>>> buildroot mailing list
>>>> buildroot@buildroot.org
>>>> https://lists.buildroot.org/mailman/listinfo/buildroot
>>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Buildroot] [PATCH] package/rustc: needs C++
  2022-07-26 18:17     ` James Hilliard
  2022-07-26 18:59       ` Arnout Vandecappelle
@ 2022-07-26 19:00       ` Romain Naour
  1 sibling, 0 replies; 6+ messages in thread
From: Romain Naour @ 2022-07-26 19:00 UTC (permalink / raw)
  To: James Hilliard; +Cc: buildroot

Hello James

Le 26/07/2022 à 20:17, James Hilliard a écrit :
> On Tue, Jul 26, 2022 at 3:51 AM Romain Naour <romain.naour@smile.fr> wrote:
>>
>> Hello James,
>>
>> Le 25/07/2022 à 20:41, James Hilliard a écrit :
>>> On Mon, Jul 25, 2022 at 9:36 AM Romain Naour <romain.naour@smile.fr> wrote:
>>>>
>>>> While building host-rust with a musl based toolchain without C++ compiler,
>>>> the build fail since libunwind bundled in rust sources needs a C++ compiler.
>>>>
>>>> cargo:warning=i686-buildroot-linux-musl-gcc.br_real: error: [...]/host-rust-1.62.0/src/llvm-project/libunwind/src/Unwind-EHABI.cpp: C++ compiler not installed on this system
>>>>
>>>> Note: the issues can't be reproduced with a glibc based toolchain without
>>>> C++ probaly due to extra steps required to support musl libc.
>>>
>>> Is this because glibc provides libunwind so it's not required there?
>>>
>>>>
>>>> Actually, rust compiler is based on LLVM so it likely depends on the same
>>>> dependencies as host-llvm package.
>>>
>>> This doesn't really look correct, I mean we always assume the build host has
>>> C++ support right? This patch adds a target C++ dependency not a host C++
>>> build dependency.
>>
>> Actually BR2_INSTALL_LIBSTDCPP is probably one of the oldest Buildroot option
>> (added by [1]) that means "Build/install c++ compiler and libstdc++".
>>
>> So you're right when you say it add a target C++ dependency but the option also
>> means having a C++ compiler on the host.
> 
> Aren't we always guaranteed to have a C++ compiler on the host?:
> https://github.com/buildroot/buildroot/blob/2022.05.1/support/dependencies/dependencies.sh#L148
> 

Yes indeed, but for BR2_INSTALL_LIBSTDCPP "Build/install c++ compiler and
libstdc++" means a C++ cross compiler for the target installed in HOST_DIR:

aarch64-linux-gnu-g++

not g++ for your build machine.

Sorry, I wasn't very clear with "having a C++ compiler on the host"...
I meant "having a C++ cross compiler for the target installed in HOST_DIR".

To resume, host-rust needs a C++ cross compiler for the target only for musl
based toolchains while building llvm bundled in its source when it build
libunwind for the target.

Best regards,
Romain
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-26 19:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 15:36 [Buildroot] [PATCH] package/rustc: needs C++ Romain Naour
2022-07-25 18:41 ` James Hilliard
2022-07-26  9:51   ` Romain Naour
2022-07-26 18:17     ` James Hilliard
2022-07-26 18:59       ` Arnout Vandecappelle
2022-07-26 19:00       ` Romain Naour

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.