This is an archive of the discontinued LLVM Phabricator instance.

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

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

Details

Reviewers
jroelofs
EricWF
Summary

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

/home/rink/github/ananas/toolchain/x86_64-ananas-elf-clang --target=x86_64-ananas-elf --sysroot=/tmp/ananas-build  -D_LIBCPP_DISABLE_EXTERN_TEMPLATE -D_LIBCXXABI_BUILDING_LIBRARY -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/rink/github/ananas/external/llvm/projects/libcxxabi/include -I/home/rink/github/ananas/external/llvm/projects/libcxx/include -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -w -fcolor-diagnostics  -fPIC   -nostdinc++ -Werror=return-type -W -Wall -Wchar-subscripts -Wconversion -Wmismatched-tags -Wmissing-braces -Wnewline-eof -Wunused-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 -WX- -pedantic -fstrict-aliasing -funwind-tables -D_DEBUG -std=c++11 -MD -MT src/CMakeFiles/cxxabi_objects.dir/cxa_demangle.cpp.o -MF src/CMakeFiles/cxxabi_objects.dir/cxa_demangle.cpp.o.d -o src/CMakeFiles/cxxabi_objects.dir/cxa_demangle.cpp.o -c /home/rink/github/ananas/external/llvm/projects/libcxxabi/src/cxa_demangle.cpp
In file included from /home/rink/github/ananas/external/llvm/projects/libcxxabi/src/cxa_demangle.cpp:20:
In file included from /home/rink/github/ananas/external/llvm/projects/libcxx/include/vector:264:
/home/rink/github/ananas/external/llvm/projects/libcxx/include/__config:1056:4: error: "No thread API"
#  error "No thread API"

My patch is similar to D43442: emit a define so that libcxx works when included.

Diff Detail

Repository
rCXXA libc++abi

Event Timeline

zhmu created this revision.Feb 18 2018, 8:39 AM