tanersener / react-native-ffmpeg

FFmpeg for react-native. Not maintained anymore. Superseded by FFmpegKit.
GNU General Public License v3.0
401 stars 52 forks source link

iOS Release build error: Thread-local storage is not supported for the current target #182

Closed dirkpostma closed 4 years ago

dirkpostma commented 4 years ago

Description Using blank React Native project, 0.62.2 when building a Release variant iOS, a build error occurs:

Thread-local storage is not supported for the current target

Expected behavior I would expect build to run without errors.

Current behavior When

npx react-native init TestFfmpeg --template react-native-template-typescript
cd TestFfmpeg
yarn add react-native-ffmpeg
open ios/TestFfmpeg.xcworkspace

Then the following build errors occurs:

***/TestFfmpeg/ios/Pods/mobile-ffmpeg-https/mobileffmpeg.framework/Headers/mobileffmpeg_exception.h:27:8: Thread-local storage is not supported for the current target

***/TestFfmpeg/node_modules/react-native-ffmpeg/ios/RNFFmpegModule.h:26:9: Could not build module 'mobileffmpeg'

Screenshots Not applicable

Logs See above

Environment

yarn react-native info
yarn run v1.22.4
$ ***/TestFfmpeg/node_modules/.bin/react-native info
info Fetching system and libraries information...
System:
    OS: macOS 10.15.5
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 590.40 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.14.2 - /var/folders/p8/lc8f03hj4glfwjx1c0_39d8w0000gn/T/yarn--1594364212507-0.1767762668618864/node
    Yarn: 1.22.4 - /var/folders/p8/lc8f03hj4glfwjx1c0_39d8w0000gn/T/yarn--1594364212507-0.1767762668618864/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.14.2/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /Users/****/.gem/ruby/2.4.9/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 19, 23, 27, 28, 29
      Build Tools: 27.0.3, 28.0.3, 29.0.3, 30.0.0
      System Images: android-19 | Google APIs Intel x86 Atom, android-21 | Intel x86 Atom, android-21 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6308749
    Xcode: 11.5/11E608c - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_242 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0
    react-native: 0.62.2 => 0.62.2
  npmGlobalPackages:
    *react-native*: Not Found
✨  Done in 3.80s.

Other thread_local is not supported on i386 architecture. Could that be a hint to solution?

tanersener commented 4 years ago

There are similar issues reported before. Please search for them and try to apply solutions given there.

dirkpostma commented 4 years ago

The README states that this library support iOS 9.3 and above. I already tried increasing the deployment target to 9.3, include script to set deployment target of all pods to 9.3, but this appears not be be high enough. I also tried to use LTS package, which didn't work either. Which made me file this issue.

Is it true that the README is incorrect? Should 9.3 be changed to 10.0?

In my opinion, if someone follows the instructions in the README, no errors should occur.

I would suggest to add instructions to change first line to platform :ios, '10.0'

And I would also suggest to let users add this to the Podfile:

post_install do |installer|
   installer.pods_project.targets.each do |target|
     target.build_configurations.each do |config|
       config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
     end
   end
 end

For me, this worked out.

Do you agree with these README change suggetions?

dirkpostma commented 4 years ago

By coincedence, the React Native team has just published React Native 0.63.0 and the typescript template is published last hour.

If you run this now:

npx react-native init TestFfmpeg --template react-native-template-typescript
cd TestFfmpeg
yarn add react-native-ffmpeg
cd ios; pod install; cd ..
open ios/TestFfmpeg.xcworkspace

...everything works out of the box!

Since React Native 0.63 has dropped iOS 9 support, the suggest change of Podfile is no longer necessary. For RN 0.62.* it is..

tanersener commented 4 years ago

Do you agree with these README change suggetions?

No. Thread-local storage is not supported for the current target message is generated by iOS, not by react-native-ffmpeg. iOS generates this warning when the deployment target is not supporting thread locals. Since we know that iOS 9.3 supports thread locals, your problem should be coming from something else.

Please take a look at official test applications under the react-native-ffmpeg-test repository. They are all working fine with 9.3.

dirkpostma commented 4 years ago

These examples use React Native 0.61.x. I could test again with React Native 0.62. And note that the error only happens with Release builds, not with Debug builds. It could also depend on xCode version, there are many factors. Thing is: following the readme did not work for me using BLANK project.

I tested again, I can confirm the error occurs with React Native 0.62.2.

npx react-native init TestFfmpeg062Vanilla --version 0.62.2
cd TestFfmpeg062Vanilla
yarn add react-native-ffmpeg
cd ios; pod install; cd ..
# change Podfile, platform 9.0 to 9.3
open ios/TestFfmpeg062Vanilla.xcworkspace/

Build Release configuration

=> error

But.. I think not worth the time as problems are solved with React Native 0.63 anyway.

Issue closed.

dirkpostma commented 4 years ago

Did some more testing. I think your overlook the fact that the error occurs with release build only.

I just tested default of react-native-ffmpeg-test

git clone git@github.com:tanersener/react-native-ffmpeg-test.git
cd react-native-ffmpeg-test/default
yarn
cd ios; pod install; cd ..; say ready
open ios/ReactNativeFFmpegTest.xcworkspace

Build Release configuration

=> error

So.. may be worth to look at it anyway?

tanersener commented 4 years ago

After publishing a new react-native-ffmpeg version, I'm validating that test applications can be built using both build types (debug, release). v0.4.4 was tested and validated in the same way. Please take a look at this video, https://www.dropbox.com/s/sg4hs3696e8ammq/issue-182-screenshot-capture.mov?dl=0.

Remember that this issue occurs because react-native and cocoapods don't always generate the correct deployment target for applications. This is why Thread-local storage is not supported for the current target error is received. Additionally, defining a post_install step doesn't always work. Because of that I recommend manually updating the deployment targets.

Also note that, this is issue is not specific to react-native-ffmpeg. There are other projects which suffer from the same problem as well.

DISKONEKTeD commented 4 years ago

i get this error on a fresh installation, but on react 60.6 (since I'm trying to migrate my code base on a large project, after the auto linking has failed). target is 9.3. version 0.4.4. I might just downgrade to see if that works for me instead.

tanersener commented 4 years ago

@DISKONEKTeD I believe I explained why this error happens and what must be done to fix it.

JerakRus commented 4 years ago

@tanersener This does not work. I am using react-native 0.63.2. Target everywhere 10.0. If the "Release" mod is set to "run" in the assembly scheme, the application build crashes. If the "Debug" mod is okay. Why does the error depend on the build mode?

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

blobrfish commented 3 years ago

@DISKONEKTeD I'm having the same issue. Did you manage suceed with the build release?

pheuter commented 3 years ago

A solution for the problem of Release configuration builds breaking while Debug working was to make sure you set Build Active Architecture Only=YES for the Pods project:

Screen Shot 2021-09-03 at 9 51 07 AM