Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpf-tools/llvm/bin/ld.lld: not found when build c-project #21085

Closed
workivan opened this issue Oct 30, 2021 · 11 comments
Closed

bpf-tools/llvm/bin/ld.lld: not found when build c-project #21085

workivan opened this issue Oct 30, 2021 · 11 comments

Comments

@workivan
Copy link

Problem

I am trying to build a c-project on Ubuntu 18.04 according to the instructions on the website, but I get an error

[lld] build/main.so ()
/home/ivan/.local/share/solana/solana-release/bin/sdk/bpf/c/bpf.mk:214: recipe for target 'build/main.so' failed
/bin/sh: 1: /home/ivan/.local/share/solana/solana-release/bin/sdk/bpf/c/../dependencies/bpf-tools/llvm/bin/ld.lld: not found
at the same time, the installation was completed successfully and rust was installed too

Proposed Solution

my attempts to install llvm, clang and lld were successful but it did not become a solution and the error did not change

my make file
OUT_DIR := build
include ~/.local/share/solana/solana-release/bin/sdk/bpf/c/bpf.mk
Can you help me ?

@dmakarov
Copy link
Contributor

Can you change the include line in your makefile to

include ~/.local/share/solana/install/active_release/bin/sdk/bpf/c/bpf.mk

and try to build your project again?

@workivan
Copy link
Author

workivan commented Nov 1, 2021

@dmakarov, no, changing to the path you suggested leads to the same error

I tried to build solana from sources on two ubuntu machines: on one failed when compiling the 858th package, and on the second (on a clean one) during compilation of the 830th package with the same error

error: linking with cc failed: exit status:

I won't post the full stacktrace - it's huge

= note: collect2: fatal error: ld terminated with signal 9 [Killed] compilation terminated.
error: could not compile solana-watchtower due to previous error

trying to rebuild didn't help at all :(
maybe I didn't install some dependencies not listed in the README.txt ?

@dmakarov
Copy link
Contributor

dmakarov commented Nov 1, 2021

Is the machine you're building on a virtual machine? How much RAM does it have? ld terminated with signal 9 [Killed] compilation terminated. usually means that linker ran out of memory.

@workivan
Copy link
Author

workivan commented Nov 1, 2021

@dmakarov 8 gb ((

@dmakarov
Copy link
Contributor

dmakarov commented Nov 1, 2021

At least you don't see the error that ld.lld is not found anymore? Maybe you can try to set the environment variable
CARGO_BUILD_JOBS=1 and see if that helps. With this setting the build will be slower, but there will be only one job running at a time and 8G may be sufficient.

@workivan
Copy link
Author

workivan commented Nov 1, 2021

@dmakarov, unfortunately, this did not become a solution ((
I want to add that RAM is not loaded during compilation of all packages except the latest ones

error that ld.lld is not found I still encounter

@workivan
Copy link
Author

workivan commented Nov 5, 2021

@dmakarov, good evening
I tried to repeat the installation on windows: 1) successfully installed rust 2) installing solana using the tool also completed without errors, but the deps file is empty again
and the attempt to run cargo-build-bpf ends as follows

Solana Rust BPF toolchain is not available on Windows

Can you tell me now, maybe this output is more understandable than the previous error ?
waiting for your reply

@dmakarov
Copy link
Contributor

dmakarov commented Nov 5, 2021

Solana is not supported to run natively on Windows. Normally people use Windows Subsystem for Linux to run Solana or develop for Solana on Windows. Recently @joncinque made significant efforts to enable the Solana BPF toolchain to run natively on Windows. However it looks like cargo-build-bpf still does not work on Windows. The error that you're seeing is issued here

println!("Solana Rust BPF toolchain is not available on Windows");

which means that cargo-build-bpf is not supposed to be run on Windows.

@joncinque should we remove this check

if cfg!(windows) {
println!("Solana Rust BPF toolchain is not available on Windows");
exit(1);
}

and let corgo-build-bpf run natively on Windows?

@joncinque
Copy link
Contributor

I have to update #20276 and get that working, then we can certainly have this working for windows!

@workivan
Copy link
Author

workivan commented Nov 6, 2021

thank you all for your help, in the end it turned out to solve the problem using the prebuilt version on pure ubuntu 20.04

@workivan workivan closed this as completed Nov 6, 2021
@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any activity in past 7 days after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants