trustwallet / wallet-core

Cross-platform, cross-blockchain wallet library.
https://developer.trustwallet.com/wallet-core
Apache License 2.0
2.85k stars 1.6k forks source link

Hardcoded homebrew path can prevent iOS compilation #3695

Closed chokokatana closed 8 months ago

chokokatana commented 8 months ago

Script ./tools/ios-build fails when homebrew is not installed in a default location:

…
[protobuf_macOS] Compiling any.cc
[WalletCoreCommon_macOS] Compiling transaction_contents.pb.cc
[WalletCoreCommon_macOS] Compiling transaction_body.pb.cc
[WalletCoreCommon_macOS] Compiling timestamp.pb.cc
[WalletCoreCommon_macOS] Compiling duration.pb.cc
[WalletCoreCommon_macOS] Compiling crypto_transfer.pb.cc
[WalletCoreCommon_macOS] Compiling basic_types.pb.cc
[WalletCoreCommon_macOS] Compiling ZilliqaMessage.pb.cc
** ARCHIVE FAILED **

The following build commands failed:
    CompileC /Users/user/Library/Developer/Xcode/DerivedData/WalletCoreCommon-gokdhqvucebhjaaecczbxstrmxjx/Build/Intermediates.noindex/ArchiveIntermediates/WalletCoreCommon_macOS/IntermediateBuildFilesPath/WalletCoreCommon.build/Release/WalletCoreCommon_macOS.build/Objects-normal/x86_64/Witness.o …/swift/wallet-core/Nervos/Witness.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'WalletCoreCommon_macOS' from project 'WalletCoreCommon')
(1 failure)
[WalletCoreCommon_macOS] Compiling Zilliqa.pb.cc
[WalletCoreCommon_macOS] Compiling XAddress.cpp
[WalletCoreCommon_macOS] Compiling Witness.cpp
❌ …/swift/wallet-core/Nervos/../uint256.h:9:10: 'boost/lexical_cast.hpp' file not found
#include <boost/lexical_cast.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~
[WalletCoreCommon_macOS] Compiling WebAuthn.cpp
[WalletCoreCommon_macOS] Compiling Waves.pb.cc
[WalletCoreCommon_macOS] Compiling WalletV4R2.cpp
[WalletCoreCommon_macOS] Compiling WalletCoreCommon_vers.c
[WalletCoreCommon_macOS] Compiling WalletConnect.pb.cc
[WalletCoreCommon_macOS] Compiling Wallet.cpp
⚠️  …/swift/WalletCoreCommon.xcodeproj: DEFINES_MODULE was set, but no umbrella header could be found to generate the module map (in target 'WalletCoreCommon_macOS' from project 'WalletCoreCommon')

I noticed that swift/common-xcframework.yml and swift/project.yml include hardcoded homebrew paths for header search. After I added my current path to these files the ./tools/ios-build script worked without problem.

I also noticed there is a swift/cpp.xcconfig.in file that at some point gets transformed into a swift/cpp.xcconfig with the correct path to my homebrew installation. For some reason this file is not affecting the build.

satoshiotomakan commented 8 months ago

Hi @chokokatana, it makes sense to avoid using hardcoded homebrew paths, but at this moment we do not plan to rework this. Please feel free to open a PR to deliver the fix