Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__emutls_get_address error on Android packages that include libc++_shared.so #292

Closed
tanersener opened this issue Jan 1, 2022 · 15 comments · Fixed by #293
Closed

__emutls_get_address error on Android packages that include libc++_shared.so #292

tanersener opened this issue Jan 1, 2022 · 15 comments · Fixed by #293
Assignees
Labels
android Affect Android platform bug Something isn't working fixed-in-v4.5.1-1 incompatibility library Affects the library v4.5.1 Affects v4.5.1 release

Comments

@tanersener
Copy link
Collaborator

Description
If the new v4.5.1 packages that include libc++_shared.so are put together with another dependency that has their own libc++_shared.so then ffmpeg-kit fails to start.

Expected behavior
We don't expect to have any issues when apps depend on other native libraries.

Current behavior
ffmpeg-kit fails to start with the following exception.

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~2kB8d3EtNmrQeTorQuxsNw==/com.arthenica.ffmpegkit.reactnative.test-H8VCzoSNcb5BSErN7bf4mw==/base.apk!/lib/x86_64/libffmpegkit.so

Environment

  • Platform: Android
  • Architecture: arm-v7a, arm-v7a-neon, arm64-v8a, x86, x86_64
  • Version: v4.5.1 and v4.5.1.LTS
  • Android NDK version: r23b

Other
This issue happens because v4.5.1 and v4.5.1.LTS are built with Android NDK r23b. See android/ndk/issues/1639.

@tanersener tanersener added bug Something isn't working android Affect Android platform library Affects the library v4.5.1 Affects v4.5.1 release labels Jan 1, 2022
@tanersener tanersener self-assigned this Jan 1, 2022
@juha-h
Copy link

juha-h commented Jan 1, 2022

@tanersener
Copy link
Collaborator Author

Yeah, they looks similar. However, the scenario you're describing there is different than what we're experiencing in v4.5.1. v4.5.1 binaries work fine if there is no second libc++_shared.so.

@juha-h
Copy link

juha-h commented Jan 1, 2022

I just tried with latest ffmpeg-kit main branch and built the libs using 23.1.7779620. Still got the same crash described in https://github.com/tanersener/ffmpeg-kit/issues/242. No problems with 23.0.7599858. Don't know if ndk folks will ever fix the issue.

@tanersener
Copy link
Collaborator Author

tanersener commented Jan 1, 2022

The changes implemented in v4.5.1 are tested on multiple computers, multiple simulators & devices. And no issues were found (except this one). I suggest using the test applications under the ffmpeg-kit-test project if you have issues.

@tanersener
Copy link
Collaborator Author

This issue is fixed in v4.5.1-1 and v4.5.1-1.LTS for Android. Upgrade to these versions if you encounter the error described in the first post.

@juha-h
Copy link

juha-h commented Jan 2, 2022

I build ffmpeg libs like this:

cd ffmpeg-kit && \
ANDROID_SDK_ROOT=/foo/bar \
ANDROID_NDK_ROOT=/opt/Android/ndk/23.1.7779620 \
./android.sh --enable-gpl --no-archive \
	--disable-arm-v7a --disable-arm-v7a-neon --disable-x86 \
	--disable-x86-64 \
	--enable-libvpx --enable-x264 --enable-x265 --enable-libaom \
	--enable-libpng --skip-ffmpeg-kit

My app crashes with __emutls_get_address error also with latest v4.5.1.LTS tag. It does not crash if I change ANDROID_NDK_ROOT to /opt/Android/ndk/23.0.7599858. Most likely it would work also with 22.1.7171670.

@tanersener
Copy link
Collaborator Author

tanersener commented Jan 2, 2022

@juha-h See my comment in your issue.

@tanersener
Copy link
Collaborator Author

The summary of this issue is:

Android NDK r23b includes a fix for android/ndk/issues/1551. This fix causes an incompatibility for libc++_shared.so.

  1. If you build ffmpeg-kit with Android NDK r23b and enable at least one of the libraries listed in Android Cpp Dependency
  2. And, if you depend on another native dependency that has a libc++_shared.so coming from another NDK version (not Android NDK r23b)

Then your application will crash with the error message given in the first post. Use NDK r22b to build ffmpeg-kit until Google releases a fix/workaround to address this issue.

@chankruze
Copy link

@tanersener Has Google released a fix/workaround to address this issue yet ? Can i use Android NDK r25b ?

@juha-h
Copy link

juha-h commented Jun 15, 2023

My app works fine with ANDROID_NDK_ROOT=/opt/Android/ndk/25.2.9519653.

@chankruze
Copy link

@juha-h Thanks for the confirmation. I am currently setting up my linux pc to build for Android. Will update here soon.

@agolendukhin
Copy link

My app works fine with ANDROID_NDK_ROOT=/opt/Android/ndk/25.2.9519653.

what's the library version you're using?

@juha-h
Copy link

juha-h commented Sep 11, 2023

@agolendukhin Version of what library? I'm using ndkVersion = 25.2.9519653 and development branch of ffmpeg-kit.

@agolendukhin
Copy link

@juha-h I mean what's the version of ffmpeg-kit

@juha-h
Copy link

juha-h commented Sep 11, 2023

Then I already answered in above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Affect Android platform bug Something isn't working fixed-in-v4.5.1-1 incompatibility library Affects the library v4.5.1 Affects v4.5.1 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants