Open anudit opened 4 months ago
Hey! For now, this has only been optimised for arm64-v8a
(i.e. aarch64-linux-android
target) on Android. It's used by the most recent Android phones, hence the choice to focus on this one first. The build configuration needs to be changed to support armeabi-v7a
, so for now it will fail to build for this target. However, the number of devices using armeabi-v7a
(i.e. armv7-linux-androideabi
) is non-negligible so support will be added soon. Other architectures can be safely ignored.
As for iOS, only the architecture used by devices is supported at the moment, i.e. aarch64-apple-ios
target, and not the one for the simulator, which is the one used in your case. Not entirely sure if it's worth supporting it, it could facilitate development but it's not relevant for distribution.
Thanks for the details @madztheo ,
Could you point me to where I can make the changes in the build config to add support for armeabi-v7a
? x86
&x86_64
are probably negligible.
Also would love to be able to compile and test other parts of the app on the iOS emulator.
Happy to send a PR for it.
Thanks for the awesome work so far!
Sure! The building process is managed by build.rs
in bb_rs
which you can find here https://github.com/madztheo/aztec-packages/blob/v0.38.0/barretenberg/bb_rs/build.rs
It builds the Rust bindings to Barretenberg, which are then used by noir_rs
to generate and verify proofs with Noir. You'll see different configurations for different targets and can start to plug the ones you want. Make sure to start from the branch v0.38.0
which is the currently maintained one.
As a quickstart, you can add this line below the target_os
variable declaration:
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
It will be equal to aarch64
for the aarch64-linux-android
target and arm
for the armv7-linux-androideabi
target, this way you can differentiate the two.
@madztheo Started adding support for armv7-linux-androideabi
here https://github.com/madztheo/aztec-packages/pull/1.
Currently running into,
In file included from /Users/anudit/Documents/GitHub/aztec-packages/barretenberg/cpp/src/barretenberg/ecc/curves/bn254/../../fields/./field_impl.hpp:6:
In file included from /Users/anudit/Documents/GitHub/aztec-packages/barretenberg/cpp/src/barretenberg/numeric/random/engine.hpp:2:
/Users/anudit/Documents/GitHub/aztec-packages/barretenberg/cpp/src/barretenberg/numeric/random/../uint128/uint128.hpp:198:42: fatal error: __int128 is not supported on this target
__extension__ using uint128_t = unsigned __int128;
^
1 error generated
It looks like __int128
is not supported on 32-bits ARM architecture like the armv7-linux-androideabi
target. It's going to be a tricky one to fix
@madztheo Apparently you can use boost's multiprecision library to emulate GCC's __int128
on 32-bit systems.
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
Heyo @madztheo
I changed some things around and looks like aarch64-apple-ios-sim
is also working now.
I am running into some unsupported architecture errors on x86_64-apple-ios
though.
Hey, I am trying to run
madztheo/noir_rs
and compiling for archs likearmv7-linux-androideabi
but errors out atbb-rs
64bit compiles well for android.Minimal Repro: https://github.com/anudit/noir-single Android error logs: https://gist.github.com/anudit/1b5beb79dcff69d76fe30f2838b6c41a iOS error logs: https://gist.github.com/anudit/9ce131936dd8dac672a2a5f439d60899