MacOS 下安裝 flutter 遇到的一個依賴問題
最近在 MacOSX 上安裝 flutter 也遇到一些問題。不是 MacOS Mojave 的問題,而是 flutter 依賴的一個開源庫,它的依賴樹出現版本不相容問題。
執行flutter doctor
出現如下提示。
[!] iOS toolchain - develop for iOS devices (Xcode 10.0)
✗ libimobiledevice and ideviceinstaller are not installed. To install, run:
brew install –HEAD libimobiledevice
brew install ideviceinstaller
✗ ios-deploy not installed. To install:
brew install ios-deploy
✗ CocoaPods/">CocoaPods not installed.
CocoaPods is used to retrieve the iOS platform side’s plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, seeofollow,noindex">https://flutter.io/platform-plugins
To install:
brew install cocoapods
pod setup
按照提示,執行brew install --HEAD libimobiledevice
出現如下提示。
checking for libusbmuxd >= 1.1.0… no
configure: error: Package requirements (libusbmuxd >= 1.1.0) were not met:
Requested ‘libusbmuxd >= 1.1.0’ but version of libusbmuxd is 1.0.10
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables libusbmuxd_CFLAGS
and libusbmuxd_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
READ THIS:https://docs.brew.sh/Troubleshooting
brew 發現 usbmuxd 這個庫最高版本就是 1.0.10,github 上最新 release 版本也是 1.0.10。壓根兒就沒有 1.1.0 這個版本存在。
不過細看,發現 usbmuxd 這個庫的最新版本,就是這個 1.0.10 是 2014 年釋出的,算是老古董了。
所以安裝 usbmuxd 的 head 版本試試。
brew unlink usbmuxd# 否則會 reinstall 失敗 brew reinstall --HEAD usbmuxd# 直接從 github 的 master HEAD 安裝 brew install --HEAD libimobiledevice
然後,就成了。囧rz…
依賴樹的問題,萬一遇到,還是得手動一個一個解決。沒辦法。
一個結論就是,要用brew install —HEAD
,就要忍受 nightly 的不穩定,這是必然付出的代價。flutter 現在還是 beta 版本,依賴 nightly 的開源庫也情有可原。遇到問題,就自己擼起手解決吧。