sui icon indicating copy to clipboard operation
sui copied to clipboard

Sui failed to install in wsl2

Open manojkgorle opened this issue 2 years ago • 8 comments
trafficstars

When on wsl2 & trying to install sui, using the command cargo install --locked --git https://github.com/MystenLabs/sui.git --branch devnet sui

The following error is thrown

error: could not compile aws-sdk-ec2 (lib)

Caused by: process didn't exit successfully: /home/manojkgorle/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name aws_sdk_ec2 --edition=2021 /home/manojkgorle/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-sdk-ec2-0.29.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=120 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="rt-tokio"' --cfg 'feature="rustls"' -C metadata=089dbd1b8b69da53 -C extra-filename=-089dbd1b8b69da53 --out-dir /tmp/cargo-installvVec76/release/deps -C strip=debuginfo -L dependency=/tmp/cargo-installvVec76/release/deps --extern aws_credential_types=/tmp/cargo-installvVec76/release/deps/libaws_credential_types-43be701c521b6d61.rmeta --extern aws_http=/tmp/cargo-installvVec76/release/deps/libaws_http-00a4f077875a9b06.rmeta --extern aws_runtime=/tmp/cargo-installvVec76/release/deps/libaws_runtime-e114e97928c05b4c.rmeta --extern aws_smithy_async=/tmp/cargo-installvVec76/release/deps/libaws_smithy_async-f3e69175786dd72a.rmeta --extern aws_smithy_client=/tmp/cargo-installvVec76/release/deps/libaws_smithy_client-6afa975ee178dccc.rmeta --extern aws_smithy_http=/tmp/cargo-installvVec76/release/deps/libaws_smithy_http-4591e48b39931bb6.rmeta --extern aws_smithy_json=/tmp/cargo-installvVec76/release/deps/libaws_smithy_json-678f5536f8689f98.rmeta --extern aws_smithy_query=/tmp/cargo-installvVec76/release/deps/libaws_smithy_query-cdc56943e0eba00e.rmeta --extern aws_smithy_runtime=/tmp/cargo-installvVec76/release/deps/libaws_smithy_runtime-e22ff76de4f0667c.rmeta --extern aws_smithy_runtime_api=/tmp/cargo-installvVec76/release/deps/libaws_smithy_runtime_api-207fedf9235cb7f7.rmeta --extern aws_smithy_types=/tmp/cargo-installvVec76/release/deps/libaws_smithy_types-90ed9c59b09e0bf3.rmeta --extern aws_smithy_xml=/tmp/cargo-installvVec76/release/deps/libaws_smithy_xml-52f26da352c9d836.rmeta --extern aws_types=/tmp/cargo-installvVec76/release/deps/libaws_types-64df58427c53d7fb.rmeta --extern fastrand=/tmp/cargo-installvVec76/release/deps/libfastrand-f2d30a22006a81d5.rmeta --extern http=/tmp/cargo-installvVec76/release/deps/libhttp-d07dd6dbfb3b0725.rmeta --extern regex=/tmp/cargo-installvVec76/release/deps/libregex-0c67f262fe8699c5.rmeta --extern tokio_stream=/tmp/cargo-installvVec76/release/deps/libtokio_stream-1c5c5f640db0d197.rmeta --extern tracing=/tmp/cargo-installvVec76/release/deps/libtracing-e523f226b1b82bc0.rmeta --cap-lints allow -L native=/tmp/cargo-installvVec76/release/build/ring-b2125e3dc5e34eea/out (signal: 9, SIGKILL: kill) warning: build failed, waiting for other jobs to finish... error: failed to compile sui v1.12.0 (https://github.com/MystenLabs/sui.git?branch=devnet#1b5f809a), intermediate artifacts can be found at /tmp/cargo-installvVec76. To reuse those artifacts with a future compilation, set the environment variable CARGO_TARGET_DIR to that path.

Also followed https://github.com/MystenLabs/sui/issues/8322#issue-1586462644, but no use.

System Information

  • OS: windows 11
  • Compiler: terminal

manojkgorle avatar Oct 13 '23 17:10 manojkgorle

What rust version do you have?

stefan-mysten avatar Oct 13 '23 23:10 stefan-mysten

Here are the versions:

cargo 1.73.0 (9c4383fb5 2023-08-26) rustc 1.73.0 (cc66ad468 2023-10-03)

manojkgorle avatar Oct 14 '23 01:10 manojkgorle

Is this issue resolved? i try to install sui on ubuntu and got issue. How can I fix this?

ken-mgpt avatar Oct 27 '23 14:10 ken-mgpt

No.

manojkgorle avatar Oct 28 '23 06:10 manojkgorle

Summary

Your setup runs out of memory and the OOM-Killer is terminating the cargo build.

Some possible solutions:

  • In .wslconfig, increase the memory assigned to WSL.
  • In .wslconfig, reduce the number of processor.
  • When calling cargo, reduce the max number of parallel --jobs allowed.
  • Just don't build... instead download and install the Mysten Labs precompiled binaries (publish as assets at every release).

Alternatively, you can install the third party suibase ( https://github.com/chainmovers/suibase ) which simplify downloading, installing and updating the proper Mysten Labs precompiled binaries that match your setup.

More Details

You can confirm the intervention of the OOM-Killer by looking at the /var/log/syslog.

Search on Sui Discord where I (username "Mhax") did assist someone with that problem. I did publish an example where a cargo link job can take >4GB. If the number of processor is too high, then the number of parallel cargo jobs might add up to exceed the memory available. That user solved its problem by reducing the number of processor in .wslconfig

Solutions related to using the precompiled binaries (so no need to build) are a huge time saver.

mario4tier avatar Nov 06 '23 04:11 mario4tier

I have encountered your problem. You can try to make the swap space of wsl2 large enough (close other processes running on the computer). I think @mario4tier reply is great.

birchwork avatar Nov 30 '23 15:11 birchwork

@manojkgorle did u fix the issue ?

MentalistTR avatar Dec 04 '23 19:12 MentalistTR

I also failed to install in wsl2 Ubuntu at the beginning, and the solution to the final successful installation is to adjust the configuration of wsl. The.wslconfig configuration is as follows,

# Settings apply across all Linux distros running on WSL 2
[wsl2]

# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB
memory=4GB 

# Sets the VM to use two virtual processors
processors=4

# Specify a custom Linux kernel to use with your installed distros. The default kernel used can be found at https://github.com/microsoft/WSL2-Linux-Kernel
#kernel=D:\\Drivers\\WSL\\mykernel

# Sets additional kernel parameters, in this case enabling older Linux base images such as Centos 6
#kernelCommandLine = vsyscall=emulate

# Sets amount of swap storage space to 8GB, default is 25% of available RAM
swap=4GB

# Sets swapfile path location, default is %USERPROFILE%\AppData\Local\Temp\swap.vhdx
swapfile=D:\\Drivers\\WSL\\wsl-swap.vhdx

DerickIT avatar Dec 24 '23 15:12 DerickIT

the same problem, my cargo version is 1.76.0

Jiahiu avatar Feb 27 '24 12:02 Jiahiu

Hi @cccjjh,

did any of the workarounds from @DerickIT or @mario4tier work for you?

stefan-mysten avatar Feb 27 '24 16:02 stefan-mysten