Attempt to get libp2p-rs working on iOS.
This project is in "hacking" mode at the moment. The goal is to get libp2p-rs to compile for iOS so can be used in an iOS application.
What things you need to install the software and how to install them
TODO
-
Install the common build tools like C compiler and linker. On macOS, get Xcode, and install the command line tools.
xcode-select --install
-
Download rustup. We will use this to setup Rust for cross-compiling.
curl https://sh.rustup.rs -sSf | sh
-
Download targets for iOS
# iOS. Note: you need *all* five targets rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios
-
Install cargo-lipo to generate the iOS universal library.
cargo install cargo-lipo
-
Build the library.
# iOS cargo lipo --release
-
Build the Xcode project. - TODO
cd examples/ios xcodebuild -configuration Release -scheme RustChat | xcpretty cd ../..
When you create an Xcode project yourself, note the following points:
- Add the C header
rust_chat.h
to allow using the Rust functions from C. - Copy
target/universal/release/lib???.a
to the project. You may need to modifyLIBRARY_SEARCH_PATHS
to include the folder of the*.a
file. - Note that
cargo-lipo
does not generate bitcode yet. You must setENABLE_BITCODE
toNO
. (See also http://stackoverflow.com/a/38488617) - You need to link to
libresolv.tbd
.
- Add the C header
Pull Requests welcome, but must be under the same license.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Chris Bruce - Initial work - Chris Bruce
This project is licensed under the MIT License - see the LICENSE.md file for details