-
Notifications
You must be signed in to change notification settings - Fork 253
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
AS2.3 new issue: dlopen failed: cannot locate symbol "__emutls_get_address" #329
Comments
I don't think I'm going to be able to figure out anything definitive without a test case. It looks like libgr4coms was improperly built.
The other question here is whether this works if you downgrade to NDK r13. I don't think anything we've changed in cmake should have caused something like this...
Not that TLS ;) |
Thanks Dan. Sorry to say I don't really have a minimised case to provide.. it's part of a large (corporate) codebase, rather than a personal project of mine, so I don't really have the right to provide any of that code to the public for any purpose ;-) I'll investigate downgrading the NDK to see what happens, I'll report back on my success there.. |
Hi again, Downgraded NDK from 14 to r13b - and the problem is gone.. So could it be a bug in NDK 14? Or a compatibility issue in my code maybe? |
Sorry for the slow response. My best guess right now is that this is something like #289 Are you using the NDK's cmake toolchain, or the Android support that's built in to cmake 3.7+? It looks like there might be some bugs in the cmake 3.7 Android support that's causing libgcc things to not be linked properly. If that's the case, I'm going to dup this bug into the other. If not, I'll need to come up with another theory... |
Thanks Dan. I'm sorry I'm not 100% sure how to answer that.. I guess it's the NDK's cmake toolchain as I'm using Android Studio to do all the dirty work, would that be right? I'll attach some info here in the hope that it answers the question. My gradle file contains:
While the CMake file is pretty uncomplicated, but begins with |
Yeah, if you're using Android Studio it will be our toolchain rather than the upstream one. That turns out to have not been the issue in the other bug, but actually just a generic bug in cmake, it seems. See the other bug for the gory details, but this was the workaround:
Let me know if that fixes your problem. If so, I'll dup this into the other. |
So I gave it a shot, but no luck... I tried two different ways of adding it in CMakeLists, one using
Printing out all of my CMake variables includes the following maybe-helpful info:
I also noted that -Wl,--exclude-libs,libunwind.a was actually included in most linker flag settings already... |
Apologies for slow response, been on vacation. Hmm. Did those flags get added for each library you built? Maybe there was a prebuilt library you're using? Possibly even libc++_shared.so is the problem... $ readelf -sW $NDK/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so | grep __emutls_get_address
2128: 00084f00 316 FUNC GLOBAL DEFAULT 11 __emutls_get_address But even so, libc++_shared.so is being shipped with your app, so it should be found. Are you using a |
There's only one library being built with the NDK, and no prebuilt libraries, apart from standard ones ( |
possibly related to issue #498 ? |
Is this still an issue? |
Sorry should have mentioned this before - happily NDK version 15 has cleared up this issue 👍 |
🎉 |
Facing the exact same issue while building x86 builds . When i try using the flags "-Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libunwind.a" with NDK 18 beta 1 I get the following error |
For anybody else in the future, who might have the same problem — I have tracked down the issue to NDK r16b and NDK r17b not working with each other properly. I had a library compiled with NDK r16b and it required __emutls_get_address symbol (which was normally provided by libc++_shared.so from NDK r16b), however when later compiling my application with NDK r17b, the libc++_shared.so provided by the newer NDK no longer had the symbol inside. I fixed it by compiling both with NDK r16b, however compiling both with NDK r17b could possibly work as well. |
Hi,I meet this problem now .I use ndk 16b,but my partner use ndk17,code works for him but not for me. I read your code several time but still can not know how you solve this. |
Update your NDK. |
Description
Since upgrading Android Studio to 2.3 (on Mac), my external cpp library (a proprietary TCP library) has started failing runtime loading with the error:
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/data/com.my.app.packagename/app_lib/libgr4coms.so"...
__emutls_get_address is a symbol that's part of TLS, it seems. (http://stackoverflow.com/questions/7885246/what-is-the-emutls-get-address-symbol)
Further than that, I'm in the dark.
I've tried, with no success:
add_library(gr4coms SHARED ${my_SRCS})
andadd_library(gr4coms STATIC ${my_SRCS})
Environment Details
The text was updated successfully, but these errors were encountered: