* [Buildroot] [PATCH 1/2] package/rust: use host libraries from HOST_DIR @ 2024-02-29 13:11 Romain Naour 2024-02-29 13:11 ` [Buildroot] [PATCH 2/2] package/rust: provide RUSTFLAGS for cargo Romain Naour 2024-02-29 13:35 ` [Buildroot] [PATCH 1/2] package/rust: use host libraries from HOST_DIR yann.morin 0 siblings, 2 replies; 5+ messages in thread From: Romain Naour @ 2024-02-29 13:11 UTC (permalink / raw) To: buildroot; +Cc: Romain Naour 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> --- package/rust/rust.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/package/rust/rust.mk b/package/rust/rust.mk index f7a5c0fcd5..c464e77f4f 100644 --- a/package/rust/rust.mk +++ b/package/rust/rust.mk @@ -64,6 +64,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 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 2/2] package/rust: provide RUSTFLAGS for cargo 2024-02-29 13:11 [Buildroot] [PATCH 1/2] package/rust: use host libraries from HOST_DIR Romain Naour @ 2024-02-29 13:11 ` Romain Naour 2024-02-29 13:35 ` [Buildroot] [PATCH 1/2] package/rust: use host libraries from HOST_DIR yann.morin 1 sibling, 0 replies; 5+ messages in thread From: Romain Naour @ 2024-02-29 13:11 UTC (permalink / raw) To: buildroot; +Cc: Romain Naour While building the rust toolchain, the build system endup using cargo (from [...]/output/build/host-rust-bin-1.74.1/cargo/bin/cargo) to build some tool like rustdoc-tool. But the host-rust package doesn't use the cargo infractructure (since it provide cargo binary) and some cargo environment varialble [1] is not set to crosscompile cargo packages in the rust toolchain. For exemple, we usually set RUSTFLAGS="-C link-arg=-Wl,-rpath,$(HOST_DIR)/lib" to force cargo using libraries provided by Buildroot in $(HOST_DIR)/lib. RUSTFLAGS is actually needed to find zlib library (host-zlib) to link rustdoc-tool when zlib is not installed on the host. Fixes: error: could not compile `rustdoc-tool` (bin "rustdoc_tool_binary") due to previous error [1] https://gitlab.com/buildroot.org/buildroot/-/blob/2024.02-rc1/package/pkg-cargo.mk?ref_type=tags#L167 Signed-off-by: Romain Naour <romain.naour@smile.fr> --- package/rust/rust.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/rust/rust.mk b/package/rust/rust.mk index c464e77f4f..cbe79cd8e3 100644 --- a/package/rust/rust.mk +++ b/package/rust/rust.mk @@ -69,7 +69,9 @@ define HOST_RUST_CONFIGURE_CMDS endef define HOST_RUST_BUILD_CMDS - cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python$(PYTHON3_VERSION_MAJOR) x.py build + cd $(@D); $(HOST_MAKE_ENV) \ + RUSTFLAGS="$(addprefix -C link-args=,$(HOST_LDFLAGS))" \ + $(HOST_DIR)/bin/python$(PYTHON3_VERSION_MAJOR) x.py build endef HOST_RUST_INSTALL_OPTS = \ -- 2.43.2 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/rust: use host libraries from HOST_DIR 2024-02-29 13:11 [Buildroot] [PATCH 1/2] package/rust: use host libraries from HOST_DIR Romain Naour 2024-02-29 13:11 ` [Buildroot] [PATCH 2/2] package/rust: provide RUSTFLAGS for cargo Romain Naour @ 2024-02-29 13:35 ` yann.morin 2024-02-29 13:43 ` Romain Naour 1 sibling, 1 reply; 5+ messages in thread From: yann.morin @ 2024-02-29 13:35 UTC (permalink / raw) To: Romain Naour; +Cc: buildroot romain, All, On 2024-02-29 14:11 +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> > --- > package/rust/rust.mk | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/package/rust/rust.mk b/package/rust/rust.mk > index f7a5c0fcd5..c464e77f4f 100644 > --- a/package/rust/rust.mk > +++ b/package/rust/rust.mk > @@ -64,6 +64,7 @@ define HOST_RUST_CONFIGURE_CMDS > echo 'cc = "$(TARGET_CROSS)gcc"'; \ > echo '[llvm]'; \ > echo 'ninja = false'; \ > + echo 'ldflags = "$(HOST_LDFLAGS)"'; \ But then, we would also need to add host-zlib to HOST_RUST_DEPENDENCIES, no? Regards, Yann E. MORIN. > ) > $(@D)/config.toml > endef > > -- > 2.43.2 > > _______________________________________________ > buildroot mailing list > buildroot@buildroot.org > https://lists.buildroot.org/mailman/listinfo/buildroot -- ____________ .-----------------.--------------------: _ :------------------. | Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON | | | Software Designer | _/ - /' | \ / CAMPAIGN | | +33 638.411.245 '--------------------: (_ `--, | X AGAINST | | yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL | '--------------------------------------:______/_____:------------------' ____________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/rust: use host libraries from HOST_DIR 2024-02-29 13:35 ` [Buildroot] [PATCH 1/2] package/rust: use host libraries from HOST_DIR yann.morin @ 2024-02-29 13:43 ` Romain Naour 2024-02-29 19:22 ` Yann E. MORIN 0 siblings, 1 reply; 5+ messages in thread From: Romain Naour @ 2024-02-29 13:43 UTC (permalink / raw) To: yann.morin; +Cc: buildroot Le 29/02/2024 à 14:35, yann.morin@orange.com a écrit : > romain, All, > > On 2024-02-29 14:11 +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> >> --- >> package/rust/rust.mk | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/package/rust/rust.mk b/package/rust/rust.mk >> index f7a5c0fcd5..c464e77f4f 100644 >> --- a/package/rust/rust.mk >> +++ b/package/rust/rust.mk >> @@ -64,6 +64,7 @@ define HOST_RUST_CONFIGURE_CMDS >> echo 'cc = "$(TARGET_CROSS)gcc"'; \ >> echo '[llvm]'; \ >> echo 'ninja = false'; \ >> + echo 'ldflags = "$(HOST_LDFLAGS)"'; \ > > But then, we would also need to add host-zlib to > HOST_RUST_DEPENDENCIES, no? Indeed but in practice host-zlib is already an "indirect" dependency of host-rust due to host-openssl (host-libopenssl) dependency. HOST_LIBOPENSSL_DEPENDENCIES = host-zlib I noticed the missing dependency but forgot to add it in HOST_RUST_DEPENDENCIES. Best regards, Romain > > Regards, > Yann E. MORIN. > >> ) > $(@D)/config.toml >> endef >> >> -- >> 2.43.2 >> >> _______________________________________________ >> 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] 5+ messages in thread
* Re: [Buildroot] [PATCH 1/2] package/rust: use host libraries from HOST_DIR 2024-02-29 13:43 ` Romain Naour @ 2024-02-29 19:22 ` Yann E. MORIN 0 siblings, 0 replies; 5+ messages in thread From: Yann E. MORIN @ 2024-02-29 19:22 UTC (permalink / raw) To: Romain Naour; +Cc: yann.morin, buildroot Romain, All, On 2024-02-29 14:43 +0100, Romain Naour spake thusly: > Le 29/02/2024 à 14:35, yann.morin@orange.com a écrit : > > On 2024-02-29 14:11 +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. [--SNIP--] > > But then, we would also need to add host-zlib to > > HOST_RUST_DEPENDENCIES, no? > Indeed but in practice host-zlib is already an "indirect" dependency of > host-rust due to host-openssl (host-libopenssl) dependency. When a package has a dependency on a library for itself, we must add an explicit dependency in that package, even if it is transitively brought by another, like is the case here. So we do want that host-rust depends on host-zlib explicitly. > HOST_LIBOPENSSL_DEPENDENCIES = host-zlib > > I noticed the missing dependency but forgot to add it in HOST_RUST_DEPENDENCIES. Mark this patch as Changes-requested, then! ;-) Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-02-29 19:22 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-02-29 13:11 [Buildroot] [PATCH 1/2] package/rust: use host libraries from HOST_DIR Romain Naour 2024-02-29 13:11 ` [Buildroot] [PATCH 2/2] package/rust: provide RUSTFLAGS for cargo Romain Naour 2024-02-29 13:35 ` [Buildroot] [PATCH 1/2] package/rust: use host libraries from HOST_DIR yann.morin 2024-02-29 13:43 ` Romain Naour 2024-02-29 19:22 ` Yann E. MORIN
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox