arthenica / ffmpeg-kit

FFmpeg Kit for applications. Supports Android, Flutter, iOS, Linux, macOS, React Native and tvOS. Supersedes MobileFFmpeg, flutter_ffmpeg and react-native-ffmpeg.
https://arthenica.github.io/ffmpeg-kit
GNU Lesser General Public License v3.0
4.34k stars 581 forks source link

Build for iOS emulator on Apple Silicon-M1 #104

Closed Larpoux closed 3 years ago

Larpoux commented 3 years ago

When I try to build for an IOS emulator on an Apple Silicon M1, I get the following error :

    ld: in /Volumes/Home/larpoux/projmac/tau/flutter_sound/example/ios/Pods/ffmpeg-kit-ios-full/dav1d.framework/dav1d(cdf.c.o), building for iOS Simulator, but linking in object file built for iOS, file
    '/Volumes/Home/larpoux/projmac/tau/flutter_sound/example/ios/Pods/ffmpeg-kit-ios-full/dav1d.framework/dav1d' for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

It seems that I cannot use the Binaries on CocoaPods because there is a problem with arch64 on emulator. When I build for a real iOS device, everything OK.

Here is my Podspec :

#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'flutter_sound'
  s.version          = '8.2.5'
  s.summary          = 'Flutter plugin that relates to sound like audio and recorder.'
  s.description      = <<-DESC
Flutter plugin that relates to sound like audio and recorder.
                       DESC
  s.homepage         = 'https://github.com/dooboolab/flutter_sound/flutter_sound'
  s.license          = { :file => '../LICENSE' }
  s.author           = { 'Dooboolab' => 'dooboolab@gmail.com' }
  s.source           = { :path => '.' }
  s.source_files = 'Classes/**/*'
  s.public_header_files = 'Classes/**/*.h'
  s.dependency 'Flutter'

  s.ios.deployment_target = '10.0'
  s.static_framework = true
  s.dependency 'tau_core', '8.2.5'
  #s.dependency 'mobile-ffmpeg-audio', '4.4.LTS'
  s.dependency 'ffmpeg-kit-ios-full', '~> 4.4.LTS'
end

Here is the result of pod install

larpoux@Mac-mini:~/projmac/tau/flutter_sound/example/ios$ pod install --repo-update
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing ffmpeg-kit-ios-full (4.4.LTS)
Installing flutter_sound 8.2.5
Removing mobile-ffmpeg-audio
Generating Pods project
Integrating client project
Pod installation complete! There are 5 dependencies from the Podfile and 6 total pods installed.
larpoux@Mac-mini:~/projmac/tau/flutter_sound/example/ios$

Note : Your library is really great. I am the main Flutter Sound Projec maintainer, and we used to link the full flavor of our plugin with Mobile FFmpeg. Because we had problems with the linkedit for a arch64-M1 emulator, I tried to switch to ffmpeg-kit. But it is not better.

tanersener commented 3 years ago

Thanks for using my projects.

Well, there are still a few things that must be improved in ffmpeg-kit. Unfortunately, we don't have an elegant solution for all of them.

In your case, the problem is you're using the LTS version of ffmpeg-kit. And that version includes framework bundles to support old Xcode versions. Not the new xcframework bundles that include new Apple architectures. It is listed here in LTS Releases section of the README.

I don't have a definitive solution for it at the moment. Just try to use the Main release and see it if it works.

Larpoux commented 3 years ago

Thank you @tanersener for your quick answer. There is no reason for me to develop with the LTS version. I will switch to the other version and will re-open the issue if still problems.

Take care ... I really like your plugin 💯