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

Android dlopen failed due to TLS_MODEL attribute #332

Closed
natepaynefb opened this issue Apr 30, 2024 · 6 comments
Closed

Android dlopen failed due to TLS_MODEL attribute #332

natepaynefb opened this issue Apr 30, 2024 · 6 comments
Assignees

Comments

@natepaynefb
Copy link

I am trying to run my project on an Android device. It fails with output like this:

java.lang.UnsatisfiedLinkError: dlopen failed: TLS symbol "(null)" in dlopened "my_native_project.so" referenced from "my_native_project.so" using IE access model

The variable in question is the one with the TLS_MODEL macro in rpmalloc.c. If I remove the TLS_MODEL macro, then my project loads successfully and everything works as far as I can tell.

Note that I am not building rpmalloc directly. I am using the version of it that is included with the Tracy profiler. I was told that I should ask the maintainers of rpmalloc about it (wolfpld/tracy#779).

What is your recommendation? Is it important for that variable to use tls_model("initial-exec")? If so, can you recommend a workaround to make the Android dynamic linker happy? Thanks.

@natepaynefb natepaynefb changed the title Android dlopen failed due to TLS variable Android dlopen failed due to TLS_MODEL attribute Apr 30, 2024
@mjansson mjansson self-assigned this May 12, 2024
@mjansson
Copy link
Owner

You can just change the define of TLS_MODEL to nothing, i.e
#define TLS_MODEL

@MarijnS95
Copy link

@mjansson would you be able to land a change that approaches this (for Android) on top of an older tagged release?

@mjansson
Copy link
Owner

Merged #347

@MarijnS95
Copy link

@mjansson I see, thanks. Didn't expect that to be merged, it would have been great if the title and description were rewritten to actually describe the problem and chosen solution though 🤷

@mjansson
Copy link
Owner

I changed the actual commit to say Set TLS model on Android depending on target sdk

@MarijnS95
Copy link

MarijnS95 commented Jan 11, 2025

Lovely, that should make it easier to find!

I didn't check if the logic to compare against NDK revision is sound, but perhaps this issue can now be closed?
EDIT: It probably isn't sound when the host clang/LLVM toolchain is used to cross-compile to Android: #347 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants