bytecodealliance / cargo-component

A Cargo subcommand for creating WebAssembly components based on the component model proposal.
Apache License 2.0
451 stars 53 forks source link

Cargo Component install give error in RPI 4 (ARM CORTEX-A72) #303

Open siashish opened 3 months ago

siashish commented 3 months ago

Try to install cargo install cargo-component --locked in RPI4 to run the wasi 0.2 preview demo code in RPI4 but got error while installing cargo component.

System info

Architecture:             aarch64
  CPU op-mode(s):         32-bit, 64-bit
  Byte Order:             Little Endian
CPU(s):                   4
  On-line CPU(s) list:    0-3
Vendor ID:                ARM
  Model name:             Cortex-A72
    Model:                3
    Thread(s) per core:   1
    Core(s) per cluster:  4
    Socket(s):            -
    Cluster(s):           1
    Stepping:             r0p3
    CPU(s) scaling MHz:   100%
    CPU max MHz:          1800.0000
    CPU min MHz:          600.0000
    BogoMIPS:             108.00
    Flags:                fp asimd evtstrm crc32 cpuid
Caches (sum of all):      
  L1d:                    128 KiB (4 instances)
  L1i:                    192 KiB (4 instances)
  L2:                     1 MiB (1 instance)
Vulnerabilities:          
  Gather data sampling:   Not affected
  Itlb multihit:          Not affected
  L1tf:                   Not affected
  Mds:                    Not affected
  Meltdown:               Not affected
  Mmio stale data:        Not affected
  Reg file data sampling: Not affected
  Retbleed:               Not affected
  Spec rstack overflow:   Not affected
  Spec store bypass:      Vulnerable
  Spectre v1:             Mitigation; __user pointer sanitization
  Spectre v2:             Vulnerable
  Srbds:                  Not affected
  Tsx async abort:        Not affected

error I got it you can see below.

   Compiling logos v0.13.0
error: failed to run custom build command for `openssl-sys v0.9.102`

Caused by:
  process didn't exit successfully: `/tmp/cargo-install2B3uFo/release/build/openssl-sys-39daf1417a1c9c4e/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
  AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
  AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
  AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_DIR
  OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=OPENSSL_STATIC
  cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  run pkg_config fail: 
  pkg-config exited with status code 1
  > PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags openssl

  The system library `openssl` required by crate `openssl-sys` was not found.
  The file `openssl.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `openssl.pc`.

  --- stderr
  thread 'main' panicked at /home/rppi4/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.102/build/find_normal.rs:190:5:

  Could not find directory of OpenSSL installation, and this `-sys` crate cannot
  proceed without this knowledge. If OpenSSL is installed and this crate had
  trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
  compilation process.

  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

  If you're in a situation where you think the directory *should* be found
  automatically, please open a bug at https://github.com/sfackler/rust-openssl
  and include information about your system as well as this message.

  $HOST = aarch64-unknown-linux-gnu
  $TARGET = aarch64-unknown-linux-gnu
  openssl-sys = 0.9.102

  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-component v0.13.0`, intermediate artifacts can be found at `/tmp/cargo-install2B3uFo`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

try to run given demo

reference https://github.com/bytecodealliance/cargo-component

Any one have any idea about the issue. it's a lot help Thanks in advance.

calvinrp commented 3 months ago

Ah, openssl linking issues when compiling.

Alternatively to sorting out this compilation issue, you might want to try installing the pre-built binary artifacts. If you install cargo-binstall with cargo install cargo-binstall and then cargo binstall cargo-component, that might work for you.

Alternatively, there is a path to get openssl wired up in the compilation, but I'm probably not the best person to help with it.

siashish commented 3 months ago

@calvinrp Thanks for the support but still got the error

 WARN Failed to retrieve token from `gh auth token` err=Os { code: 2, kind: NotFound, message: "No such file or directory" }
 WARN Failed to read git credential file
 INFO resolve: Resolving package: 'cargo-component'
 INFO resolve:fetch_crate_matched{self=SparseRegistry { url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("index.crates.io")), port: None, path: "/", query: None, fragment: None }, dl_template: OnceCell { value: None } } client=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, zstd: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.6.8"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, zstd: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.6.8"} }, num_request: 1, per: 10ms, until: Instant { tv_sec: 4064, tv_nsec: 878201265 }, state: Ready { rem: 1 } }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {}, poisoned: false, .. } } }) crate_name="cargo-component" version_req=VersionReq { comparators: [] }}:do_send_request{self=Client(Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, zstd: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.6.8"} }, service: DelayRequest { inner: Mutex { data: Inner { client: Client { accepts: Accepts { gzip: true, brotli: true, zstd: true, deflate: true }, proxies: [Proxy(System({}), None)], referer: true, default_headers: {"accept": "*/*", "user-agent": "cargo-binstall/1.6.8"} }, num_request: 1, per: 10ms, until: Instant { tv_sec: 4064, tv_nsec: 878201265 }, state: Ready { rem: 1 } }, poisoned: false, .. }, hosts_to_delay: Mutex { data: {}, poisoned: false, .. } } }) request=Request { method: GET, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("index.crates.io")), port: None, path: "/config.json", query: None, fragment: None }, headers: {} } url=Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("index.crates.io")), port: None, path: "/config.json", query: None, fragment: None }}: Received timeout error from reqwest. Delay future request by 200ms
 WARN The package cargo-component v0.13.1 will be installed from source (with cargo)
Do you wish to continue? yes/[no]
? yes
    Updating crates.io index
  Downloaded cargo-component v0.13.1
  Downloaded 1 crate (154.9 KB) in 0.30s
  Installing cargo-component v0.13.1
    Updating crates.io index
  Downloaded async-channel v2.3.1
  Downloaded darling_macro v0.20.9
  Downloaded waker-fn v1.2.0
  Downloaded async-executor v1.12.0
  Downloaded async-recursion v1.1.1
  Downloaded blocking v1.6.1
  Downloaded num-iter v0.1.45
  Downloaded event-listener-strategy v0.5.2
  Downloaded num v0.4.3
  Downloaded prost v0.12.6
  Downloaded prost-derive v0.12.6
  Downloaded concurrent-queue v2.5.0
  Downloaded async-task v4.7.1
  Downloaded piper v0.2.2
  Downloaded num-rational v0.4.2
  Downloaded num-complex v0.4.6
  Downloaded darling v0.20.9
  Downloaded prost-build v0.12.6
  Downloaded cargo-config2 v0.1.26
  Downloaded prost-types v0.12.6
  Downloaded serde_with_macros v3.8.1
  Downloaded num-traits v0.2.19
  Downloaded prettyplease v0.2.20
  Downloaded darling_core v0.20.9
  Downloaded num-bigint v0.4.5
  Downloaded serde_with v3.8.1
  Downloaded chrono v0.4.38
  Downloaded petgraph v0.6.5
  Downloaded cargo-component-core v0.13.1
  Downloaded 29 crates (1.9 MB) in 2.07s
   Compiling proc-macro2 v1.0.84
   Compiling unicode-ident v1.0.12
   Compiling libc v0.2.155
   Compiling cfg-if v1.0.0
   Compiling version_check v0.9.4
   Compiling autocfg v1.3.0
   Compiling serde v1.0.203
   Compiling once_cell v1.19.0
   Compiling typenum v1.17.0
   Compiling zeroize v1.8.1
   Compiling anyhow v1.0.86
   Compiling generic-array v0.14.7
   Compiling pin-project-lite v0.2.14
   Compiling ahash v0.8.11
   Compiling memchr v2.7.2
   Compiling quote v1.0.36
   Compiling syn v2.0.66
   Compiling zerocopy v0.7.34
   Compiling futures-core v0.3.30
   Compiling const-oid v0.9.6
   Compiling equivalent v1.0.1
   Compiling subtle v2.5.0
   Compiling bitflags v2.5.0
   Compiling num-traits v0.2.19
   Compiling regex-syntax v0.8.3
   Compiling either v1.12.0
   Compiling bytes v1.6.0
   Compiling hashbrown v0.14.5
   Compiling getrandom v0.2.15
   Compiling rand_core v0.6.4
   Compiling crypto-common v0.1.6
   Compiling block-buffer v0.10.4
   Compiling indexmap v2.2.6
   Compiling fnv v1.0.7
   Compiling itoa v1.0.11
   Compiling digest v0.10.7
   Compiling itertools v0.12.1
   Compiling thiserror v1.0.61
   Compiling rustix v0.38.34
   Compiling smallvec v1.13.2
   Compiling slab v0.4.9
   Compiling futures-io v0.3.30
   Compiling aho-corasick v1.1.3
   Compiling log v0.4.21
   Compiling futures-sink v0.3.30
   Compiling semver v1.0.23
   Compiling ryu v1.0.18
   Compiling beef v0.5.2
   Compiling lock_api v0.4.12
   Compiling parking_lot_core v0.9.10
   Compiling base64ct v1.6.0
   Compiling cpufeatures v0.2.12
   Compiling leb128 v0.2.5
   Compiling crossbeam-utils v0.8.20
   Compiling scopeguard v1.2.0
   Compiling pem-rfc7468 v0.7.0
   Compiling regex-automata v0.4.6
   Compiling der v0.7.9
   Compiling futures-channel v0.3.30
   Compiling heck v0.5.0
   Compiling linux-raw-sys v0.4.14
   Compiling prettyplease v0.2.20
   Compiling futures-task v0.3.30
   Compiling pin-utils v0.1.0
   Compiling parking_lot v0.12.3
   Compiling serde_derive v1.0.203
   Compiling prost-derive v0.12.6
   Compiling thiserror-impl v1.0.61
   Compiling prost v0.12.6
   Compiling regex v1.10.4
   Compiling futures-macro v0.3.30
   Compiling prost-types v0.12.6
   Compiling tokio-macros v2.2.0
   Compiling spki v0.7.3
   Compiling futures-util v0.3.30
   Compiling hmac v0.12.1
   Compiling socket2 v0.5.7
   Compiling signal-hook-registry v1.4.2
   Compiling num_cpus v1.16.0
   Compiling mio v0.8.11
   Compiling regex-syntax v0.6.29
   Compiling fastrand v2.1.0
   Compiling lazy_static v1.4.0
   Compiling fixedbitset v0.4.2
   Compiling syn v1.0.109
   Compiling serde_json v1.0.117
   Compiling atomic-waker v1.1.2
   Compiling petgraph v0.6.5
   Compiling tempfile v3.10.1
   Compiling logos-codegen v0.14.0
   Compiling logos-codegen v0.13.0
   Compiling tokio v1.37.0
   Compiling concurrent-queue v2.5.0
   Compiling pkcs8 v0.10.2
   Compiling miette-derive v7.2.0
   Compiling ff v0.13.0
   Compiling itertools v0.11.0
   Compiling cc v1.0.98
   Compiling vcpkg v0.2.15
   Compiling multimap v0.10.0
   Compiling parking v2.2.0
   Compiling unicode-width v0.1.12
   Compiling base16ct v0.2.0
   Compiling heck v0.4.1
   Compiling bitflags v1.3.2
   Compiling pkg-config v0.3.30
   Compiling sec1 v0.7.3
   Compiling pbjson-build v0.6.2
   Compiling miette v7.2.0
   Compiling openssl-sys v0.9.102
   Compiling prost-build v0.12.6
   Compiling group v0.13.0
   Compiling logos-derive v0.13.0
   Compiling logos-derive v0.14.0
   Compiling tracing-attributes v0.1.27
   Compiling sha2 v0.10.8
   Compiling crypto-bigint v0.5.5
   Compiling tracing-core v0.1.32
   Compiling toml_datetime v0.6.6
   Compiling static_assertions v1.1.0
   Compiling winnow v0.5.40
   Compiling hex v0.4.3
   Compiling tracing v0.1.40
   Compiling elliptic-curve v0.13.8
   Compiling logos v0.14.0
   Compiling logos v0.13.0
error: failed to run custom build command for `openssl-sys v0.9.102`

Caused by:
  process didn't exit successfully: `/tmp/cargo-installAxu3If/release/build/openssl-sys-a78b80b196f7f265/build-script-main` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
  AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
  AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
  AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_DIR
  OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=OPENSSL_STATIC
  cargo:rerun-if-env-changed=OPENSSL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
  cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  run pkg_config fail: 
  pkg-config exited with status code 1
  > PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags openssl

  The system library `openssl` required by crate `openssl-sys` was not found.
  The file `openssl.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `openssl.pc`.

  --- stderr
  thread 'main' panicked at /home/rppi4/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.102/build/find_normal.rs:190:5:

  Could not find directory of OpenSSL installation, and this `-sys` crate cannot
  proceed without this knowledge. If OpenSSL is installed and this crate had
  trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
  compilation process.

  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

  If you're in a situation where you think the directory *should* be found
  automatically, please open a bug at https://github.com/sfackler/rust-openssl
  and include information about your system as well as this message.

  $HOST = aarch64-unknown-linux-gnu
  $TARGET = aarch64-unknown-linux-gnu
  openssl-sys = 0.9.102

  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-component v0.13.1`, intermediate artifacts can be found at `/tmp/cargo-installAxu3If`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
ERROR Cargo errored! ExitStatus(unix_wait_status(25856))
ERROR Fatal error:
  x For crate cargo-component: subprocess /home/rppi4/.rustup/toolchains/
  | stable-aarch64-unknown-linux-gnu/bin/cargo install cargo-component
  | --version 0.13.1 errored with exit status: 101
  `-> subprocess /home/rppi4/.rustup/toolchains/stable-aarch64-unknown-linux-
      gnu/bin/cargo install cargo-component --version 0.13.1 errored with exit
      status: 101
calvinrp commented 3 months ago

@siashish It looks like it failed to fetch the binary from GitHub. To skip all this, maybe download the binary and put into your PATH somewhere. cargo-component-aarch64-unknown-linux-gnu from the latest release