AztecProtocol / aztec-packages

Apache License 2.0
185 stars 186 forks source link

Enable Cross Compilation for Baretenberg C++ Project #5945

Open Okm165 opened 5 months ago

Okm165 commented 5 months ago

Description:

Question:

How can we achieve cross-compilation for a Barretenberg C++ project? Our aim is to achieve mobile compatibility. What steps should we take to configure CMake and the build environment for cross-compilation from x86 to aarch64? Additionally, how can we change the triple to something like "aarch64-apple-ios" for compilation and linking with Rust? Is Baretenberg currently capable of being compiled for a specific triple (cpu-vendor-os)?

Details:

This issue is created to seek guidance and assistance from the community in achieving cross-compilation for the Baretenberg project. Any insights, suggestions, or contributions are highly appreciated.

ludamad commented 5 months ago

Hi there! This is not something we currently are looking into as we are not yet looking to target mobile, sorry

Savio-Sou commented 5 months ago

@Okm165 could you elaborate on what were the issues using WASM on iOS? 🤔

Okm165 commented 5 months ago

@Savio-Sou Ios is blocking usage of wasm in native apps (it is security issue), it is research from IOS developer back some time ago. Wasm is working well in Safari web browser only.

Savio-Sou commented 5 months ago

Thanks, I'll let others chime in but I suspect cross-compiling could be very non-trivial work.

If it's not blocking sticking to WASM is what's usually recommended.

michaelelliot commented 5 months ago

@ludamad @Savio-Sou Using WASM for proving with Barretenberg on iPhone/iOS is currently a no-go. The WASM runtimes available for iOS—I've tried both Wasmer and Wasm3—do not support all the features required by Barretenberg. This limitation was the main reason behind starting Swoir/noir_rs.

ludamad commented 5 months ago

Thanks for the context. There is barretenberg/cpp/cmake/toolchains that presumably would get an ios file. At the moment we just have not looked into this too much, happy to help look at trouble on the way but don't have much more than general web resources e.g. for targeting IOS and linking with Rust