[llvm-bugs] [Bug 34333] New: Support/Threading.h on Haiku 'once_flag' does not name a type

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Aug 26 07:27:51 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34333

            Bug ID: 34333
           Summary: Support/Threading.h on Haiku    'once_flag' does not
                    name a type
           Product: libraries
           Version: 4.0
          Hardware: PC
                OS: other
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: kallisti5 at unixzen.com
                CC: llvm-bugs at lists.llvm.org

Cross compiling Rust for Haiku, running into this issue:


running: "x86_64-unknown-haiku-g++" "-O2" "-ffunction-sections"
"-fdata-sections" "-fPIC" "-m64"
"-I/home/kallisti5/Code/haiku/generated/cross-tools-x86_64/sysroot/boot/system/develop/headers"
"-fPIC" "-fvisibility-inlines-hidden" "-Wall" "-W" "-Wno-unused-parameter"
"-Wwrite-strings" "-Wcast-qual" "-Wno-missing-field-initializers" "-pedantic"
"-Wno-long-long" "-Wno-maybe-uninitialized" "-Wdelete-non-virtual-dtor"
"-Wno-comment" "-Werror=date-time" "-std=c++11" "-ffunction-sections"
"-fdata-sections" "-O3" "-DNDEBUG" "-fno-exceptions" "-D__STDC_CONSTANT_MACROS"
"-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-DLLVM_COMPONENT_AARCH64"
"-DLLVM_COMPONENT_ARM" "-DLLVM_COMPONENT_ASMPARSER"
"-DLLVM_COMPONENT_BITREADER" "-DLLVM_COMPONENT_BITWRITER"
"-DLLVM_COMPONENT_HEXAGON" "-DLLVM_COMPONENT_INSTRUMENTATION"
"-DLLVM_COMPONENT_INTERPRETER" "-DLLVM_COMPONENT_IPO" "-DLLVM_COMPONENT_LINKER"
"-DLLVM_COMPONENT_MCJIT" "-DLLVM_COMPONENT_MIPS" "-DLLVM_COMPONENT_MSP430"
"-DLLVM_COMPONENT_NVPTX" "-DLLVM_COMPONENT_POWERPC" "-DLLVM_COMPONENT_SPARC"
"-DLLVM_COMPONENT_SYSTEMZ" "-DLLVM_COMPONENT_X86" "-o"
"/home/kallisti5/Code/rust/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-haiku/release/build/rustc_llvm-e6802492b9663172/out/../rustllvm/PassWrapper.o"
"-c" "../rustllvm/PassWrapper.cpp"
cargo:warning=In file included from
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/Support/RWMutex.h:18:0,
cargo:warning=                 from
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/PassRegistry.h:25,
cargo:warning=                 from
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/PassSupport.h:27,
cargo:warning=                 from
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/Pass.h:387,
cargo:warning=                 from
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/IR/DataLayout.h:27,
cargo:warning=                 from
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/IR/Module.h:20,
cargo:warning=                 from
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/ExecutionEngine/ExecutionEngine.h:22,
cargo:warning=                 from ../rustllvm/rustllvm.h:20,
cargo:warning=                 from ../rustllvm/PassWrapper.cpp:15:
cargo:warning=/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/Support/Threading.h:61:16:
error: 'once_flag' in namespace 'std' does not name a type
cargo:warning=   typedef std::once_flag once_flag;
cargo:warning=                ^
cargo:warning=/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/Support/Threading.h:91:18:
error: variable or field 'call_once' declared void
cargo:warning=   void call_once(once_flag &flag, Function &&F, Args &&...
ArgList) {
cargo:warning=                  ^
cargo:warning=/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/Support/Threading.h:91:18:
error: 'once_flag' was not declared in this scope
cargo:warning=/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/Support/Threading.h:91:29:
error: 'flag' was not declared in this scope
cargo:warning=   void call_once(once_flag &flag, Function &&F, Args &&...
ArgList) {
cargo:warning=                             ^
cargo:warning=/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/Support/Threading.h:91:44:
error: expected primary-expression before '&&' token
cargo:warning=   void call_once(once_flag &flag, Function &&F, Args &&...
ArgList) {
cargo:warning=                                            ^
cargo:warning=/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/Support/Threading.h:91:46:
error: 'F' was not declared in this scope
cargo:warning=   void call_once(once_flag &flag, Function &&F, Args &&...
ArgList) {
cargo:warning=                                              ^
cargo:warning=/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/Support/Threading.h:91:54:
error: expected primary-expression before '&&' token
cargo:warning=   void call_once(once_flag &flag, Function &&F, Args &&...
ArgList) {
cargo:warning=                                                      ^
cargo:warning=/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/Support/Threading.h:91:56:
error: expected primary-expression before '...' token
cargo:warning=   void call_once(once_flag &flag, Function &&F, Args &&...
ArgList) {
cargo:warning=                                                        ^
cargo:warning=../rustllvm/PassWrapper.cpp:623:1: error: 'once_flag' does not
name a type
cargo:warning= INITIALIZE_PASS(RustPrintModulePass, "print-rust-module",
cargo:warning= ^
cargo:warning=In file included from
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/Pass.h:387:0,
cargo:warning=                 from
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/IR/DataLayout.h:27,
cargo:warning=                 from
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/IR/Module.h:20,
cargo:warning=                 from
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/headers/llvm/ExecutionEngine/ExecutionEngine.h:22,
cargo:warning=                 from ../rustllvm/rustllvm.h:20,
cargo:warning=                 from ../rustllvm/PassWrapper.cpp:15:
cargo:warning=../rustllvm/PassWrapper.cpp: In function 'void
llvm::initializeRustPrintModulePassPass(llvm::PassRegistry&)':
cargo:warning=../rustllvm/PassWrapper.cpp:623:1: error: 'call_once' is not a
member of 'llvm'
cargo:warning= INITIALIZE_PASS(RustPrintModulePass, "print-rust-module",
cargo:warning= ^
cargo:warning=../rustllvm/PassWrapper.cpp:623:1: error:
'InitializeRustPrintModulePassPassFlag' was not declared in this scope
cargo:warning= INITIALIZE_PASS(RustPrintModulePass, "print-rust-module",
cargo:warning= ^
exit code: 1



I *think* this is due to a misconfiguration in llvm/Support/Threading.h.

Adding __HAIKU__ to the checks for LLVM_THREADING_USE_STD_CALL_ONCE ~seems~ to
fix the problem... but i'm not 100% sure it is the correct solution.



// std::call_once from libc++ is used on all Unix platforms. Other
// implementations like libstdc++ are known to have problems on NetBSD,
// OpenBSD and PowerPC.
#if defined(LLVM_ON_UNIX) && (defined(_LIBCPP_VERSION) ||                     
\
    !(defined(__NetBSD__) || defined(__OpenBSD__) || defined(__HAIKU__) || \
    defined(__ppc__)))
#define LLVM_THREADING_USE_STD_CALL_ONCE 1
#else
#define LLVM_THREADING_USE_STD_CALL_ONCE 0
#endif

#if LLVM_THREADING_USE_STD_CALL_ONCE
#include <mutex>
#else
#include "llvm/Support/Atomic.h"
#endif

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170826/4d34450b/attachment-0001.html>


More information about the llvm-bugs mailing list