Issue w/ solana tools suite

I am trying to run anchor build and have an issue with llvm-objcopy not being executed, I am using WSL 1: Ubuntu

More about the issue -

BPF SDK: /home/sk1122/.local/share/solana/install/releases/1.9.2/solana-release/bin/sdk/bpf cargo-build-bpf child: rustup toolchain list -v cargo-build-bpf child: cargo +bpf build --target bpfel-unknown-unknown --release Finished release [optimized] target(s) in 3.92s cargo-build-bpf child: /home/sk1122/.local/share/solana/install/releases/1.9.2/solana-release/bin/sdk/bpf/scripts/ /mnt/c/Users/ASUS/OneDrive/Desktop/Code/blockchain/solana_app/target/bpfel-unknown-unknown/release/ /mnt/c/Users/ASUS/OneDrive/Desktop/Code/blockchain/solana_app/target/deploy/ /home/sk1122/.local/share/solana/install/releases/1.9.2/solana-release/bin/sdk/bpf/scripts/ line 23: /home/sk1122/.local/share/solana/install/releases/1.9.2/solana-release/bin/sdk/bpf/dependencies/bpf-tools/llvm/bin/llvm-objcopy: cannot execute binary file: Exec format error

I am running the default anchor code which comes with a new project, nothing fancy there.

Using Solana 1.9.2 ( updated Solana yesterday to check if it fixes the issue :frowning: )


used 1.8.11 also and still not working :frowning:

It sounds like this might be related to WSL. Are you sure that you are in the WSL command prompt before you run anchor build?

Yeah I am on WSL and tried both on 1 and 2

Try running this command, it should output “ELF” which may insert itself right before your command prompt when you run it:

head -c 4 /home/sk1122/.local/share/solana/install/releases/1.9.2/solana-release/bin/sdk/bpf/dependencies/bpf-tools/llvm/bin/llvm-objcopy

Thanks, It worked but I have a problem with rust which I can solve, thanks

Hello, I think I am running into a similar issue trying to run example-helloworld on WSL 2 Ubuntu.

When I run npm run build:program-rust, everything seems to work, but then I get the error:

> $ npm run build:program-rust
   Compiling solana-bpf-helloworld v0.0.1 (/home/oman/dev/example-helloworld/src/program-rust)
    Finished release [optimized] target(s) in 19.61s
cargo-build-bpf child: /home/oman/.local/share/solana/install/releases/1.9.3/solana-release/bin/sdk/bpf/scripts/ /home/oman/dev/example-helloworld/src/program-rust/target/bpfel-unknown-unknown/release/ /home/oman/dev/example-helloworld/dist/program/
+ ./bpf-tools/rust/bin/rustc --version
+ ./bpf-tools/rust/bin/rustc --print sysroot
+ set +e
+ rustup toolchain uninstall bpf
info: uninstalling toolchain 'bpf'
info: toolchain 'bpf' uninstalled
+ set -e
+ rustup toolchain link bpf bpf-tools/rust
+ exit 0
/home/oman/.local/share/solana/install/releases/1.9.3/solana-release/bin/sdk/bpf/scripts/ line 23: /home/oman/.local/share/solana/install/releases/1.9.3/solana-release/bin/sdk/bpf/dependencies/bpf-tools/llvm/bin/llvm-objcopy: cannot execute binary file: Exec format error
npm ERR! errno 1
npm ERR! helloworld@0.0.1 build:program-rust: `cargo build-bpf --manifest-path=./src/program-rust/Cargo.toml --bpf-out-dir=dist/program`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the helloworld@0.0.1 build:program-rust script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/oman/.npm/_logs/2022-01-29T05_42_06_909Z-debug.log

I tried running the head command you suggest above, but I got no output:

> $ head -c 4 /home/oman/.local/share/solana/install/releases/1.9.3/solana-release/bin/sdk/bpf/dependencies/bpf-tools/llvm/bin/llvm-objcopy

I also tried solana 1.9.4 and 1.9.5

HI @evan.oman and welcome to the forum! :wave:

That’s kind of strange, it seems like maybe the installation is corrupted somehow. You might be able to run solana-install update and see if that helps.