Skip to content

Adding non-iOS targets to Xcode project fails to build: Flutter not found #54680

@jmagman

Description

@jmagman

Reproduction steps:

$ flutter create test_build_configuration
$ cd test_build_configuration
$ open ios/Runner.xcworkspace 

In Xcode:
File > New > Target > watchOS > Intents Extension > Any name > Activate
Add development team
Build new extension scheme

Ld /Users/m/Library/Developer/Xcode/DerivedData/Runner-gqrdmqfcslfkfmftjruzfuvvhszh/Build/Intermediates.noindex/Runner.build/Debug-watchos/Anything.build/Objects-normal/armv7k/Binary/Anything normal armv7k (in target 'Anything' from project 'Runner')
    cd /Users/m/Projects/test_build_configuration/ios
    /Users/m/Applications/Xcode-11-4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target armv7k-apple-watchos6.2 -isysroot /Users/m/Applications/Xcode-11-4.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS6.2.sdk -L/Users/m/Library/Developer/Xcode/DerivedData/Runner-gqrdmqfcslfkfmftjruzfuvvhszh/Build/Products/Debug-watchos -F/Users/m/Library/Developer/Xcode/DerivedData/Runner-gqrdmqfcslfkfmftjruzfuvvhszh/Build/Products/Debug-watchos -filelist /Users/m/Library/Developer/Xcode/DerivedData/Runner-gqrdmqfcslfkfmftjruzfuvvhszh/Build/Intermediates.noindex/Runner.build/Debug-watchos/Anything.build/Objects-normal/armv7k/Anything.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/../../Frameworks -Xlinker -rpath -Xlinker @executable_path/../../../../Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/m/Library/Developer/Xcode/DerivedData/Runner-gqrdmqfcslfkfmftjruzfuvvhszh/Build/Intermediates.noindex/Runner.build/Debug-watchos/Anything.build/Objects-normal/armv7k/Anything_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fembed-bitcode-marker -fobjc-arc -fobjc-link-runtime -fapplication-extension -framework Flutter -e _NSExtensionMain -Xlinker -dependency_info -Xlinker /Users/m/Library/Developer/Xcode/DerivedData/Runner-gqrdmqfcslfkfmftjruzfuvvhszh/Build/Intermediates.noindex/Runner.build/Debug-watchos/Anything.build/Objects-normal/armv7k/Anything_dependency_info.dat -o /Users/m/Library/Developer/Xcode/DerivedData/Runner-gqrdmqfcslfkfmftjruzfuvvhszh/Build/Intermediates.noindex/Runner.build/Debug-watchos/Anything.build/Objects-normal/armv7k/Binary/Anything

ld: framework not found Flutter
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Additionally, adding a non-Flutter target may succeed, but still incorrectly links on Flutter.

@tauu analysis:

The problems seems to be that the watch and watch extension targets inherit the linker flags from "ios/Flutter/Generated.xcconfig", which sets OTHER_LDFLAGS=$(inherited) -framework Flutter. Consequently the link fails, because these targets do not contain the flutter framework. Currently it is fixed by setting OTHER_LDFLAGS="" for the watch and watch extension targets, though it would be more convenient if this manual adjustment is not necessary. As this setting seems to be a side effect of fixing #50568 , do you have some insight if this setting could be limited to the Runner target?

The Runner project should not set a base configuration since the generated Flutter build settings (particularly linker flags) should not pollute other targets. The Runner target (and any test targets) should use the base configuration.

Screen Shot 2020-04-13 at 11 55 21 AM
should instead be:
Screen Shot 2020-04-13 at 11 57 12 AM

Metadata

Metadata

Assignees

No one assigned

    Labels

    t: xcode"xcodebuild" on iOS and general Xcode project managementtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions