【问题标题】:Failed to build iOS app (Xcode Version 9.4.1 (9F2000), Flutter 0.5.1)无法构建 iOS 应用程序(Xcode 版本 9.4.1 (9F2000),Flutter 0.5.1)
【发布时间】:2018-12-14 14:06:28
【问题描述】:

这是一个试驾示例“https://flutter.io/get-started/test-drive/#terminal” 我遇到以下错误,请评论如何解决此问题。

Xcode's output:
↳
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    clang-3.5: error: unknown argument: '-gmodules'
    clang-3.5: error: unknown argument: '-fbuild-session-file=/Users/nelson/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation'
    clang-3.5: error: no such file or directory: '/Users/nelson/Library/Developer/Xcode/DerivedData/Runner-ctvpprsqskddfxbtqtsepwpaebqm/Index/DataStore'
    clang-3.5: error: option '-fmodules-validate-once-per-build-session' requires '-fbuild-session-timestamp=<seconds since Epoch>'
    Command /usr/local/bin/clang-omp failed with exit code 1
    clang-3.5: error: unknown argument: '-gmodules'
    clang-3.5: error: unknown argument: '-fbuild-session-file=/Users/nelson/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation'
    clang-3.5: error: no such file or directory: '/Users/nelson/Library/Developer/Xcode/DerivedData/Runner-ctvpprsqskddfxbtqtsepwpaebqm/Index/DataStore'
    clang-3.5: error: option '-fmodules-validate-once-per-build-session' requires '-fbuild-session-timestamp=<seconds since Epoch>'
    Command /usr/local/bin/clang-omp failed with exit code 1
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    error: the following command failed with exit code 1 but produced no further output
    CompileC /Users/nelson/Library/Developer/Xcode/DerivedData/Runner-ctvpprsqskddfxbtqtsepwpaebqm/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner_vers.o /Users/nelson/Library/Developer/Xcode/DerivedData/Runner-ctvpprsqskddfxbtqtsepwpaebqm/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/DerivedSources/Runner_vers.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
    clang-3.5: error: unknown argument: '-gmodules'
    clang-3.5: error: unknown argument: '-fbuild-session-file=/Users/nelson/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation'
    clang-3.5: error: no such file or directory: '/Users/nelson/Library/Developer/Xcode/DerivedData/Runner-ctvpprsqskddfxbtqtsepwpaebqm/Index/DataStore'
    clang-3.5: error: option '-fmodules-validate-once-per-build-session' requires '-fbuild-session-timestamp=<seconds since Epoch>'
    Command /usr/local/bin/clang-omp failed with exit code 1
    clang-3.5: error: unknown argument: '-gmodules'
    clang-3.5: error: unknown argument: '-fbuild-session-file=/Users/nelson/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation'
    clang-3.5: error: no such file or directory: '/Users/nelson/Library/Developer/Xcode/DerivedData/Runner-ctvpprsqskddfxbtqtsepwpaebqm/Index/DataStore'
    clang-3.5: error: option '-fmodules-validate-once-per-build-session' requires '-fbuild-session-timestamp=<seconds since Epoch>'
    Command /usr/local/bin/clang-omp failed with exit code 1
Could not build the application for the simulator.
Error launching application on iPhone 7 Plus.

【问题讨论】:

    标签: xcode dart flutter


    【解决方案1】:

    我已将问题解决如下:

    如果你仔细看问题,它触发了一个过时的clang 3.5版本,我卸载了一个过时的版本并安装了一个新的。

    1. 从 os x 中移除 clang-omp

      $ brew uninstall clang-omp
      
    2. 卸载clang-omp后,需要更新到最新版本的flutter安装程序。实际上,我之前更新过,但我又做了一次。

      $ flutter upgrade
      
    3. 我尝试再次运行flutter,但无法编译。它缺少 clang-omp

      $ flutter run    
      === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
          error: can't exec '/usr/local/bin/clang-omp' (No such file or directory)
          Command /usr/local/bin/clang-omp failed with exit code 71
          error: can't exec '/usr/local/bin/clang-omp' (No such file or directory)
          Command /usr/local/bin/clang-omp failed with exit code 71
      
    4. 因为它在编译期间需要更新版本的 clang。我安装了llvm

      $ brew install llvm
      
    5. 并相应地更新 PATH。

      echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bash_profile
      
    6. 再次编译应用,编译成功。

      $ flutter run
      Launching lib/main.dart on iPhone 7 Plus in debug mode...
      Starting Xcode build...                                          
      ├─Assembling Flutter resources...                    1.1s
      └─Compiling, linking and signing...                  8.6s
      Xcode build done.                                           11.3s
      Syncing files to device iPhone 7 Plus...                     3.9s
      
      ?  To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
      An Observatory debugger and profiler on iPhone 7 Plus is available at: http://127.0.0.1:8100/
      For a more detailed help message, press "h". To quit, press "q".
      
      Initializing hot reload...                                       
      Reloaded 0 of 391 libraries in 486ms. 
      

    【讨论】:

      猜你喜欢
      • 2023-01-03
      • 1970-01-01
      • 2021-03-27
      • 2014-08-07
      • 2015-09-03
      • 2015-04-06
      • 2018-10-24
      • 2018-09-01
      • 2021-09-21
      相关资源
      最近更新 更多