Quantcast
Channel: Active questions tagged rustc - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 37

I am getting a compile error: target not supported when trying to compile Solana hello world smart contract

$
0
0

So I'm trying to compile my first Solana smart contract. It's this hello world smart contract:

https://github.com/solana-labs/example-helloworld

Here is my rustc and cargo version:

candid@DESKTOP-5D7VSM9:~/example-helloworld/src/program-rust$ rustc --versionrustc 1.77.2 (25ef9e3d8 2024-04-09)candid@DESKTOP-5D7VSM9:~/example-helloworld/src/program-rust$ cargo --versioncargo 1.77.2 (e52e36006 2024-03-26)

But here's what happens when I try to compile it:

candid@DESKTOP-5D7VSM9:~/example-helloworld$ npm run build:program-rust> helloworld@0.0.1 build:program-rust> cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program   Compiling proc-macro2 v1.0.81   Compiling unicode-ident v1.0.12   Compiling serde v1.0.198   Compiling version_check v0.9.4   Compiling typenum v1.17.0   Compiling cfg-if v1.0.0   Compiling syn v1.0.109   Compiling crunchy v0.2.2   Compiling semver v1.0.22   Compiling subtle v2.4.1   Compiling crossbeam-utils v0.8.19   Compiling getrandom v0.1.16   Compiling libc v0.2.153   Compiling generic-array v0.14.7   Compiling wasm-bindgen-shared v0.2.92   Compiling rustc_version v0.4.0   Compiling rand_core v0.5.1   Compiling rayon-core v1.12.1   Compiling quote v1.0.36   Compiling syn v2.0.60   Compiling crossbeam-epoch v0.9.18   Compiling ahash v0.7.8   Compiling getrandom v0.2.14error: target is not supported, for more information see: https://docs.rs/getrandom/#unsupported-targets   --> src/lib.rs:357:9    |357 | /         compile_error!("target is not supported, for more information see: \358 | |                         https://docs.rs/getrandom/#unsupported-targets");    | |________________________________________________________________________^error[E0433]: failed to resolve: use of undeclared crate or module `imp`   --> src/lib.rs:408:9    |408 |         imp::getrandom_inner(dest)?;    |         ^^^ use of undeclared crate or module `imp`For more information about this error, try `rustc --explain E0433`.error: could not compile `getrandom` (lib) due to 2 previous errorswarning: build failed, waiting for other jobs to finish...Error: Function _ZN15crossbeam_epoch5guard5Guard5flush17h1d1abe609d5edef4E Stack offset of 4112 exceeded max offset of 4096 by 16 bytes, please minimize large stack variablesError: Function _ZN15crossbeam_epoch8internal6Global7collect17h6342580b0a7115e4E Stack offset of 4152 exceeded max offset of 4096 by 56 bytes, please minimize large stack variablesError: Function _ZN15crossbeam_epoch8internal5Local5defer17h479e1780ab35f17aE Stack offset of 4176 exceeded max offset of 4096 by 80 bytes, please minimize large stack variablesError: Function _ZN15crossbeam_epoch8internal5Local8finalize17h1aa606e306161c72E Stack offset of 4104 exceeded max offset of 4096 by 8 bytes, please minimize large stack variables

I am doing this on WSL2 Ubuntu. The build process is failing because some functions in the crossbeam-epoch crate are using more stack space than is allowed for the target platform.

Any ideas on how to fix this? This is a smart contract I am attempting to build from Solana's own "start building" guides on their official site.


Viewing all articles
Browse latest Browse all 37

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>