Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Bindings/Go/go.test fails when there's no c++11-capable compiler in the environment #21551

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR21552
Status NEW
Importance P normal
Reported by Hans Wennborg (hans@chromium.org)
Reported on 2014-11-12 19:39:20 -0800
Last modified on 2015-08-07 21:19:13 -0700
Version trunk
Hardware PC Linux
CC jvoung@google.com, llvm-bugs@lists.llvm.org, nicolasweber@gmx.de, peter@pcc.me.uk
Fixed by commit(s)
Attachments go.test.log (24199 bytes, text/x-log)
llvm-gtest.diff (4397 bytes, text/plain)
Blocks
Blocked by
See also
Bindings/Go/go.test fails on my machine when running in an environment that
doesn't have a C++11-capable compiler on PATH.

From what I understand, the test runs cmake, inputs flags based on llvm-flags
and then tries to build parts of LLVM, which seems a little brittle.

FAIL: LLVM :: Bindings/Go/go.test (15805 of 19507)
******************** TEST 'LLVM :: Bindings/Go/go.test' FAILED
********************
Script:
--
cd
/usr/local/google/work/chromium/src/third_party/llvm/test/Bindings/Go/../../../bindings/go/llvm
&&  env CGO_CPPFLAGS="$(/work/chromium/src/third_party/llvm-
build/Release+Asserts/./bin/llvm-config --cppflags)"      CGO_CXXFLAGS=-
std=c++11      CGO_LDFLAGS="$(/work/chromium/src/third_party/llvm-
build/Release+Asserts/./bin/llvm-config --ldflags --libs --system-libs
$(../build.sh --print-components)) $CGO_LDFLAGS"      /usr/lib/google-
golang/bin/go test -tags byollvm .
--
Exit Code: 2

Command Output (stdout):
--
FAIL    _/usr/local/google/work/chromium/src/third_party/llvm/bindings/go/llvm
[build failed]

--
Command Output (stderr):
--
+ llvm_components='all-targets analysis asmparser asmprinter bitreader
bitwriter codegen core debuginfo executionengine instrumentation interpreter
ipo irreader linker mc mcjit objcarcopts option profiledata scalaropts support
target '
+ '[' --print-components = --print-components ']'
+ echo all-targets analysis asmparser asmprinter bitreader bitwriter codegen
core debuginfo executionengine instrumentation interpreter ipo irreader linker
mc mcjit objcarcopts option profiledata scalaropts support target
+ exit 0
# _/usr/local/google/work/chromium/src/third_party/llvm/bindings/go/llvm
/work/chromium/src/third_party/llvm-
build/Release+Asserts/lib/libLLVMMCJIT.a(MCJIT.cpp.o):/work/chromium/src/third_party/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp:function
llvm::LinkingMemoryManager::getSymbolAddress(std::string const&): error:
undefined reference to 'std::__throw_out_of_range_fmt(char const*, ...)'
/work/chromium/src/third_party/llvm-
build/Release+Asserts/lib/libLLVMX86CodeGen.a(X86ISelLowering.cpp.o):/work/chromium/src/third_party/llvm/lib/Target/X86/X86ISelLowering.cpp:function
llvm::X86TargetLowering::LowerVECTOR_SHUFFLE(llvm::SDValue,
llvm::SelectionDAG&) const: error: undefined reference to
'std::__throw_out_of_range_fmt(char const*, ...)'
/work/chromium/src/third_party/llvm-
build/Release+Asserts/lib/libLLVMAsmPrinter.a(DwarfDebug.cpp.o):/work/chromium/src/third_party/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:function
llvm::LexicalScopes::LexicalScopes(): error: undefined reference to
'std::__detail::_Prime_rehash_policy::_M_next_bkt(unsigned long) const'
/work/chromium/src/third_party/llvm-
build/Release+Asserts/lib/libLLVMAsmPrinter.a(DwarfDebug.cpp.o):/work/chromium/src/third_party/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:function
llvm::LexicalScopes::LexicalScopes(): error: undefined reference to
'std::__detail::_Prime_rehash_policy::_M_next_bkt(unsigned long) const'
/work/chromium/src/third_party/llvm-
build/Release+Asserts/lib/libLLVMAsmPrinter.a(DwarfDebug.cpp.o):/work/chromium/src/third_party/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:function
llvm::LexicalScopes::LexicalScopes(): error: undefined reference to
'std::__detail::_Prime_rehash_policy::_M_next_bkt(unsigned long) const'
/work/chromium/src/third_party/llvm-
build/Release+Asserts/lib/libLLVMAsmPrinter.a(WinCodeViewLineTables.cpp.o):/work/chromium/src/third_party/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp:function
llvm::WinCodeViewLineTables::getFullFilepath(llvm::MDNode const*): error:
undefined reference to 'std::__throw_out_of_range_fmt(char const*, ...)'
/work/chromium/src/third_party/llvm-
build/Release+Asserts/lib/libLLVMAsmPrinter.a(WinCodeViewLineTables.cpp.o):/work/chromium/src/third_party/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp:function
llvm::WinCodeViewLineTables::getFullFilepath(llvm::MDNode const*): error:
undefined reference to 'std::__throw_out_of_range_fmt(char const*, ...)'
/work/chromium/src/third_party/llvm-
build/Release+Asserts/lib/libLLVMCodeGen.a(LexicalScopes.cpp.o):/work/chromium/src/third_party/llvm/lib/CodeGen/LexicalScopes.cpp:function
_ZNSt10_HashtableIPKN4llvm6MDNodeESt4pairIKS3_NS0_12LexicalScopeEESaIS7_ENSt8__detail10_Select1stESt8equal_toIS3_ESt4hashIS3_ENS9_18_Mod_range_hashingENS9_20_Default_ranged_hashENS9_20_Prime_rehash_policyENS9_17_Hashtable_traitsILb0ELb0ELb1EEEE10_M_emplaceIJRKSt21piecewise_construct_tSt5tupleIJRNS0_12DIDescriptorEEESP_IJRPS6_SR_ODnObEEEEES4_INS9_14_Node_iteratorIS7_Lb0ELb0EEEbESt17integral_constantIbLb1EEDpOT_:
error: undefined reference to
'std::__detail::_Prime_rehash_policy::_M_need_rehash(unsigned long, unsigned
long, unsigned long) const'
/work/chromium/src/third_party/llvm-
build/Release+Asserts/lib/libLLVMCodeGen.a(LexicalScopes.cpp.o):/work/chromium/src/third_party/llvm/lib/CodeGen/LexicalScopes.cpp:function
_ZNSt10_HashtableISt4pairIPKN4llvm6MDNodeES4_ES0_IKS5_NS1_12LexicalScopeEESaIS8_ENSt8__detail10_Select1stESt8equal_toIS5_ENS1_9pair_hashIS4_S4_EENSA_18_Mod_range_hashingENSA_20_Default_ranged_hashENSA_20_Prime_rehash_policyENSA_17_Hashtable_traitsILb1ELb0ELb1EEEE10_M_emplaceIJRKSt21piecewise_construct_tSt5tupleIJS5_EESQ_IJPS7_NS1_14DILexicalBlockEPS2_bEEEEES0_INSA_14_Node_iteratorIS8_Lb0ELb1EEEbESt17integral_constantIbLb1EEDpOT_:
error: undefined reference to
'std::__detail::_Prime_rehash_policy::_M_need_rehash(unsigned long, unsigned
long, unsigned long) const'
/work/chromium/src/third_party/llvm-
build/Release+Asserts/lib/libLLVMCodeGen.a(LexicalScopes.cpp.o):/work/chromium/src/third_party/llvm/lib/CodeGen/LexicalScopes.cpp:function
_ZNSt10_HashtableIPKN4llvm6MDNodeESt4pairIKS3_NS0_12LexicalScopeEESaIS7_ENSt8__detail10_Select1stESt8equal_toIS3_ESt4hashIS3_ENS9_18_Mod_range_hashingENS9_20_Default_ranged_hashENS9_20_Prime_rehash_policyENS9_17_Hashtable_traitsILb0ELb0ELb1EEEE10_M_emplaceIJRKSt21piecewise_construct_tSt5tupleIJPS1_EESP_IJPS6_NS0_12DIDescriptorEDnbEEEEES4_INS9_14_Node_iteratorIS7_Lb0ELb0EEEbESt17integral_constantIbLb1EEDpOT_:
error: undefined reference to
'std::__detail::_Prime_rehash_policy::_M_need_rehash(unsigned long, unsigned
long, unsigned long) const'
clang-3.6: error: linker command failed with exit code 1 (use -v to see
invocation)

--
Quuxplusone commented 10 years ago

Are you sure you are on trunk? That output looks like it came from a version of LLVM pre-r220462.

If you are still having problems, you can try modifying the first line of the test/Bindings/Go/go.test file to look like this:

; RUN: llvm-go test -x llvm.org/llvm/bindings/go/llvm

That should show you the subcommands that the "go" command is running.

Quuxplusone commented 10 years ago
(In reply to comment #1)
> Are you sure you are on trunk? That output looks like it came from a version
> of LLVM pre-r220462.
>
> If you are still having problems, you can try modifying the first line of
> the test/Bindings/Go/go.test file to look like this:
>
> ; RUN: llvm-go test -x llvm.org/llvm/bindings/go/llvm
>
> That should show you the subcommands that the "go" command is running.

I was using tags/google/stable/2014-10-28 which corresponds to r220284.

I'll see if it still happens on trunk.
Quuxplusone commented 10 years ago

Attached go.test.log (24199 bytes, text/x-log): Output from llvm-go test -x

Quuxplusone commented 10 years ago

Is this:

/work/chromium/src/tools/clang/scripts/../../../third_party/llvm/../llvm-bootstrap-install/bin/clang++

the correct path to the compiler used to build LLVM?

Did you configure cmake to pass any additional flags to the compiler (maybe to link against another standard library?)

Quuxplusone commented 10 years ago
(In reply to comment #4)
> Is this:
>
> /work/chromium/src/tools/clang/scripts/../../../third_party/llvm/../llvm-
> bootstrap-install/bin/clang++
>
> the correct path to the compiler used to build LLVM?

Yup.

>
> Did you configure cmake to pass any additional flags to the compiler (maybe
> to link against another standard library?)

Yes, I invoke cmake like this:

cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -
DLLVM_ENABLE_THREADS=OFF -
DCMAKE_C_COMPILER=/work/chromium/src/tools/clang/scripts/../../../third_party/llvm/../llvm-
bootstrap-install/bin/clang -
DCMAKE_CXX_COMPILER=/work/chromium/src/tools/clang/scripts/../../../third_party/llvm/../llvm-
bootstrap-install/bin/clang++ -DCMAKE_C_FLAGS=--gcc-
toolchain=/work/gcc482prefix -DCMAKE_CXX_FLAGS=--gcc-
toolchain=/work/gcc482prefix -DCMAKE_EXE_LINKER_FLAGS= -
DCMAKE_SHARED_LINKER_FLAGS= -DCMAKE_MODULE_LINKER_FLAGS= -
DCMAKE_INSTALL_PREFIX=/work/chromium/src/tools/clang/scripts/../../../third_party/llvm/../llvm-
build/Release+Asserts -
DCHROMIUM_TOOLS_SRC=/work/chromium/src/tools/clang/scripts/.. '-
DCHROMIUM_TOOLS=plugins;blink_gc_plugin'
/work/chromium/src/tools/clang/scripts/../../../third_party/llvm

The important bit is -DCMAKE_CXX_FLAGS=--gcc-toolchain=/work/gcc482prefix,
which points Clang to a newer GCC than my system one.

This set-up is probably uncommon, so I don't expect anyone to jump through
hoops to accommodate it, I mostly just filed this to keep track of the test
failure.
Quuxplusone commented 10 years ago
This should eventually be fixed by passing CMAKE_C*_FLAGS through to where Go
can see them.

In the meantime, you could work around the issue by moving the flag into
$CC/$CXX.
Quuxplusone commented 9 years ago

This is now the last test we need to patch around downstream because it doesn't just work.

Quuxplusone commented 9 years ago

Attached llvm-gtest.diff (4397 bytes, text/plain): patch

Quuxplusone commented 9 years ago

(based on http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141020/240862.html , http://llvm.org/viewvc/llvm-project?view=revision&revision=220462 , https://golang.org/cmd/cgo/ )