[PATCH] D43442: libunwind: when building without threads, pass this to libcxx as well

Rink via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 18 08:27:40 PST 2018


zhmu created this revision.
zhmu added a reviewer: jroelofs.
Herald added subscribers: cfe-commits, mgorny.
Herald added a reviewer: EricWF.

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.


Repository:
  rUNW libunwind

https://reviews.llvm.org/D43442

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -296,6 +296,10 @@
 # Threading-support
 if (NOT LIBUNWIND_ENABLE_THREADS)
   list(APPEND LIBUNWIND_COMPILE_FLAGS -D_LIBUNWIND_HAS_NO_THREADS)
+  if(LLVM_ENABLE_LIBCXX)
+    # Ensure libcxx doesn't try to use threads either
+    list(APPEND LIBUNWIND_COMPILE_FLAGS -D_LIBCPP_HAS_NO_THREADS)
+  endif()
 endif()
 
 # ARM WMMX register support


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43442.134836.patch
Type: text/x-patch
Size: 472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180218/a870cba3/attachment.bin>


More information about the cfe-commits mailing list