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

Issues with autoconf & libtool #37

Closed
edkimmel opened this issue Mar 21, 2016 · 1 comment
Closed

Issues with autoconf & libtool #37

edkimmel opened this issue Mar 21, 2016 · 1 comment
Assignees
Milestone

Comments

@edkimmel
Copy link

EDIT: Getting closer to the root issue, which is pretty different than the original mentioned problem. Changing the original post.

Configure scripts created by autogen / autoconf seem to expose a toolchain bug with clang / libc++

The scripts send CXXFLAGS to the linker stage when checking if the c++ compiler works. The flag "-funwind-tables" causes the linker to fail with the following error

configure:16806: checking whether the C++ compiler works
configure:16822: arm-linux-androideabi-clang++ -o conftest  --sysroot=~/Toolchains/arm/sysroot -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -fpic -ffunction-sections **-funwind-tables** -fstack-protector -fno-strict-aliasing -frtti -fexceptions -march=armv7-a  conftest.cpp  >&5
/Volumes/Android/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-57861/build-libc++/ndk/sources/cxx-stl/llvm-libc++/../llvm-libc++abi/libcxxabi/src/cxa_handlers.cpp:112: error: undefined reference to '__atomic_exchange_4'
/Volumes/Android/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-57861/build-libc++/ndk/sources/cxx-stl/llvm-libc++/../llvm-libc++abi/libcxxabi/src/cxa_default_handlers.cpp:106: error: undefined reference to '__atomic_exchange_4'
/Volumes/Android/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-57861/build-libc++/ndk/sources/cxx-stl/llvm-libc++/../llvm-libc++abi/libcxxabi/src/cxa_default_handlers.cpp:117: error: undefined reference to '__atomic_exchange_4'

The error is suppressed if you add "-E" to your CXX/CPP command, but causes issues with the compiler being in 'compile only mode' when you're actually trying to link.

Even without that specific flag, I am not able to build any project that uses autoconf / libtool. The furthest I've gotten is the linker stage of the library, where I again run into atomic symbol problems.

/Volumes/Android/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-92934/build-libc++/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/atomic:922: error: undefined reference to '__atomic_fetch_add_4'
/Volumes/Android/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-92934/build-libc++/ndk/sources/cxx-stl/llvm-libc++/../llvm-libc++abi/libcxxabi/src/cxa_handlers.cpp:112: error: undefined reference to '__atomic_exchange_4'
/Volumes/Android/buildbot/out_dirs/aosp-ndk-r11-release/build/tmp/build-92934/build-libc++/ndk/sources/cxx-stl/llvm-libc++/../llvm-libc++abi/libcxxabi/src/cxa_default_handlers.cpp:106: error: undefined reference to '__atomic_exchange_4'

I've reproduced this problem with zeromq 4.1.4 and protobuf 2.6.1. As far as I know, neither of these libraries are expecting libatomic at all.

@DanAlbert DanAlbert self-assigned this Mar 22, 2016
@DanAlbert DanAlbert added this to the r12 milestone Mar 22, 2016
@edkimmel edkimmel changed the title Issues with libtool Issues with autoconf & libtool Mar 22, 2016
@DanAlbert
Copy link
Member

Needing to add -latomic to your ldflags for standalone toolchains is pretty common. It's annoying that it's necessary, and we're looking in to fixing clang to do this automatically, but for now you'll want to manually add it to your configure ldflags.

Go ahead and reopen the bug if that doesn't fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants