Trouble with Android and arsd.jni

burt invalid_email_address at
Thu Sep 10 11:16:55 UTC 2020


I'm trying to upgrade and improve an Android project I was 
working on a while ago. For this reason, I decided to upgrade my 
compiler to the newest LDC (v1.23.0).

I am using the arsd.jni library for the JNI headers and for 
initializing the runtime. However, I am getting linker errors, 
telling me that _tlsend, _tlsstart and __bss_end__ are missing.

So I tried to fix these by adding empty declarations for them 
myself (as I saw in another post):

extern(C) __gshared
     int _tlsstart = 0;
     int _tlsend = 0;

However, when doing this, it causes my app to crash, specifically 
on jni.d:1033 when calling `Runtime.initialize()`. The stack 
trace shows there is an assertion error in rt.sections_android in 
the foreach body of `getStaticTLSRange`.

I also tried adding an empty `void main() {}` instead, with the 
same result.

PR #2991 in dlang/druntime seems to have changed the way the TLS 
is emulated on Android or something. I have no clue what is going 
on and how to fix these errors, so if someone could help that 
would be much appreciated.

Thank you.

More information about the Digitalmars-d-learn mailing list