按照官方文档一步步执行操作 docs.flutter.dev/get-started…
Step 1 下载Flutter SDK
storage.googleapis.com/flutter_inf…
Step 2 解压Flutter SDK
cd $your_flutter_develop_path
unzip $your_flutter_download_path/flutter_macos_3.3.8-stable.zip
Step 3 配置环境变量
echo PATH="$PATH:$your_flutter_develop_path/flutter/bin" > ~/.bash_profile
Step 4
flutter doctor 结果报以下错误。
dyld: lazy symbol binding failed: Symbol not found: _clock_gettime_nsec_np Referenced from: /usr/local/bin/dart (which was built for Mac OS X 10.13) Expected in: /usr/lib/libSystem.B.dylibdyld: Symbol not found: _clock_gettime_nsec_np Referenced from: /usr/local/bin/dart (which was built for Mac OS X 10.13) Expected in: /usr/lib/libSystem.B.dylib===== CRASH =====si_signo=Trace/BPT trap: 5(5), si_code=1, si_addr=0x7fff6a10d075version=2.18.4 (stable) (Tue Nov 1 15:15:07 2022 +0000) on "macos_x64"pid=3467, thread=4099, isolate_group=vm-service(0x7fea1a800000), isolate=vm-service(0x7fea1a805400)isolate_instructions=101531c00, vm_instructions=101531c00 pc 0x00007fff6a10d075 fp 0x0000700000202dd0 Unknown symbol pc 0x00007fff6a110094 fp 0x0000700000202df0 Unknown symbol pc 0x00007fff90237262 fp 0x0000700000203270 dyld_stub_binder+0x11a pc 0x0000000103653000 fp 0x0000700000203290 dart::Instruction::kInstructionAttrs+0x18670 pc 0x000000010183f45b fp 0x0000700000203930 dart::Compiler::CompileFunction(dart::Thread*, dart::Function const&)+0x36b pc 0x000000010183f1e8 fp 0x00007000002039c0 dart::Compiler::CompileFunction(dart::Thread*, dart::Function const&)+0xf8 pc 0x000000010169bff5 fp 0x0000700000203a20 dart::DartEntry::InvokeFunction(dart::Function const&, dart::Array const&, dart::Array const&, unsigned long)+0x95 pc 0x00000001017405d3 fp 0x0000700000203ac0 dart::Library::Invoke(dart::String const&, dart::Array const&, dart::Array const&, bool, bool) const+0x233 pc 0x0000000101c8b965 fp 0x0000700000203ba0 Dart_Invoke+0x5b5 pc 0x000000010162f26b fp 0x0000700000203bf0 dart::bin::DartUtils::PrepareBuiltinLibrary(_Dart_Handle*, _Dart_Handle*, bool, bool)+0x4b pc 0x000000010162f824 fp 0x0000700000203c50 dart::bin::DartUtils::PrepareForScriptLoading(bool, bool)+0x1d4 pc 0x0000000101507bd9 fp 0x0000700000203ca0 dart::bin::VmService::Setup(char const*, long, bool, bool, char const*, bool, bool, bool, bool)+0x49 pc 0x000000010150bb06 fp 0x0000700000203d60 dart::bin::main(int, char**)+0x1046 pc 0x00000001018142f4 fp 0x0000700000203df0 dart::ServiceIsolate::VisitObjectPointers(dart::ObjectPointerVisitor*)+0x94 pc 0x000000010182b337 fp 0x0000700000203e70 dart::ThreadPool::WorkerLoop(dart::ThreadPool::Worker*)+0x147 pc 0x000000010182b79e fp 0x0000700000203ea0 dart::ThreadPool::Worker::Main(unsigned long)+0x6e pc 0x000000010179601f fp 0x0000700000203ef0 dart::OSThread::GetMaxStackSize()+0xaf pc 0x00007fff8f5cc99d fp 0x0000700000203f10 _pthread_body+0x83 pc 0x00007fff8f5cc91a fp 0x0000700000203f50 _pthread_body+0x0 pc 0x00007fff8f5ca351 fp 0x0000700000203f78 thread_start+0xd-- End of DumpStackTrace
stackoverflow.com/questions/4…
很明显是mac系统的问题,并且我的mac电脑是老版本 也无法继续升级了,只好尝试其他办法。
本来以为Flutter 环境很好搞 但由于我环境老旧,上述EI CAPITAN系统兼容性的问题费了我至少两周周末的时间,期间分别按照Flutter 官方、Dart降级来规避,结果发现都无法解决问题。
-
Flutter官方
-
stackoverflow.com/questions/6… 这是一个stackover的问题 么有答案。
-
Dart降级
-
dartsim.github.io/install\_da… 尝试用源码编译 但不知道如何设置Dart sdk 和Flutter的关系 故放弃。
-
dart.dev/get-dart 尝试降级无果。
-
brew install --build-from-source dart 尝试本地由源码编译 也无效。
所以回到了原点,只能采取Flutter降级的方式来规避。尝试了3.1.0,2.10.5,1.22.6三个版本才最终ok。
降级的方法是
-
使用git clone的方式 使用flutter 可参考此篇文档 github.com/flutter/flu…
-
查找flutter工程的tag github.com/flutter/flu…
-
git fetch origin $yourtaggit checkout -b $yourbranchname $yourtag
TIPS:
- 不可描述问题
在中国的话,由于众所周知的原因,必须配置下源PUB_HOSTED_URL & FLUTTER_STORAGE_BASE_URL
具体地点可以从 flutter.cn/community/c… 最终我选用的清华大学源头
export PUB_HOSTED_URL=https://mirrors.tuna.tsinghua.edu.cn/dart-pub
$ export FLUTTER_STORAGE_BASE_URL=https://mirrors.tuna.tsinghua.edu.cn/flutter
- 环境描述
Mac OS系统 EI Capitan(10.11.6 (15G22010))