hyperledger / solang

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

Unable to build solang #1654

Closed spino17 closed 2 weeks ago

spino17 commented 2 weeks ago

I am following the docs: https://solang.readthedocs.io/en/v0.3.3/installing.html#step-1-install-the-llvm-libraries. I have set the solang-llvm to the PATH. I am getting the below error while cargo build


    --> src/emit/binary.rs:1247:5
     |
1247 |     include_bytes!("../../target/bpf/stdlib.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/bpf/bigint.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1248:5
     |
1248 |     include_bytes!("../../target/bpf/bigint.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/bpf/format.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1249:5
     |
1249 |     include_bytes!("../../target/bpf/format.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/bpf/solana.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1250:5
     |
1250 |     include_bytes!("../../target/bpf/solana.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/bpf/ripemd160.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1251:5
     |
1251 |     include_bytes!("../../target/bpf/ripemd160.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/bpf/heap.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1252:5
     |
1252 |     include_bytes!("../../target/bpf/heap.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/wasm/stdlib.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1256:5
     |
1256 |     include_bytes!("../../target/wasm/stdlib.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/wasm/heap.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1257:5
     |
1257 |     include_bytes!("../../target/wasm/heap.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/wasm/bigint.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1258:5
     |
1258 |     include_bytes!("../../target/wasm/bigint.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/wasm/format.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1259:5
     |
1259 |     include_bytes!("../../target/wasm/format.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/wasm/ripemd160.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1262:30
     |
1262 | static RIPEMD160_IR: &[u8] = include_bytes!("../../target/wasm/ripemd160.bc");
     |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)```
seanyoung commented 2 weeks ago

Please stop opening new issues, re-open existing ones if you really need to.

What is the output of clang --version? It should be:

$ clang --version
clang version 15.0.4 (https://github.com/solana-labs/llvm-project.git 33c3629caa59b59d8f585736a4a5194aa9e9377d)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/sean/build/llvm15.0/bin/.
spino17 commented 2 weeks ago

Thanks @seanyoung for the reply. I am really sorry to make the new issue, I didn't know that I can reopen a closed issue, won't happen again. The output of clang --version is:

Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

which is not same as above output. Let me know if there is more information needed. Thanks again for the help.

salaheldinsoliman commented 2 weeks ago

@spino17 As mentioned in prior issues, you should use the solana llvm-fork and add it to path. please use the latest binary from: https://github.com/hyperledger/solang-llvm/releases

spino17 commented 2 weeks ago

@salaheldinsoliman yeah I used that also, it is not working. Also I am not understanding how setting llvm to solang fork would fill up target directory whose error is coming.

seanyoung commented 2 weeks ago

You need to add the custom llvm build to your path. See here how to do that: https://superuser.com/questions/697496/how-do-i-add-a-path-to-my-mac-os-x

spino17 commented 2 weeks ago

yes, I have set the LLVM fork to the PATH and able to check it from llvm-config --version. Still I am getting below error:


    --> src/emit/binary.rs:1299:5
     |
1299 |     include_bytes!("../../target/bpf/stdlib.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/bpf/bigint.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1300:5
     |
1300 |     include_bytes!("../../target/bpf/bigint.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/bpf/format.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1301:5
     |
1301 |     include_bytes!("../../target/bpf/format.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/bpf/solana.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1302:5
     |
1302 |     include_bytes!("../../target/bpf/solana.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/bpf/ripemd160.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1303:5
     |
1303 |     include_bytes!("../../target/bpf/ripemd160.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/bpf/heap.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1304:5
     |
1304 |     include_bytes!("../../target/bpf/heap.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/wasm/stdlib.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1308:5
     |
1308 |     include_bytes!("../../target/wasm/stdlib.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/wasm/heap.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1309:5
     |
1309 |     include_bytes!("../../target/wasm/heap.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/wasm/bigint.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1310:5
     |
1310 |     include_bytes!("../../target/wasm/bigint.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/wasm/format.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1311:5
     |
1311 |     include_bytes!("../../target/wasm/format.bc"),
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read src/emit/../../target/wasm/ripemd160.bc: No such file or directory (os error 2)
    --> src/emit/binary.rs:1314:30
     |
1314 | static RIPEMD160_IR: &[u8] = include_bytes!("../../target/wasm/ripemd160.bc");
     |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `solang` (lib) due to 11 previous errors```