DenisovAV / flutter_tv

230 stars 40 forks source link

linking error #30

Closed clintpurser closed 5 months ago

clintpurser commented 6 months ago

was messing around with the latest version and ran into this issue trying to build 🤔

ld: building for 'tvOS', but linking in dylib (/Users/clint/Documents/dev/flutter_tv/ios/Flutter/Flutter.framework/Flutter) built for 'tvOS-simulator'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ld /Users/clint/Library/Developer/Xcode/DerivedData/Runner-cpldbwykdgbgoebsaqwnpgqzdbib/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/appletvos/video_player_avfoundation.framework/video_player_avfoundation normal (in target 'video_player_avfoundation' from project 'Pods')
    cd /Users/clint/Documents/dev/flutter_tv/ios/Pods
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Xlinker -reproducible -target arm64-apple-tvos15.0 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS17.4.sdk -Os -L/Users/clint/Library/Developer/Xcode/DerivedData/Runner-cpldbwykdgbgoebsaqwnpgqzdbib/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/EagerLinkingTBDs/Release-appletvos -L/Users/clint/Library/Developer/Xcode/DerivedData/Runner-cpldbwykdgbgoebsaqwnpgqzdbib/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-appletvos/video_player_avfoundation -F/Users/clint/Library/Developer/Xcode/DerivedData/Runner-cpldbwykdgbgoebsaqwnpgqzdbib/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/EagerLinkingTBDs/Release-appletvos -F/Users/clint/Library/Developer/Xcode/DerivedData/Runner-cpldbwykdgbgoebsaqwnpgqzdbib/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-appletvos/video_player_avfoundation -F/Users/clint/Documents/dev/flutter_tv/ios/Flutter -filelist /Users/clint/Library/Developer/Xcode/DerivedData/Runner-cpldbwykdgbgoebsaqwnpgqzdbib/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-appletvos/video_player_avfoundation.build/Objects-normal/arm64/video_player_avfoundation.LinkFileList -install_name @rpath/video_player_avfoundation.framework/video_player_avfoundation -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/clint/Library/Developer/Xcode/DerivedData/Runner-cpldbwykdgbgoebsaqwnpgqzdbib/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-appletvos/video_player_avfoundation.build/Objects-normal/arm64/video_player_avfoundation_lto.o -fobjc-arc -fobjc-link-runtime -framework Flutter -framework Foundation -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/clint/Library/Developer/Xcode/DerivedData/Runner-cpldbwykdgbgoebsaqwnpgqzdbib/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-appletvos/video_player_avfoundation.build/Objects-normal/arm64/video_player_avfoundation_dependency_info.dat -o /Users/clint/Library/Developer/Xcode/DerivedData/Runner-cpldbwykdgbgoebsaqwnpgqzdbib/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/UninstalledProducts/appletvos/video_player_avfoundation.framework/video_player_avfoundation
Screenshot 2024-05-13 at 11 10 14 PM

not sure what to do here, was reading here on SO https://stackoverflow.com/questions/63607158/xcode-building-for-ios-simulator-but-linking-in-an-object-file-built-for-ios-f/64139830#64139830 and not sure if those are the right approaches, I haven't had success with them yet. going to look some more tomorrow. If you have any tips it would be much appreciated. Thanks!

DenisovAV commented 6 months ago

Interesing, did you try to clone new instance of repo from scratch? Everything works fine on my side

clintpurser commented 5 months ago

no luck with starting with a fresh clone from scratch. Perhaps I am doing something wrong, here is a screen cap of what I am doing.

https://github.com/DenisovAV/flutter_tv/assets/22106496/fa09ad85-9863-4a0b-947f-5d6660ca4612

also here is the output from running the script:

clint@Clints-Air flutter_tv % sh scripts/run_apple_tv.sh
+ ENGINE_TYPE=debug_sim_arm64
+ export FLUTTER_LOCAL_ENGINE=/Users/clint/Documents/dev/tv_engine
+ FLUTTER_LOCAL_ENGINE=/Users/clint/Documents/dev/tv_engine
+ '[' -d _ios ']'
+ fvm flutter clean
Cleaning Xcode workspace...                                      1,395ms
Cleaning Xcode workspace...                                      1,748ms
Deleting .dart_tool...                                               0ms
Deleting Generated.xcconfig...                                       0ms
Deleting flutter_export_environment.sh...                            0ms
Deleting ephemeral...                                                0ms
Deleting .flutter-plugins-dependencies...                            0ms
Deleting .flutter-plugins...                                         0ms

+ fvm flutter pub get
Resolving dependencies... 
  _fe_analyzer_shared 61.0.0 (68.0.0 available)
  analyzer 5.13.0 (6.5.0 available)
  args 2.4.0 (2.5.0 available)
  bloc 7.2.1 (8.1.4 available)
  build 2.3.1 (2.4.1 available)
  build_config 1.0.0 (1.1.1 available)
  checked_yaml 2.0.1 (2.0.3 available)
  crypto 3.0.2 (3.0.3 available)
! cupertino_icons 1.0.5 (overridden) (1.0.8 available)
  dart_style 2.3.2 (2.3.6 available)
  file 6.1.4 (7.0.0 available)
  flutter_bloc 7.3.3 (8.1.5 available)
  glob 2.1.1 (2.1.2 available)
  json_annotation 4.8.1 (4.9.0 available)
  json_serializable 6.7.1 (6.8.0 available)
  leak_tracker 10.0.0 (10.0.5 available)
  leak_tracker_flutter_testing 2.0.1 (3.0.5 available)
  leak_tracker_testing 2.0.1 (3.0.1 available)
  logging 1.1.1 (1.2.0 available)
  material_color_utilities 0.8.0 (0.11.1 available)
  meta 1.11.0 (1.15.0 available)
  provider 6.0.5 (6.1.2 available)
  pub_semver 2.1.3 (2.1.4 available)
  pubspec_parse 1.1.0 (1.2.3 available)
! shared_preferences_foundation 2.4.0 from git https://github.com/DenisovAV/flutter-tvos-packages.git at 6166fd in packages/shared_preferences/shared_preferences_foundation (overridden)
! shared_preferences_platform_interface 2.3.2 from git https://github.com/DenisovAV/flutter-tvos-packages.git at 6166fd in packages/shared_preferences/shared_preferences_platform_interface (overridden)
  source_gen 1.4.0 (1.5.0 available)
  test_api 0.6.1 (0.7.1 available)
  typed_data 1.3.1 (1.3.2 available)
! video_player_avfoundation 2.6.1 from git https://github.com/DenisovAV/flutter-tvos-packages.git at 6166fd in packages/video_player/video_player_avfoundation (overridden)
! video_player_platform_interface 6.2.2 from git https://github.com/DenisovAV/flutter-tvos-packages.git at 6166fd in packages/video_player/video_player_platform_interface (overridden)
  vm_service 13.0.0 (14.2.2 available)
  watcher 1.0.2 (1.1.0 available)
  yaml 3.1.1 (3.1.2 available)
Got dependencies!
30 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.

+ fvm flutter build ios --simulator
Building com.example.flutterTv for simulator (ios)...
Updating minimum iOS deployment target to 12.0.
Upgrading project.pbxproj
Upgrading AppFrameworkInfo.plist
Upgrading Podfile
Updating project for Xcode compatibility.
Upgrading project.pbxproj
Upgrading Runner.xcscheme
Running pod install...                                             635ms
Running Xcode build...                                                  
Xcode build done.                                            5.5s
Failed to build iOS app
Swift Compiler Error (Xcode): Unsupported platform.
/Users/clint/.pub-cache/git/flutter-tvos-packages-6166fd880015ebc0bc5489a38f63dc3492fff1c9/packages/shared_preferences/shar
ed_preferences_foundation/darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/messages.g.swift:13:9

Swift Compiler Error (Xcode): Cannot find type 'FlutterBinaryMessenger' in scope
/Users/clint/.pub-cache/git/flutter-tvos-packages-6166fd880015ebc0bc5489a38f63dc3492fff1c9/packages/shared_preferences/shar
ed_preferences_foundation/darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/messages.g.swift:53:37

Swift Compiler Error (Xcode): Cannot find type 'FlutterPluginRegistrar' in scope
/Users/clint/.pub-cache/git/flutter-tvos-packages-6166fd880015ebc0bc5489a38f63dc3492fff1c9/packages/shared_preferences/shar
ed_preferences_foundation/darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/SharedPreferencesPlugi
n.swift:13:46

Swift Compiler Error (Xcode): Cannot find type 'FlutterPlugin' in scope
/Users/clint/.pub-cache/git/flutter-tvos-packages-6166fd880015ebc0bc5489a38f63dc3492fff1c9/packages/shared_preferences/shar
ed_preferences_foundation/darwin/shared_preferences_foundation/Sources/shared_preferences_foundation/SharedPreferencesPlugi
n.swift:12:48

Encountered error while building for simulator.

+ sh scripts/switch_target.sh tvos
switching to 'tvos' 
+ cd ios
+ fvm flutter pub get
Resolving dependencies in ..... 
  _fe_analyzer_shared 61.0.0 (68.0.0 available)
  analyzer 5.13.0 (6.5.0 available)
  args 2.4.0 (2.5.0 available)
  bloc 7.2.1 (8.1.4 available)
  build 2.3.1 (2.4.1 available)
  build_config 1.0.0 (1.1.1 available)
  checked_yaml 2.0.1 (2.0.3 available)
  crypto 3.0.2 (3.0.3 available)
! cupertino_icons 1.0.5 (overridden) (1.0.8 available)
  dart_style 2.3.2 (2.3.6 available)
  file 6.1.4 (7.0.0 available)
  flutter_bloc 7.3.3 (8.1.5 available)
  glob 2.1.1 (2.1.2 available)
  json_annotation 4.8.1 (4.9.0 available)
  json_serializable 6.7.1 (6.8.0 available)
  leak_tracker 10.0.0 (10.0.5 available)
  leak_tracker_flutter_testing 2.0.1 (3.0.5 available)
  leak_tracker_testing 2.0.1 (3.0.1 available)
  logging 1.1.1 (1.2.0 available)
  material_color_utilities 0.8.0 (0.11.1 available)
  meta 1.11.0 (1.15.0 available)
  provider 6.0.5 (6.1.2 available)
  pub_semver 2.1.3 (2.1.4 available)
  pubspec_parse 1.1.0 (1.2.3 available)
! shared_preferences_foundation 2.4.0 from git https://github.com/DenisovAV/flutter-tvos-packages.git at 6166fd in packages/shared_preferences/shared_preferences_foundation (overridden)
! shared_preferences_platform_interface 2.3.2 from git https://github.com/DenisovAV/flutter-tvos-packages.git at 6166fd in packages/shared_preferences/shared_preferences_platform_interface (overridden)
  source_gen 1.4.0 (1.5.0 available)
  test_api 0.6.1 (0.7.1 available)
  typed_data 1.3.1 (1.3.2 available)
! video_player_avfoundation 2.6.1 from git https://github.com/DenisovAV/flutter-tvos-packages.git at 6166fd in packages/video_player/video_player_avfoundation (overridden)
! video_player_platform_interface 6.2.2 from git https://github.com/DenisovAV/flutter-tvos-packages.git at 6166fd in packages/video_player/video_player_platform_interface (overridden)
  vm_service 13.0.0 (14.2.2 available)
  watcher 1.0.2 (1.1.0 available)
  yaml 3.1.1 (3.1.2 available)
Got dependencies in ..!
30 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.

+ pod install
/Users/clint/.rvm/gems/ruby-3.0.0/gems/digest-3.1.1/lib/digest.rb:20: warning: already initialized constant Digest::REQUIRE_MUTEX
/Users/clint/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/digest.rb:6: warning: previous definition of REQUIRE_MUTEX was here
Analyzing dependencies
Downloading dependencies
Installing Flutter (1.0.0)
Installing shared_preferences_foundation (0.0.1)
Installing video_player_avfoundation (0.0.1)
Generating Pods project
Integrating client project
Pod installation complete! There are 3 dependencies from the Podfile and 3 total pods installed.

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
+ sh ../scripts/copy_framework.sh debug_sim_arm64 /Users/clint/Documents/dev/tv_engine
Coping Flutter.framework (debug-simulator-arm64)...
+ sed -i '' 's#FLUTTER_LOCAL_ENGINE[[:space:]]=[[:space:]].*;#FLUTTER_LOCAL_ENGINE = "/Users/clint/Documents/dev/tv_engine";#g' Runner.xcodeproj/project.pbxproj
+ open Runner.xcworkspace

and what my engine folder looks like. I don't understand this step super well, but i've tried only having the arm64 folders in there with same results.

Screenshot 2024-05-14 at 5 23 06 PM
DenisovAV commented 5 months ago

Let's avoid caching of plugins, please execute flutter pub cache repair, and if it won't help, remind me please your MacOS, XCode and Swift version, to see the difference between our environment

clintpurser commented 5 months ago

macOS 14.4.1 (23E224) Macbook air M2 XCode Version 15.4 (15F31d) Swift (output from xcrun swift -version:

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
DenisovAV commented 5 months ago

Hm, I have XCode 15.2 and Swift 5.9.2 will try to update and reproduce

DenisovAV commented 5 months ago

The reason was in a wrong version of dowloaded custom engine, now everything is fine