-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zcash_client_sqlite
: Figure out how to build SQLite in a way that is compatible with Rust, or require downstreams to do so
#800
Comments
On a desktop, libgcc (strictly, libgcc_s.so.1) is typically dynamically linked. It is one of the few libraries we dynamically link to in zcashd, despite statically linking most of the dependencies. |
I agree, we shouldn't do that. The system On the other hand, the description of the
The plight of a beleaguered dev who upgrades |
Ah, the If we figure out what |
We ended up solving this in the Android SDK with a build script, much the same way as others have: https://github.com/Electric-Coin-Company/zcash-android-wallet-sdk/blob/88058c63461f2808efc953af70db726b9f36f9b9/backend-lib/build.rs |
Reopening because even with the above fix, we might still want to enable downstreams to control whether SQLite is bundled or not. |
This workaround came from zcash/librustzcash#800 (comment)
This workaround came from zcash/librustzcash#800 (comment)
This workaround came from zcash/librustzcash#800 (comment) Build android binaries with the NDK
This workaround came from zcash/librustzcash#800 (comment) Build android binaries with the NDK
The ECC wallet team opened mozilla/rust-android-gradle#105 because they were having issues using
rust-android-gradle
with the Android emulator onx86_64
machines. My subsequent investigation (mozilla/rust-android-gradle#105 (comment) and below) indicates that this is actually an incompatibility between SQLite and Rust:long double
to preserve as much precision as possible in various places, primarily ASCII-to-float andprintf
. This causes it to depend on compiler builtins using 80-bit or 128-bit floats where support is available.double
, so does not implement a bunch of "standard" compiler builtins related to them.This problem went unnoticed on Android for a long time because:
libgcc
is linked for unwinding purposes, and it happens to provides these compiler builtin symbols, so there were no linker problems.libgcc
is absent, but Rust for some reason provides the needed symbols foraarch64-linux-android
targets.We currently use SQLite via the
rusqlite
crate'sbundled
flag, which automatically compiles and bundles SQLite using whatever C compiler thecc
toolchain picks up. Technically we shouldn't do this here; it should be up to the user ofzcash_client_sqlite
to choose how it links SQLite. In any case, the current setup means that the C compiler assumes these symbols will be available, but Rust doesn't provide them. On desktop I assume we just get the symbols from the C compiler itself, but on Android they came from the NDK which no longer provides them.We need to figure out how to set up
rusqlite
to build SQLite in such a way that the necessary symbols are always provided. This may mean removing thebundled
feature flag and pushing the problem onto downstream users, that have the necessary context to better solve the issue.The text was updated successfully, but these errors were encountered: