Page MenuHomePhabricator

libunwind: when building without threads, pass this to libcxx as well
Needs ReviewPublic

Authored by zhmu on Feb 18 2018, 8:27 AM.

Details

Reviewers
jroelofs
EricWF
Summary

I'm trying to build libunwind as prerequisite for libcxx/libcxxabi. The target doesn't yet support userland threads, so I set LIBUNWIND_ENABLE_THREADS to 'OFF' in CMake (also, LLVM_ENABLE_LIBCXX is set to 'on'). This fails to build:

/home/rink/github/ananas/toolchain/x86_64-ananas-elf-clang --target=x86_64-ananas-elf --sysroot=/tmp/ananas-build  -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/rink/github/ananas/external/llvm/projects/libunwind/include -I/home/rink/github/ananas/external/llvm/projects/libcxx/include -stdlib=libc++ -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -w -fcolor-diagnostics -std=c++11 -g -fPIC   -Werror=return-type -W -Wall -Wchar-subscripts -Wconversion -Wmismatched-tags -Wmissing-braces -Wnewline-eof -Wno-unused-function -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wsign-conversion -Wstrict-aliasing=2 -Wstrict-overflow=4 -Wunused-parameter -Wunused-variable -Wwrite-strings -Wundef -Wno-error -pedantic -D_DEBUG -D_LIBUNWIND_IS_NATIVE_ONLY -D_LIBUNWIND_HAS_NO_THREADS -fno-exceptions -funwind-tables   -stdlib=libc++ -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -w -fcolor-diagnostics -std=c++11 -fstrict-aliasing -nostdinc++ -fno-rtti -MD -MT src/CMakeFiles/unwind_objects.dir/libunwind.cpp.o -MF src/CMakeFiles/unwind_objects.dir/libunwind.cpp.o.d -o src/CMakeFiles/unwind_objects.dir/libunwind.cpp.o -c /home/rink/github/ananas/external/llvm/projects/libunwind/src/libunwind.cpp
In file included from /home/rink/github/ananas/external/llvm/projects/libunwind/src/libunwind.cpp:13:
In file included from /home/rink/github/ananas/external/llvm/projects/libunwind/include/libunwind.h:19:
In file included from /home/rink/github/ananas/external/llvm/projects/libcxx/include/stdint.h:102:
/home/rink/github/ananas/external/llvm/projects/libcxx/include/__config:1056:4: error: "No thread API"
#  error "No thread API"
   ^
1 error generated.

As the 'do not use threads' flag isn't passed to libcxx. I've attached a patch to remedy this - I hope it is the correct place to do so.

Diff Detail

Repository
rUNW libunwind

Event Timeline

zhmu created this revision.Feb 18 2018, 8:27 AM
zhmu added a comment.Feb 18 2018, 8:27 AM

I've added jroelofs to the reviewer list as we spoke about this in #llvm quite some time ago.