Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Support/Threading.h on Haiku 'once_flag' does not name a type #33305

Closed Quuxplusone closed 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR34333
Status RESOLVED INVALID
Importance P enhancement
Reported by Alexander von Gluck IV (kallisti5@unixzen.com)
Reported on 2017-08-26 07:27:51 -0700
Last modified on 2017-09-01 21:11:13 -0700
Version 4.0
Hardware PC other
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
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
Quuxplusone commented 7 years ago
A little context on what Haiku offers since most @ LLVM won't be familiar:

kallisti5@eris rust :) $ find /home/kallisti5/Code/haiku/generated.x86_64/cross-
tools-x86_64/sysroot/ -name "*libc++*"
kallisti5@eris rust :) $ find /home/kallisti5/Code/haiku/generated.x86_64/cross-
tools-x86_64/sysroot/ -name "*libstdc++*"
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/tools/lib/gcc/x86_64-unknown-haiku/5.4.0/libstdc++.so.6.0.21-gdb.py
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/tools/lib/gcc/x86_64-unknown-haiku/5.4.0/libstdc++.so.6.0.21
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/tools/lib/gcc/x86_64-unknown-haiku/5.4.0/libstdc++.so.6
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/tools/lib/gcc/x86_64-unknown-haiku/5.4.0/libstdc++.so
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/tools/lib/gcc/x86_64-unknown-haiku/5.4.0/libstdc++.la
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/boot/system/develop/tools/lib/gcc/x86_64-unknown-haiku/5.4.0/libstdc++.a

kallisti5@eris rust :) $ grep -R call_once
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-x86_64/sysroot/
Binary file /home/kallisti5/Code/haiku/generated.x86_64/cross-tools-
x86_64/sysroot/boot/system/develop/lib/x86_64-unknown-
haiku/5.4.0/libstdc++.so.6.0.21 matches
Binary file /home/kallisti5/Code/haiku/generated.x86_64/cross-tools-
x86_64/sysroot/boot/system/develop/lib/x86_64-unknown-
haiku/5.4.0/libstdc++.so.6 matches
Binary file /home/kallisti5/Code/haiku/generated.x86_64/cross-tools-
x86_64/sysroot/boot/system/develop/lib/x86_64-unknown-haiku/5.4.0/libstdc++.so
matches
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-
x86_64/sysroot/boot/system/develop/lib/x86_64-unknown-
haiku/5.4.0/include/c++/mutex:      call_once(once_flag& __once, _Callable&&
__f, _Args&&... __args);
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-
x86_64/sysroot/boot/system/develop/lib/x86_64-unknown-
haiku/5.4.0/include/c++/mutex:  /// call_once
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-
x86_64/sysroot/boot/system/develop/lib/x86_64-unknown-
haiku/5.4.0/include/c++/mutex:    call_once(once_flag& __once, _Callable&& __f,
_Args&&... __args)
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-
x86_64/sysroot/boot/system/develop/lib/x86_64-unknown-
haiku/5.4.0/include/c++/future: call_once(_M_once, &_State_baseV2::_M_do_set,
this,
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-
x86_64/sysroot/boot/system/develop/lib/x86_64-unknown-
haiku/5.4.0/include/c++/future: call_once(_M_once, &_State_baseV2::_M_do_set,
this,
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-
x86_64/sysroot/boot/system/develop/lib/x86_64-unknown-
haiku/5.4.0/include/c++/future:     // we can access _M_result directly instead
of through call_once.
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-
x86_64/sysroot/boot/system/develop/lib/x86_64-unknown-
haiku/5.4.0/include/c++/future:      // The function invoked with
std::call_once(_M_once, ...).
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-
x86_64/sysroot/boot/system/develop/lib/x86_64-unknown-
haiku/5.4.0/include/c++/future: // reach this point at the same time. The
call_once in _M_set_result
/home/kallisti5/Code/haiku/generated.x86_64/cross-tools-
x86_64/sysroot/boot/system/develop/lib/x86_64-unknown-
haiku/5.4.0/include/c++/future:    void _M_join() { std::call_once(_M_once,
&thread::join, ref(_M_thread)); }
Quuxplusone commented 7 years ago
Nevermind, it seemed like us not you :-)

23:08 <@jessicah> the c++config.h file differed from installed compiler on haiku
23:08 <@jessicah> I just overwrite the cross-compiler's copy with the haiku copy
23:08 <@jessicah> problem went away