Skip to content
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

[SR-6504] libdispatch.so symbol not found in android #665

Open
swift-ci opened this issue Nov 30, 2017 · 3 comments
Open

[SR-6504] libdispatch.so symbol not found in android #665

swift-ci opened this issue Nov 30, 2017 · 3 comments

Comments

@swift-ci
Copy link

Previous ID SR-6504
Radar None
Original Reporter amraboelela (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s libdispatch
Labels Bug, Android
Assignee None
Priority Medium

md5: 7fe497740fe239a09fe9cb6daa9a5a05

Issue Description:

I got this error while trying to run an app linking libfoundation and libdispatch

dlopen failed: cannot locate symbol "__atomic_fetch_add_4" referenced by "/data/app/com.example.addswift-1/lib/arm/libdispatch.so

Full error:

11-29 15:59:36.788 2983-2983/com.example.addswift E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.addswift, PID: 2983
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__atomic_fetch_add_4" referenced by "/data/app/com.example.addswift-1/lib/arm/libdispatch.so"...
at java.lang.Runtime.loadLibrary0(Runtime.java:977)
at java.lang.System.loadLibrary(System.java:1530)
at com.example.addswift.MainActivity.<clinit>(MainActivity.java:43)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2538)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

@belkadan
Copy link

I feel like we've seen this before with atomics on some other platform, but I can't find the bug.

@swift-ci
Copy link
Author

Comment by Amr Aboelela (JIRA)

android/ndk#104

They say in build.gradle replace cppFlags.add("-latomic") with ldFlags.add("-latomic")

@belkadan yes I think we had the same issue with Foundation, before, not sure how to solve it in libdispatch

@compnerd
Copy link
Collaborator

If this is still occurring, then `target_link_libraries(dispatch atomic)` under a check for android should do the right thing. But, I do believe that the libdispatch tests pass on android now.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants