Skip to content

Observation linking error: cannot locate symbol "_ZN5swift9threading5fatalEPKcz" #18

@marcprux

Description

@marcprux

When linking to Observation and building with skip android build, the following linking error occurs:

cannot locate symbol "_ZN5swift9threading5fatalEPKcz" referenced by "/data/local/tmp/swift-android/Android-9EA98374-80B5-494A-9679-A2B5EBE1D083/libswiftObservation.so".

We work around this in SkipAndroidBridge with the following code, but it requires that SkipAndroidBridge be imported (either directly or via SkipFuse):

#if os(Android)
// Without this we get the crash on launch: 08-09 18:45:51.978 10431 10431 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN5swift9threading5fatalEPKcz" referenced by "/data/app/~~aevIacTPjMLuc5Cymf5l-A==/skip.droid.app--cf8i3s7JV9Ln9saNnThMg==/base.apk!/lib/arm64-v8a/libswiftObservation.so"...
// Seem like Swift/lib/Threading/Errors.cpp (https://github.com/swiftlang/swift/blob/3934f78ecdd53031ac40d68499f9ee046a5abe50/lib/Threading/Errors.cpp#L13) is missing
// Should be fixed by: https://github.com/swiftlang/swift/pull/77890
@_cdecl("_ZN5swift9threading5fatalEPKcz")
public func swiftThreadingFatal() {
// we need to do *something* here or the function will get stripped out in release mode
print("swiftThreadingFatal")
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions