Storm
Storm

Reputation: 4465

Irritating Linker warnings when building flutter apps for macOS/iOS on macOS

ash ~ >flutter build macos

Running pod install...                                             20.1s
ld: warning: ignoring duplicate libraries: '-lc++'
ld: warning: ignoring duplicate libraries: '-lc++'
ld: warning: reexported library with install name '/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis' found at '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/SpeechSynthesis.framework/Versions/A/SpeechSynthesis.tbd' couldn't be matched with any parent library and will be linked directly 

and other similar "duplicate library" & "reexported library" warnings have been irritating me for a week now (lol), I've tried searching and asking co-pilot, Gemeni, meta ai & grok for answers, none of them have been able to either.

They all say go to xCode project settings and do this and that in the build phases and then/either in build options and other linker settings and this and that and I followed and tried everything, but I cannot seem to make these warnings disappear.

However, very strangely when I execute the command with the verbose option on, everything is logged normally, and the warnings go away 🤔.

so "flutter build macos -vv" 
or "flutter build macos --verbose"

run smoothly to the end without any warnings!

I tried searching on google and bing, etc. I've tried asking copilot, Gemeni, Meta AI & Grok for solutions.

I expected it to be solved by now !

It's not yet solved.

Upvotes: 0

Views: 329

Answers (1)

Akbar Khan
Akbar Khan

Reputation: 408

The Linker warnings you're encountering when building Flutter apps for macOS/iOS often arise from duplicate libraries or re-exported libraries within your project or its dependencies. While these warnings might not directly affect your app's functionality, they can clutter the build output and make it harder to identify critical issues.

Adjusting Other Linker Flags in VS Code

Right click on ios folder and choose "Open in Xcode." In Xcode, navigate to your project settings, go to "Build Settings," and search for "Other Linker Flags." Remove any duplicate flags like -lc++. Save the changes in Xcode, hope this will resolve your issue.

Upvotes: 1

Related Questions