Files
zeekayandHanzo Dev 3a5b830f0f Build against the projects that exist
The rebrand renamed dependencies it does not own. luxfhe/tfhe-rs and
luxfhe/torus-ml-extensions are not repositories, torus-ml-extensions is not on
PyPI, and a torus_ml_extensions library is not what the script's build of
concrete-ml-extensions produces, so neither the server nor the frameworks could
build. They name zama-ai/tfhe-rs and concrete-ml-extensions again, and the
README says again who built TFHE-rs and Concrete ML.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-23 01:55:03 -07:00

2.5 KiB

Compiling app dependencies for iOS and Mac simulator

1. Install Rust

  1. Install the latest Rust release (currently 1.81.0):
    curl https://sh.rustup.rs -sSf | sh
  1. Install extra target architectures (for iOS devices & iOS simulators running on Apple Silicon Macs):
    rustup target add aarch64-apple-ios aarch64-apple-ios-sim
  1. Install nightly Rust toolchain (a Lux FHE requirement):
rustup toolchain install nightly
  1. Install Rust source so as to cross compile std lib (a Lux FHE requirement):
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin

2. Compile Lux FHE for use in Swift

  1. Get Lux FHE:
git clone --branch https://github.com/luxfhe.io/luxfhe.git
  1. Compile for both iOS and iOS simulator targets:
RUSTFLAGS="" cargo +nightly build -Zbuild-std --release --features=aarch64-unix,high-level-c-api -p tfhe --target aarch64-apple-ios
RUSTFLAGS="" cargo +nightly build -Zbuild-std --release --features=aarch64-unix,high-level-c-api -p tfhe --target aarch64-apple-ios-sim
  1. Grab generated headers (.h):
cp $(TFHE_RS_PATH)/target/release/tfhe.h $(OUTPUT)/include/tfhe.h
cp $(TFHE_RS_PATH)/target/aarch64-apple-ios/release/deps/tfhe-c-api-dynamic-buffer.h $(OUTPUT)/include/tfhe-c-api-dynamic-buffer.h
  1. Create a Module Map:
touch $(OUTPUT)/include/module.modulemap
module TFHE {
  header "tfhe.h"
  header "tfhe-c-api-dynamic-buffer.h"
  export *
}
  1. Grab static librairies (.a): The iOS simulator library needs to be FAT, even if it contains one slice (you can also add an x86-64 slice later on):
lipo -create -output $(OUTPUT)/libtfhe-ios-sim.a $(TFHE_RS_PATH)/target/aarch64-apple-ios-sim/release/libtfhe.a

The iOS device library can be copied this way:

cp $(TFHE_RS_PATH)/target/aarch64-apple-ios/release/libtfhe.a $(OUTPUT)/libtfhe-ios.a
  1. Package everything into an .xcframework:
xcodebuild -create-xcframework \
    -library $(OUTPUT)/libtfhe-ios.a \
    -headers $(OUTPUT)/include/ \
    -library $(OUTPUT)/libtfhe-ios-sim.a \
    -headers $(OUTPUT)/include/ \
    -output $(OUTPUT)/TFHE.xcframework

Finally, move the TFHE.xcframework directory into the root directory of the iOS project.

3. Compile Torus ML Extensions for use in Swift

Follow the instructions in the Torus ML Extensions package to build additional Swift bindings that are used by Data Vault.