Xcode 15 update broke flutter iOS app: duplicate symbols (no symbols listed)

I am working on a flutter app for iOS, using Mac mini with Apple M1.

The app worked fine on the simulator and real device until yesterday, when I updated Xcode to 15.0 (Due to the Sonoma 14.0 update).

Now, I cannot run on a simulator or a real device, getting the following error:

Could not build the precompiled application for the device.
Error (Xcode): 2 duplicate symbols

Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)


Error launching application on XXXXXX’s iPhone.

Instead of the above error, I sometimes (randomly?) get the error described here.

What I tried:

  1. Verified with Flutter Doctor everything is OK (initially, the Xcode installation did not complete, missing the command line tools, but I fixed that)
  2. Upgraded flutter (3.13.6)
  3. Updated cocoa pods (1.13.0), (as instructed here, this fixed an earlier error I was getting DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR instead)
  4. Cleared the Xcode build and derived data, deleted flutter sub-folders & files (.symlinks, Pods, Podfile.lock, pubspec.lock) and reinstalled pod (as instructed here), and ran flutter clean
  5. Checked that Pods-Runner-frameworks has source="$(readlink -f "${source}")"

Unfortunately, none of these resolved the error described above.

Any help or ideas would be most welcomed!

Hey :) Did you solve your problem? Having same troubles here.

i updated the package, and moved from stable to beta flutter channel. Mine was not working on stable channel after upgrading my Xcode, but beta seems to work fine!

I fixed it using the old linker and changing a little bit the Build Phases:

  • under "Other Linker Flags" inside "Project" add "-ld64" (with double quotes too!)
  • in "Runner" under "Targets" inside "Build Phases" move the "Embed Frameworks" and "Embed App Extensions" above "Thin Binary".

It's a workaround but I'm waiting for a real solution from Apple in order to use the new ld-prime linker inside XCode 15.

If someone else has an alternative solution please post it ;)

I encountered the same issue and here is how I was able to solve the issue

In order to solve this you can either manually search for the folder and replace all instance with TOOLCHAIN_DIR or you can write a pod script to automatically do the change every time you do pod install.

installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(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

then I encountered this second Bug after running the command below

cd ios
rm podfile.lock
pod deintegrate
pod install --repo-update

here is how I was able to resolve this

I had to add another post integrate script to solve that

post_integrate do |installer|
  compiler_flags_key = 'COMPILER_FLAGS'
  project_path = 'Pods/Pods.xcodeproj'

  project = Xcodeproj::Project.open(project_path)
  project.targets.each do |target|
    target.build_phases.each do |build_phase|
      if build_phase.is_a?(Xcodeproj::Project::Object::PBXSourcesBuildPhase)
        build_phase.files.each do |file|
          if !file.settings.nil? && file.settings.key?(compiler_flags_key)
            compiler_flags = file.settings[compiler_flags_key]
            file.settings[compiler_flags_key] = compiler_flags.gsub(/-DOS_OBJECT_USE_OBJC=0\s*/, '')
          end
        end
      end
    end
  end
  project.save()
end

Happy Coding

I fixed all my Xcode 15 issues with flutter by going into [System Settings -> General -> Storage -> Developer -> & Delete the XCode Cache]

I fixed all my Xcode 15 issues with flutter by going into [System Settings -> General -> Storage -> Developer -> & Delete the XCode Cache]

Hey i have the same type of error :

Could not build the precompiled application for the device.
Error (Xcode): Undefined symbols:


Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)



Error launching application on iPhone

I have try everything above and still not working, if any one have a solution it would help me a lot 🙏🏻

Same issue, any ideas that work? The above suggestions didn't work for me.



Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)


Could not build the application for the simulator.
Error launching application on iPhone 15 Pro Max.```

Undefined symbols:

Linker command failed with exit code 1 (use -v to see invocation)

Same issue, any solution?

It worked for me. Thank you @BensiBjarna

Xcode 15 update broke flutter iOS app: duplicate symbols (no symbols listed)
 
 
Q