diff mbox series

[v2,2/3] package/rust: use host libraries from HOST_DIR

Message ID 20240229224122.1085300-2-romain.naour@smile.fr
State Accepted
Headers show
Series [v2,1/3] package/rust/rust.mk: add missing host-zlib dependency | expand

Commit Message

Romain Naour Feb. 29, 2024, 10:41 p.m. UTC
host-rust package depends on several host packages to provide tools and
libraries but it doesn't take into account HOST_DIR while building rustc
compiler. Indeed, rustc needs zlib and fail to link if zlib is not
installed on the host.

  error: could not compile `rustc_driver` (lib) due to previous error

If zlib is installed on the host, we can notice it with ldd tool (while
it should be linked with the one provided by Buildroot host-zlib).

  ldd [...]TestRust/host/bin/rustc
  libz.so.1 => /lib64/libz.so.1

Provide HOST_LDFLAGS using llvm.ldflags in config.toml.
(HOST_LDFLAGS provide -L$(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib)

With that fixed, rustc_driver link with libz from HOST_DIR but the
host-rust build still fail later due to another issue.

  error: could not compile `rustdoc-tool` (bin "rustdoc_tool_binary") due to previous error

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/6256881545
http://autobuild.buildroot.org/results/a6b/a6b28783f29e6b729824bf42679a62f72ad5bee0

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
v2: no change
---
 package/rust/rust.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

Yann E. MORIN March 2, 2024, 10:07 p.m. UTC | #1
Romain, All,

On 2024-02-29 23:41 +0100, Romain Naour spake thusly:
> host-rust package depends on several host packages to provide tools and
> libraries but it doesn't take into account HOST_DIR while building rustc
> compiler. Indeed, rustc needs zlib and fail to link if zlib is not
> installed on the host.
> 
>   error: could not compile `rustc_driver` (lib) due to previous error
> 
> If zlib is installed on the host, we can notice it with ldd tool (while
> it should be linked with the one provided by Buildroot host-zlib).
> 
>   ldd [...]TestRust/host/bin/rustc
>   libz.so.1 => /lib64/libz.so.1
> 
> Provide HOST_LDFLAGS using llvm.ldflags in config.toml.
> (HOST_LDFLAGS provide -L$(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib)
> 
> With that fixed, rustc_driver link with libz from HOST_DIR but the
> host-rust build still fail later due to another issue.
> 
>   error: could not compile `rustdoc-tool` (bin "rustdoc_tool_binary") due to previous error
> 
> Fixes:
> https://gitlab.com/buildroot.org/buildroot/-/jobs/6256881545
> http://autobuild.buildroot.org/results/a6b/a6b28783f29e6b729824bf42679a62f72ad5bee0
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
> v2: no change
> ---
>  package/rust/rust.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/package/rust/rust.mk b/package/rust/rust.mk
> index 16a397407f..4903060368 100644
> --- a/package/rust/rust.mk
> +++ b/package/rust/rust.mk
> @@ -65,6 +65,7 @@ define HOST_RUST_CONFIGURE_CMDS
>  		echo 'cc = "$(TARGET_CROSS)gcc"'; \
>  		echo '[llvm]'; \
>  		echo 'ninja = false'; \
> +		echo 'ldflags = "$(HOST_LDFLAGS)"'; \
>  	) > $(@D)/config.toml
>  endef
>  
> -- 
> 2.43.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/package/rust/rust.mk b/package/rust/rust.mk
index 16a397407f..4903060368 100644
--- a/package/rust/rust.mk
+++ b/package/rust/rust.mk
@@ -65,6 +65,7 @@  define HOST_RUST_CONFIGURE_CMDS
 		echo 'cc = "$(TARGET_CROSS)gcc"'; \
 		echo '[llvm]'; \
 		echo 'ninja = false'; \
+		echo 'ldflags = "$(HOST_LDFLAGS)"'; \
 	) > $(@D)/config.toml
 endef