tonlib-rs icon indicating copy to clipboard operation
tonlib-rs copied to clipboard

CAN NOT compile on MacOS m2

Open oneforalone opened this issue 10 months ago • 5 comments

I'm just testing wether the lib with Jetton, however, it failed when compiling, got an error:

  ld: warning: ignoring duplicate libraries: 'libton_crypto_core.a'
  + cc -O2 -fno-builtin -fPIC -Wall -Wextra -Werror -c /Users/yuki/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tonlib-sys-2024.1.0/ton/third-party/blst/src/server.c
  In file included from /Users/yuki/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tonlib-sys-2024.1.0/ton/third-party/blst/src/server.c:7:
  In file included from /Users/yuki/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tonlib-sys-2024.1.0/ton/third-party/blst/src/keygen.c:7:
  In file included from /Users/yuki/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tonlib-sys-2024.1.0/ton/third-party/blst/src/consts.h:8:
  /Users/yuki/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tonlib-sys-2024.1.0/ton/third-party/blst/src/vect.h:402:11: fatal error: 'stdlib.h' file not found
  # include <stdlib.h>
            ^~~~~~~~~~
  1 error generated.
  make[3]: *** [third-party/blst/libblst.a] Error 1
  make[2]: *** [CMakeFiles/blst.dir/all] Error 2
  make[1]: *** [tonlib/CMakeFiles/tonlibjson.dir/rule] Error 2
  make: *** [tonlibjson] Error 2
  thread 'main' panicked at /Users/yuki/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5:

  command did not execute successfully, got: exit status: 2

Seems the third-party dependency can not found stdlib.h file, while I can compile properly with a hello C codes with stdlib.h. What am i missing? Any ideas about this issue?

Here is my rust codes:

use anyhow::Result;
use tonlib::{address::TonAddress, client::TonClient, contract::TonContractFactory};

#[tokio::main]
async fn main() -> Result<()> {
    let client = TonClient::builder().build().await?;
    let contract_factory = TonContractFactory::builder(&client).build().await?;
    let bnp_addr = TonAddress::from_str("EQABTYTyiVjpvfusZeCpmMj9x1llcJLpW_oKyd8QzcPsq5Es")?;
    let bjetton_master_contract = contract_factory.get_contract(&bnp_addr);
    let jetton_data = bjetton_master_contract.get_jetton_data().await?;

    eprintln!("{:?}", jetton_data);

    Ok(())
}

oneforalone avatar Apr 11 '24 04:04 oneforalone