diff --git a/BUILD.md b/BUILD.md new file mode 100644 index 000000000..0a075641c --- /dev/null +++ b/BUILD.md @@ -0,0 +1,140 @@ +# Build Issues and Solutions + +## Prerequisites + +Check that you have **DashSync** repo next to the wallet repo. + +Make sure you're on the **master** branch for both DashSync and DashWallet. + +### Clang Version Check + +Check clang version: + +```bash +clang++ --version +``` + +If you see homebrew version, this might cause issues with building. You need to switch to system version. + +``` +❌ InstalledDir: /opt/homebrew/opt/llvm/bin +✅ InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin +``` + +To unplug homebrew version, comment out the following in `~/.zshrc` or `~/.zsh_profile` (or `~/.bashrc` if you're using bash): + +```bash +export PATH="/opt/homebrew/opt/llvm/bin:$PATH" +``` + +## Required Dependencies + +Install the following dependencies: + +- **cmake** (version 3.28.3 recommended) +- **cbindgen** +- **rust** + +> **Note:** cmake 4.0.0 or higher might cause issues with building. Version 3.28.3 is tested and works. +> +> Download from: https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-macos-universal.dmg + +### Installation Commands + +```bash +# Install CMake +sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install + +# Install cbindgen +brew install cbindgen + +# Install Rust +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +### Xcode Setup + +```bash +xcode-select --install +sudo xcodebuild -license accept +``` + +### Pod Installation + +Run from the wallet directory: + +```bash +pod install --verbose +``` + +## Potential Issues and Solutions + +### Issue 1: CBind Generation Error + +**Error:** +``` +Compiling rs-merk-verify-c-binding v0.1.3 (https://github.com/dashpay/rs-merk-verify-c-binding?branch=for-use-in-main-crate#930aeb2a) +error: failed to run custom build command for `dash-spv-coinjoin v0.1.0 (/Users/username/Development/dash-shared-core/dash-spv-coinjoin)` +``` + +**Solution:** Install cbindgen if not already installed: + +```bash +brew install cbindgen +``` + +--- + +### Issue 2: Git Repository Error with DAPI-GRPC + +**Error:** +``` +Installing DAPI-GRPC (0.22.0-dev.8) + > Git download + $ /usr/bin/git clone https://github.com/dashevo/dashsync-iOS.git + ... + fatal: not a git repository (or any of the parent directories): .git +``` + +**Solution:** Downgrade CocoaPods to version 1.15.2. This might require upgrading Ruby to version 3.3.0 or higher: + +```bash +# Install Ruby +brew install ruby + +# Install specific CocoaPods version +sudo gem install cocoapods -v 1.15.2 +``` + +**Alternative installation:** +```bash +sudo /opt/homebrew/opt/ruby/bin/gem install -n /usr/local/bin cocoapods -v 1.15.2 +``` + +--- + +### Issue 3: 'dash_shared_core.h' file not found + +**Problem:** dash-shared-core was not compiled properly due to various potential reasons. + +**Solution:** Check the build log for more details. Usually caused by missing dependencies (see above). + +## dash-shared-core Development + +If you want to make modifications to dash-shared-core, follow these steps: + +### Setup Steps + +1. **Place dash-shared-core in the correct location:** + Put dash-shared-core in the same directory as the wallet repo. + +2. **Remove DashSharedCore from DashSync.podspec:** + ```ruby + # s.dependency 'DashSharedCore', '0.5.1' + ``` + +3. **Add local dash-shared-core to Podfile:** + In the wallet or DashSync example Podfile, add: + ```ruby + pod 'DashSharedCore', :path => '../dash-shared-core/' + ``` \ No newline at end of file diff --git a/README.md b/README.md index 30878d33a..4f8da7ae1 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Open `DashWallet.xcworkspace` in Xcode and run the project. ## Requirements - Xcode 11 -- Dependency manager [CocoaPods](https://cocoapods.org). Install via `gem install cocoapods` +- Dependency manager [CocoaPods](https://cocoapods.org). Install via `gem install cocoapods -v 1.15.2` ### DashPay Requirements @@ -44,12 +44,10 @@ Currently, DashPay wallet is under active development so it requires a few addit 1. Clone [DashSync](https://github.com/dashevo/dashsync-iOS) and [dapi-grpc](https://github.com/dashevo/dapi-grpc) repositories: `git clone https://github.com/dashevo/dashsync-iOS.git DashSync` -`git clone https://github.com/dashevo/dapi-grpc.git dapi-grpc` To simplify developing process we use local podspec dependencies and it's important to preserve the following folder structure: ``` ../DashSync/ -../dapi-grpc/ ../dashwallet-ios/ ``` @@ -64,6 +62,8 @@ To simplify developing process we use local podspec dependencies and it's import 5. Run `pod install` in the wallet directory. +See [BUILD.md](BUILD.md) for more details. + ### Optional Requirements #### Objective-C Related