'cargo build-bpf fails on ubuntu

rustc --version = rustc 1.60.0 (7737e0b5c 2022-04-04)

solana --version = solana-cli 1.10.8 (src:623ac656; feat:1122441720)

npm --version = 8.5.1

node --version = v12.22.9

os: ubuntu 22.04 lts

after i run: "npm run build:program-rust" i am getting this error.

/home/[user]/.rustup/toolchains/bpf/bin/cargo: error while loading shared libraries:libssl.so.1.1: cannot open shared object file: No such file or directory

same problem with anchor.enter image description here

i have located libssl0.1.1 there will it help me?enter image description here



Solution 1:[1]

Even though you have the shared object on your system, cargo build-bpf is probably not finding it since it isn't in a standard path. You can try the solutions at How to I tell Rust where to look for a static library? to tell the linker where to find the library.

Solution 2:[2]

yes, cargo wasn't in a standard path. and fixed everything by reinstalling Linux. it was Ubuntu for testing. actually moved to Debian reinstalled packages and working properly.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jon C
Solution 2 g.georgecccc