wasi targets failing with crt dependency errors

28 views
Skip to first unread message

Ananth Gundabattula

unread,
Apr 3, 2021, 3:43:44 PM4/3/21
to rules_rust
Hello All,

First of all thank you for the rules_rust project. Could you please advise me on how to resolve the below ? (not sure if it is a bug yet)

I have been using it to compile various targets and I have hit a dead end while trying to compile for the WASI platform target. (Rust rlib and WASM targets work fine). The WASI target used to compile fine for older rules_rust / cargo_raze combinations. The error seems to be related to rust linker trying to link a 32bit library on my 64 bit ubuntu 20.04 host. 

The main error I am getting is the following line:

"= note: rust-lld: error: cannot open crt1-command.o: No such file or directory". Sometimes I get the error for crt.o instead of the crt1-command.

I have tried the following to see if the issue can be resolved but does not seem to help:

- Install gcc multilib
- Using --extra_toolchains to bazel  and hence use a 64 bit dependency. equivalent of  below
register_toolchains(
"@rust_linux_x86_64_toolchains//:toolchain_for_x86_64-unknown-linux-gnu",
"@rust_linux_x86_64_toolchains//:toolchain_for_wasm32-wasi",
)


Here are my workspace and build commands: (Please note that commit versions for rules_rust after the below commit version are failing with loads of FFI open-ssl errors and hence the commit version below. The ISO date version for rust repositories is to see if the nightly made any difference. The stable 1.51.0 version also had the same errors.

WORKSPACE:

git_repository(
name = "rules_rust",
commit = "8fa205e2c45b86637f9e724f6aeac4a1fb645284",
remote = "https://github.com/bazelbuild/rules_rust.git",
)
load("@rules_rust//rust:repositories.bzl", "rust_repositories")
rust_repositories(edition = "2018",iso_date = "2021-03-23",version = "nightly",)
load("@rules_rust//proto:repositories.bzl", "rust_proto_repositories")
rust_proto_repositories()

Bazel command:
bazel build //dwmwasmcore:dwmwasmcore --platforms=@rules_rust//rust/platform:wasi

The full command that bails out looks like the following:

Error message from bazel:

  = note: "rust-lld" "-flavor" "wasm" "--rsp-quoting=posix" "-z" "stack-size=1048576" "--stack-first" "--allow-undefined" "--fatal-warnings" "--no-demangle" "crt1-command.o" "-L" "external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib" "-L" "external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/self-contained" "bazel-out/k8-fastbuild/bin/dwmwasmcore/dwmwasmcore.dwmwasmcore.7rcbfp3g-cgu.0.rcgu.o" "bazel-out/k8-fastbuild/bin/dwmwasmcore/dwmwasmcore.dwmwasmcore.7rcbfp3g-cgu.1.rcgu.o" "bazel-out/k8-fastbuild/bin/dwmwasmcore/dwmwasmcore.dwmwasmcore.7rcbfp3g-cgu.2.rcgu.o" "bazel-out/k8-fastbuild/bin/dwmwasmcore/dwmwasmcore.dwmwasmcore.7rcbfp3g-cgu.3.rcgu.o" "bazel-out/k8-fastbuild/bin/dwmwasmcore/dwmwasmcore.dwmwasmcore.7rcbfp3g-cgu.4.rcgu.o" "bazel-out/k8-fastbuild/bin/dwmwasmcore/dwmwasmcore.dwmwasmcore.7rcbfp3g-cgu.5.rcgu.o" "bazel-out/k8-fastbuild/bin/dwmwasmcore/dwmwasmcore.dwmwasmcore.7rcbfp3g-cgu.6.rcgu.o" "-o" "bazel-out/k8-fastbuild/bin/dwmwasmcore/dwmwasmcore.wasm" "--export" "main" "--export=__heap_base" "--export=__data_end" "bazel-out/k8-fastbuild/bin/dwmwasmcore/dwmwasmcore.3du5hwz58fkih5bc.rcgu.o" "--gc-sections" "-O0" "-L" "external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__unicode_xid__0_2_1" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__proc_macro2__1_0_24" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__quote__1_0_9" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__syn__1_0_60" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__auto_enums_core__0_7_12" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__derive_utils__0_11_2" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__auto_enums_derive__0_7_12" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__auto_enums__0_7_12" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__unicode_xid__0_2_1" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__proc_macro2__1_0_24" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__quote__1_0_9" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__syn__1_0_60" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__derive_utils__0_11_2" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__futures_core__0_3_13" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__futures_sink__0_3_13" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__futures_channel__0_3_13" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__futures_task__0_3_13" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__futures_io__0_3_13" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__memchr__2_3_4" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__pin_project_lite__0_2_5" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__pin_utils__0_1_0" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__proc_macro_nested__0_1_7" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__slab__0_4_2" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__proc_macro_hack__0_5_19" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__futures_macro__0_3_13" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__futures_util__0_3_13" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__libc__0_2_87" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__num_cpus__1_13_0" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__futures_executor__0_3_13" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__futures__0_3_13" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__cfg_if__1_0_0" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__standback__0_2_15" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__standback__0_2_15" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__time_macros_impl__0_1_1" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__time_macros__0_1_1" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__discard__1_0_4" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__stdweb_internal_runtime__0_1_5" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__serde_derive__1_0_123" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__serde__1_0_123" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__stdweb_derive__0_5_3" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__base_x__0_2_8" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__itoa__0_4_7" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__ryu__1_0_5" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__serde_json__1_0_64" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__sha1__0_6_0" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__stdweb_internal_macros__0_2_9" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__stdweb__0_4_20" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__const_fn__0_4_5" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__time__0_2_25" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__instant__0_1_9" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__strum__0_20_0" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__derive_new__0_5_9" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__derive_more__0_99_11" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__toml__0_5_8" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__find_crate__0_6_3" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__futures_enum__0_1_17" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__impl_trait_for_tuples__0_2_1" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__io_enum__1_0_0" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__iter_enum__1_0_0" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__unicode_segmentation__1_7_1" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__heck__0_3_2" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__strum_macros__0_20_1" "-L" "bazel-out/k8-fastbuild/bin/dwmfoundation" "-L" "bazel-out/k8-fastbuild/bin/external/rules_rust_proto__byteorder__1_3_4" "-L" "bazel-out/k8-fastbuild/bin/external/rules_rust_proto__iovec__0_1_4" "-L" "bazel-out/k8-fastbuild/bin/external/rules_rust_proto__bytes__0_4_12" "-L" "bazel-out/k8-fastbuild/bin/external/rules_rust_proto__protobuf__2_8_2" "-L" "bazel-out/k8-fastbuild/bin/dwmdataformats/proto_rustgen_dwmdataformats.proto.rust" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__bitflags__1_2_1" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__smallvec__1_6_1" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__thiserror_impl__1_0_24" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__thiserror__1_0_24" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__flatbuffers__0_8_3" "-L" "bazel-out/k8-fastbuild/bin/dwmdataformats" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__lazy_static__1_4_0" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__geographiclib_rs__0_2_0" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__wasi__0_10_2_wasi_snapshot_preview1" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__getrandom__0_2_2" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__once_cell__1_7_2" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__ahash__0_6_3" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__rhai_codegen__0_3_3" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__rhai__0_19_13" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__bumpalo__3_6_1" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__lazy_static__1_4_0" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__cfg_if__1_0_0" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__log__0_4_14" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__wasm_bindgen_shared__0_2_72" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__wasm_bindgen_backend__0_2_72" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__wasm_bindgen_macro_support__0_2_72" "-L" "bazel-out/k8-opt-exec-2B5CBBC6/bin/external/dwmcommons_cargo_workspace__wasm_bindgen_macro__0_2_72" "-L" "bazel-out/k8-fastbuild/bin/external/dwmcommons_cargo_workspace__wasm_bindgen__0_2_72" "-L" "bazel-out/k8-fastbuild/bin/dwmscriptingengine" "-L" "external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/libstd-0c407eba4ce66791.rlib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/libpanic_abort-8868f9cdb4311b13.rlib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/libwasi-42afb1a4ce1a984a.rlib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/librustc_demangle-ab604f0b83dde2e7.rlib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/libhashbrown-8d747be2cfd5dfd7.rlib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/librustc_std_workspace_alloc-f9c8213c421a9583.rlib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/libunwind-afdd97106d8c0ecd.rlib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/libcfg_if-4837a68dc17d064a.rlib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/liblibc-f18c48bf21bf41c7.rlib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/liballoc-4951dda1e8dc7a12.rlib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/librustc_std_workspace_core-97b38baa5f7c8ba1.rlib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/libcore-d920df971a3ebcf7.rlib" "/home/ananth/.cache/bazel/_bazel_ananth/3b78149b28ecdfd1c756836c65ec9847/external/rust_linux_x86_64/lib/rustlib/wasm32-wasi/lib/libcompiler_builtins-804f3b341ed9be96.rlib"
  = note: rust-lld: error: cannot open crt1-command.o: No such file or directory
          

error: aborting due to previous error



Regards,
Ananth
Reply all
Reply to author
Forward
0 new messages