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.
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.
Motivation
_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 thelink-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 onlibc++
(clang).We might get better optimisations and smaller binaries by preferring the
clang
compiler and using itslibc++
library. However, this could also make Zebra builds harder to configure on some platforms.