ZcashFoundation / zcash_script

Rust bindings to the ECC's zcash_script C++ library.
Apache License 2.0
1 stars 11 forks source link

Use clang's libc++ to be consistent with zcashd #85

Open teor2345 opened 1 year ago

teor2345 commented 1 year ago

Motivation

I notice you're linking with -lstdc++, i.e. libstdc++, whereas zcashd uses libc++. I'm not sure that matters if you're recompiling the script code, just thought I'd point it out.

_Originally posted by @daira in https://github.com/ZcashFoundation/zcash_script/issues/84#issuecomment-1528911034_

Currently zcash_script links with the default C++ library for the current platform, using the link-cplusplus crate.

Specifications

Since Zcash script behaviour is unspecified, we should try to match zcashd's behaviour as much as possible. But the C++ library is unlikely to change consensus-critical behaviour.

Background

Zebra already links with libstdc++ (gcc) via RocksDB on Linux. librocksdb-sys has its own custom logic for choosing the default C++ library for each platform.

Zebra also uses libclang as a build dependency, which depends on libc++ (clang).

We might get better optimisations and smaller binaries by preferring the clang compiler and using its libc++ library. However, this could also make Zebra builds harder to configure on some platforms.