Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS Sonoma] Builds failing with error: DT_TOOLCHAIN_DIR cannot be used to evaluate LD_RUNPATH_SEARCH_PATHS, use TOOLCHAIN_DIR instead #131527

Closed
cbracken opened this issue Jul 28, 2023 · 11 comments
Labels
a: desktop Running on desktop P2 Important issues not at the top of the work list platform-mac Building on or for macOS specifically team-desktop Owned by Desktop platforms team tool Affects the "flutter" command-line tool. See also t: labels. triaged-desktop Triaged by Desktop platforms team

Comments

@cbracken
Copy link
Member

cbracken commented Jul 28, 2023

When building macOS Flutter apps on macOS 14 (Sonoma), a build failure occurs during the Cocoapods phase, with the following error output:

error: DT_TOOLCHAIN_DIR cannot be used to evaluate LD_RUNPATH_SEARCH_PATHS, use TOOLCHAIN_DIR instead (in target 'Runner' from project 'Runner')
error: DT_TOOLCHAIN_DIR cannot be used to evaluate LD_RUNPATH_SEARCH_PATHS, use TOOLCHAIN_DIR instead (in target 'Pods-Runner' from project 'Pods')
error: DT_TOOLCHAIN_DIR cannot be used to evaluate LD_RUNPATH_SEARCH_PATHS, use TOOLCHAIN_DIR instead (in target 'Flutter Assemble' from project 'Runner')
error: DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR instead (in target 'Flutter Assemble' from project 'Runner')
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
** BUILD FAILED **

Doctor output

Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel master, 3.13.0-12.0.pre.17, on macOS 14.0 23A5301g darwin-arm64, locale ja-JP)
    ! Upstream repository git@github.com:cbracken/flutter.git is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to git@github.com:cbracken/flutter.git to dismiss this error.
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[✓] Connected device (1 available)
[✓] Network resources

! Doctor found issues in 4 categories.
@cbracken cbracken added tool Affects the "flutter" command-line tool. See also t: labels. platform-mac Building on or for macOS specifically a: desktop Running on desktop P2 Important issues not at the top of the work list triaged-desktop Triaged by Desktop platforms team fyi-tool For the attention of Flutter Tool team labels Jul 28, 2023
@cbracken
Copy link
Member Author

Filing this issue just for searchability, the underlying issue is a CocoaPods issue:
CocoaPods/CocoaPods#12012

Fix for the issue is out here:
CocoaPods/CocoaPods#12009

@cbracken cbracken reopened this Jul 28, 2023
@cbracken
Copy link
Member Author

On our end, once this lands in CocoaPods, we may need to bump our minimum CocoaPods version.

@flutter-triage-bot flutter-triage-bot bot removed the triaged-desktop Triaged by Desktop platforms team label Jul 29, 2023
@flutter-triage-bot
Copy link

The triaged-desktop label is irrelevant if there is no team-desktop label or fyi-desktop label.

@cbracken cbracken added team-desktop Owned by Desktop platforms team triaged-desktop Triaged by Desktop platforms team labels Jul 29, 2023
@cbracken
Copy link
Member Author

cbracken commented Aug 1, 2023

Looks like the fix has been merged on the CocoaPods end. We'll probably want to wait for a release to be published before closing this. (relevant comment)

@christopherfujino christopherfujino added the triaged-tool Triaged by Flutter Tool team label Aug 1, 2023
@flutter-triage-bot flutter-triage-bot bot removed fyi-tool For the attention of Flutter Tool team triaged-tool Triaged by Flutter Tool team labels Aug 1, 2023
@jpmckearin
Copy link

@cbracken For anyone that comes after me, update your Podfile under ios or macos such that

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

becomes

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end 

  installer.aggregate_targets.each do |target|
    target.xcconfigs.each do |variant, xcconfig|
      xcconfig_path = target.client_root + target.xcconfig_relative_path(variant)
      IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
    end 
  end
  
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if config.base_configuration_reference.is_a? Xcodeproj::Project::Object::PBXFileReference
        xcconfig_path = config.base_configuration_reference.real_path
        IO.write(xcconfig_path, IO.read(xcconfig_path).gsub("DT_TOOLCHAIN_DIR", "TOOLCHAIN_DIR"))
      end
    end
  end
end

Tested and working with

  • Flutter (Channel stable, 3.13.0, on macOS 13.5.1 22G90 darwin-arm64, locale en-US)
    • Flutter version 3.13.0 on channel stable at /opt/homebrew/Caskroom/flutter/3.13.0/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision efbf63d (7 days ago), 2023-08-15 21:05:06 -0500
    • Engine revision 1ac611c64e
    • Dart version 3.1.0
    • DevTools version 2.25.0
  • Xcode - develop for iOS and macOS (Xcode 15.0)
    • Xcode at /Applications/Xcode-beta.app/Contents/Developer
    • Build 15A5229h
    • CocoaPods version 1.12.1

@SpaceQ-Z
Copy link

You Can Change Xcode CommandLine Version

@cbracken
Copy link
Member Author

cbracken commented Aug 29, 2023

Individual users can do this temporarily, but ideally we'll want to wait until CocoaPods releases. This is a CocoaPods issue that we shouldn't be forcing our users to workaround. Keeping open until they release a new version though.

It seems likely we'll need to update our flutter doctor check to suggest updating CocoaPods when that happens. /cc @christopherfujino

@vashworth
Copy link
Contributor

vashworth commented Aug 29, 2023

@cbracken This should be fixed with #132803 - It's a workaround until Cocoapods fix is in an official release. Sorry for the duplicates, I should have searched existing issues first.

@vashworth
Copy link
Contributor

Looks like the fix has been merged on the CocoaPods end. We'll probably want to wait for a release to be published before closing this. (relevant comment)

Perhaps we should close this one in favor of #133584, which explains more clearly what has already been done and what still needs to be done?

@cbracken
Copy link
Member Author

Yep - let's do it!

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: desktop Running on desktop P2 Important issues not at the top of the work list platform-mac Building on or for macOS specifically team-desktop Owned by Desktop platforms team tool Affects the "flutter" command-line tool. See also t: labels. triaged-desktop Triaged by Desktop platforms team
Projects
None yet
Development

No branches or pull requests

5 participants