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


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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to