hermit-os / hermit-rs

Hermit for Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hello_world demo, missing symbols

kallisti5 opened this issue · comments

cargo build -Zbuild-std=std,core,alloc,panic_abort --target x86_64-unknown-hermit
  Downloaded compiler_builtins v0.1.82
  Downloaded libc v0.2.135
  Downloaded 2 crates (771.1 KB) in 0.49s
   Compiling compiler_builtins v0.1.82
   Compiling core v0.0.0 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling libc v0.2.135
   Compiling libc v0.2.137
   Compiling cc v1.0.73
   Compiling memchr v2.5.0
   Compiling cc v1.0.76
   Compiling std v0.0.0 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
   Compiling cfg-if v1.0.0
   Compiling untrusted v0.7.1
   Compiling spin v0.5.2
   Compiling log v0.4.17
   Compiling once_cell v1.16.0
   Compiling tinyvec_macros v0.1.0
   Compiling crc32fast v1.3.2
   Compiling adler v1.0.2
   Compiling percent-encoding v2.2.0
   Compiling rustls v0.20.7
   Compiling unicode-bidi v0.3.8
   Compiling base64 v0.13.1
   Compiling chunked_transfer v1.4.0
   Compiling x86 v0.51.0
   Compiling libm v0.2.6
   Compiling tinyvec v1.6.0
   Compiling miniz_oxide v0.5.4
   Compiling form_urlencoded v1.1.0
   Compiling flate2 v1.0.24
   Compiling ring v0.16.20
   Compiling unwind v0.0.0 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind)
   Compiling filetime v0.2.18
   Compiling xattr v0.2.3
   Compiling unicode-normalization v0.1.22
   Compiling tar v0.4.38
   Compiling idna v0.3.0
   Compiling url v2.3.1
   Compiling webpki v0.22.0
   Compiling sct v0.7.0
   Compiling webpki-roots v0.22.5
   Compiling ureq v2.5.0
   Compiling hermit-sys v0.2.6
   Compiling rustc-std-workspace-core v1.99.0 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
   Compiling rustc-demangle v0.1.21
   Compiling rustc-std-workspace-alloc v1.99.0 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-alloc)
   Compiling panic_abort v0.0.0 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_abort)
   Compiling panic_unwind v0.0.0 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_unwind)
   Compiling gimli v0.26.1
   Compiling hermit-abi v0.2.6
   Compiling object v0.29.0
   Compiling hashbrown v0.12.3
   Compiling miniz_oxide v0.5.3
   Compiling std_detect v0.1.5 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/stdarch/crates/std_detect)
   Compiling addr2line v0.17.0
   Compiling proc_macro v0.0.0 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro)
   Compiling bitflags v1.3.2
   Compiling bit_field v0.10.1
   Compiling raw-cpuid v10.6.0
   Compiling hello_unikernel v0.1.0 (/home/kallisti5/Code/hello_unikernel)
error: linking with `rust-lld` failed: exit status: 1
  |
  = note: "rust-lld" "-flavor" "gnu" "--build-id" "--hash-style=gnu" "--Bstatic" "/tmp/rustcvilV3U/symbols.o" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/hello_unikernel-1d44325ec873aec4.21bs6m0th0gwhu3x.rcgu.o" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/hello_unikernel-1d44325ec873aec4.2s94r4wh2txncqqh.rcgu.o" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/hello_unikernel-1d44325ec873aec4.2xyhvac9irzskqli.rcgu.o" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/hello_unikernel-1d44325ec873aec4.3znfxnlrx4xnghpj.rcgu.o" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/hello_unikernel-1d44325ec873aec4.5eylw3s8lhtpc2qs.rcgu.o" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/hello_unikernel-1d44325ec873aec4.nxwo07784a526cq.rcgu.o" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/hello_unikernel-1d44325ec873aec4.2yo5ylknjm2iy14i.rcgu.o" "--as-needed" "-L" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps" "-L" "/home/kallisti5/Code/hello_unikernel/target/debug/deps" "-L" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/build/hermit-sys-89c45a04507b801b/out/target/x86_64/debug" "-L" "/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-hermit/lib" "-Bstatic" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libhermit_sys-489d67a8eda7bec3.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/liblibm-54590f03f165fb80.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/liblog-636287c9b2c77402.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libcfg_if-b19ebf94551062f1.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libstd-fd4dc7ee62760d1e.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libpanic_abort-fd17148398984b7d.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libhermit_abi-bc32911c3237f84b.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/librustc_demangle-1d4b09c40f4414a3.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libstd_detect-dab36f629ce804ce.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libhashbrown-0a91e29a176b2476.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libminiz_oxide-7d0291da7836fe5e.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libadler-3c61c459fc2fabbd.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/librustc_std_workspace_alloc-3d1960916ac09d63.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libunwind-72a771a4b34a38ce.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libcfg_if-a46e78128f6de692.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/liblibc-5fe94af562874d6d.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/liballoc-95378f4929bb9450.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/librustc_std_workspace_core-f55b8c5d6161c4c9.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libcore-2e7640e0491fe414.rlib" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libcompiler_builtins-48efa1c5aaf6844b.rlib" "-Bdynamic" "--eh-frame-hdr" "-znoexecstack" "-L" "/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-hermit/lib" "-o" "/home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/hello_unikernel-1d44325ec873aec4" "--gc-sections" "-pie"
  = note: rust-lld: error: undefined symbol: memcpy
          >>> referenced by lib.rs:1055 (src/lib.rs:1055)
          >>>               log-636287c9b2c77402.log.a00ed888-cgu.0.rcgu.o:(log::RecordBuilder::new::h6e6e0574d6c74b8b) in archive /home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/liblog-636287c9b2c77402.rlib
          >>> referenced by lib.rs:1054 (src/lib.rs:1054)
          >>>               log-636287c9b2c77402.log.a00ed888-cgu.0.rcgu.o:(log::RecordBuilder::new::h6e6e0574d6c74b8b) in archive /home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/liblog-636287c9b2c77402.rlib
          >>> referenced by lib.rs:1070 (src/lib.rs:1070)
          >>>               log-636287c9b2c77402.log.a00ed888-cgu.0.rcgu.o:(log::RecordBuilder::args::h98bc07c2373061ea) in archive /home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/liblog-636287c9b2c77402.rlib
          >>> referenced 152 more times
          
          rust-lld: error: undefined symbol: sys_futex_wait
          >>> referenced by lib.rs:272 (/home/kallisti5/.cargo/registry/src/github.com-1ecc6299db9ec823/hermit-abi-0.2.6/src/lib.rs:272)
          >>>               std-fd4dc7ee62760d1e.std.5bf50d3a-cgu.10.rcgu.o:(std::sys::hermit::futex::futex_wait::hb0d14bea6ff5fc0a) in archive /home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libstd-fd4dc7ee62760d1e.rlib
          
          rust-lld: error: undefined symbol: sys_futex_wake
          >>> referenced by lib.rs:280 (/home/kallisti5/.cargo/registry/src/github.com-1ecc6299db9ec823/hermit-abi-0.2.6/src/lib.rs:280)
          >>>               std-fd4dc7ee62760d1e.std.5bf50d3a-cgu.10.rcgu.o:(std::sys::hermit::futex::futex_wake::h6477ddf5ce16ba72) in archive /home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libstd-fd4dc7ee62760d1e.rlib
          >>> referenced by lib.rs:280 (/home/kallisti5/.cargo/registry/src/github.com-1ecc6299db9ec823/hermit-abi-0.2.6/src/lib.rs:280)
          >>>               std-fd4dc7ee62760d1e.std.5bf50d3a-cgu.10.rcgu.o:(std::sys::hermit::futex::futex_wake_all::hff7306e9f0d8c95a) in archive /home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libstd-fd4dc7ee62760d1e.rlib
          
          rust-lld: error: undefined symbol: memset
          >>> referenced by intrinsics.rs:2589 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics.rs:2589)
          >>>               std-fd4dc7ee62760d1e.std.5bf50d3a-cgu.5.rcgu.o:(core::intrinsics::write_bytes::h1ff59d3a4acd8041) in archive /home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libstd-fd4dc7ee62760d1e.rlib
          >>> referenced by mod.rs:169 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:169)
          >>>               std-fd4dc7ee62760d1e.std.5bf50d3a-cgu.7.rcgu.o:(core::fmt::Write::write_char::h49efac9136e77332) in archive /home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libstd-fd4dc7ee62760d1e.rlib
          >>> referenced by mod.rs:169 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:169)
          >>>               std-fd4dc7ee62760d1e.std.5bf50d3a-cgu.7.rcgu.o:(core::fmt::Write::write_char::h5103df36d92e068d) in archive /home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libstd-fd4dc7ee62760d1e.rlib
          >>> referenced 19 more times
          
          rust-lld: error: undefined symbol: memmove
          >>> referenced by intrinsics.rs:2518 (/home/kallisti5/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/intrinsics.rs:2518)
          >>>               alloc-95378f4929bb9450.alloc.6c0792d0-cgu.6.rcgu.o:(core::intrinsics::copy::h32e23b8d0691c015) in archive /home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/liballoc-95378f4929bb9450.rlib
          
          rust-lld: error: undefined symbol: memcmp
          >>> referenced by cmp.rs:91 (src/slice/cmp.rs:91)
          >>>               core-2e7640e0491fe414.core.12971aef-cgu.3.rcgu.o:(_$LT$$u5b$A$u5d$$u20$as$u20$core..slice..cmp..SlicePartialEq$LT$B$GT$$GT$::equal::h3b82e3362944dea3) in archive /home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libcore-2e7640e0491fe414.rlib
          
          rust-lld: error: undefined symbol: strlen
          >>> referenced by c_str.rs:286 (src/ffi/c_str.rs:286)
          >>>               core-2e7640e0491fe414.core.12971aef-cgu.5.rcgu.o:(core::ffi::c_str::CStr::from_ptr::strlen_rt::h47b802c9eb0d7917) in archive /home/kallisti5/Code/hello_unikernel/target/x86_64-unknown-hermit/debug/deps/libcore-2e7640e0491fe414.rlib
          

error: could not compile `hello_unikernel` due to previous error

Cargo.toml

[package]
name = "hello_unikernel"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

# Cargo.toml

[target.'cfg(target_os = "hermit")'.dependencies]
hermit-sys = "0.2.*"

The Readme has outdated instructions. I'll create a PR to update them. Please have a look at hermitcore/rusty-demo.

Specifically, you should use hermit-sys = "0.4" together with Rust nightly-2022-10-19.

The readme should be clear now.