How to fix “undefined reference to ‘__atomic_exchange_4”

Published by Igor Khrupin on

When I built native library for LatinIME I’ve got next error:

undefined reference to ‘__atomic_exchange_4

Full stacktrace:

/Volumes/Android/buildbot/src/android/ndk-r13-release/external/libcxx/include/memory:635: error: undefined reference to '__atomic_load_4'
/Volumes/Android/buildbot/src/android/ndk-r13-release/external/libcxx/../../external/libcxxabi/src/cxa_handlers.cpp:112: error: undefined reference to '__atomic_exchange_4'
/Volumes/Android/buildbot/src/android/ndk-r13-release/external/libcxx/../../external/libcxxabi/src/cxa_default_handlers.cpp:106: error: undefined reference to '__atomic_exchange_4'
/Volumes/Android/buildbot/src/android/ndk-r13-release/external/libcxx/../../external/libcxxabi/src/cxa_default_handlers.cpp:117: error: undefined reference to '__atomic_exchange_4'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [obj/local/armeabi/libjni_latinime.so] Error 1

To avoid it open Android.mk file and add next string:

LOCAL_EXPORT_LDLIBS += -latomic

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.