Skip to content

[SR-4443] Android: Cannot run swift executable on Android 7.0 emulator (armv7) as it is not a PIE #47020

Closed
@swift-ci

Description

@swift-ci
Previous ID SR-4443
Radar None
Original Reporter qasim (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 3
Component/s Compiler
Labels Bug, Android
Assignee jblatecky (JIRA)
Priority Medium

md5: c637650368058adb0695bd0eb668326a

relates to:

  • SR-5405 Security: Swift on Linux not compiled as position independent executable

Issue Description:

I'm having trouble running a compiled swift file on an Android 7.0 emulator. I've set up swift based on https://github.com/apple/swift/blob/master/docs/Android.md, and the error I get on device is:

"/data/local/tmp/hello": error: only position independent executables (PIE) are supported. Aborted

Naively, I thought maybe I can pass -Xlinker -pie to the swiftc command to build hello.swift, but that results in the following when I execute the produced file:

CANNOT LINK EXECUTABLE "./hello": cannot locate symbol "__atomic_load" referenced by "/data/local/tmp/libswiftCore.so"... Aborted

I'm using android-ndk-r14b, and built the swift compiler for API level 21. All other steps seem to have run fine except for running the executable at the end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AndroidPlatform: AndroidbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions