hyperledger / solang

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

Target files missing while building #1652

Closed spino17 closed 3 weeks ago

spino17 commented 3 weeks ago

Some target files are missing while building solang-0.3.3 on macos.

Steps to reproduce the behavior:

  1. Build LLVM-LLD: cmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=lld -DCMAKE_INSTALL_PREFIX=$HOME/llvm-15.0.7
  2. install: cmake --build . --target install
  3. set $HOME/llvm-15.0.7/bin to PATH
  4. run cargo build from top-level directory
  5. output of solang --version: 0.3.3
  6. I am getting below error:
    
    error: couldn't read src/emit/../../target/bpf/stdlib.bc: No such file or directory (os error 2)
    --> 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)

I checked the `../../target/wasm` directory and it is empty.
salaheldinsoliman commented 3 weeks ago

1- you should use the solana's llvm-fork: https://github.com/hyperledger/solang-llvm. 2- you should cd into stdlib, and run make. 3- run cargo clean and re-build.

spino17 commented 3 weeks ago

hey @salaheldinsoliman, thanks for the steps. While running make in stdlib directory, I am getting below error:


error: unknown target triple 'sbf', please use -triple or -arch
make: *** [../target/bpf/solana.bc] Error 1```