hyperledger / solang

Solidity Compiler for Solana and Polkadot
https://solang.readthedocs.io/
Apache License 2.0
1.22k stars 207 forks source link

'lld/Common/Driver.h' file not found #908

Open ascjones opened 2 years ago

ascjones commented 2 years ago

Cannot build directly from cargo build or cargo install because of this missing header file: https://github.com/hyperledger-labs/solang/blob/c046e64db8890d0db83d65cbfd2bb0918b7ffd1e/src/linker/linker.cpp#L2

Looking at the docker image it seems this header file might be coming from the llvm13.0/bin folder copied here https://github.com/hyperledger-labs/solang/blob/main/.github/Dockerfile#L36?

Anyway it would be nice to have this listed as a prerequisite or automatically resolved as part of the build somehow.

seanyoung commented 2 years ago

lld/Common/Driver.h is the header file for the llvm linker, lld, which solang uses as a library.

seanyoung commented 2 years ago

It would be nice if we could somehow build llvm (including lld) automatically when you run cargo build. I haven't seen any way of doing this. Maybe https://crates.io/crates/llvmenv?

ascjones commented 2 years ago

lld/Common/Driver.h is the header file for the llvm linker, lld, which solang uses as a library.

Yes of course, but it is assumed that it exists on the search path.

It would be nice if we could somehow build llvm (including lld) automatically when you run cargo build. I haven't seen any way of doing this. Maybe https://crates.io/crates/llvmenv?

I've actually tried running this but it doesn't seem to solve the issue of having this header file on the search path?

extraymond commented 1 year ago

Sometimes it's from a old cache from sccache(or cachepot), try unsetting and do a cargo clean works for me.

xermicus commented 1 year ago

We should check that the right LLVM version is available in build.rs and report that back to the user. I think this would avoid confusion.

spino17 commented 2 weeks ago

Having to run this command while building LLVM worked for me: cmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=lld -DCMAKE_INSTALL_PREFIX=$HOME/llvm-15.0.7. Along with building LLVM, LLD is also build.