Android tls issue

Newbie2019 newbie2019 at gmail.com
Mon Jun 24 03:10:40 UTC 2019


On Sunday, 23 June 2019 at 17:09:32 UTC, kinke wrote:
> These 2 symbols are inserted by the compiler into the object 
> file containing the D main function, see 
> https://run.dlang.io/is/QDwmHM. What triple are you using? Make 
> sure there's an `-android` at the end.

Then I build normal example with TLS var on android, it work as 
expect. But when I try build ldc it self from Android, I get this 
error. (because the source code link with 
druntime/src/rt/sections_android.d, and there is no symbols of 
_tlsstart/_tlsend)

The cmake force to use ldmd2 and there is no 
`-mtriple=aarch64-unknown-linux-android` pass to ldmd2 when I run 
ninja.

Then I try cross build from macOS get this error:

ldc-build-runtime --ninja --targetPreset=Android-aarch64 
--buildDir=/opt/local/droid/droid64

core/sys/posix/aio.d(481): Error: undefined identifier `aiocb`
core/sys/posix/aio.d(482): Error: undefined identifier `aiocb`
core/sys/posix/aio.d(483): Error: undefined identifier `aiocb`
core/sys/posix/aio.d(484): Error: undefined identifier `aiocb`
core/sys/posix/aio.d(485): Error: undefined identifier `aiocb`
core/sys/posix/aio.d(486): Error: undefined identifier `aiocb`
core/sys/posix/aio.d(487): Error: undefined identifier `aiocb`
core/sys/posix/aio.d(488): Error: undefined identifier `aiocb`
ninja: build stopped: subcommand failed.
Error: command failed with status 1

try build example with cross betterC:

export 
CC=/Users/android/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
ldmd2 -L-L/opt/local/droid/droid64/lib 
-Xcc=--sysroot=/Users/android/Library/Android/sdk/ndk-bundle/platforms/android-27/arch-arm64 -Xcc=-target -Xcc=aarch64-none-linux-android -Xcc=-fpie -Xcc=-pie -betterC test_android_tls.d -mtriple=aarch64-unknown-linux-android

test_android_tls.d:(.text.main[main]+0x14): undefined reference 
to `_tlsstart'









More information about the digitalmars-d-ldc mailing list