llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.08k stars 11.59k forks source link

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

Open zmodem opened 9 years ago

zmodem commented 9 years ago
Bugzilla Link 21552
Version trunk
OS Linux
CC @nico,@pcc

Extended Description

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):

--

nico 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/ )

nico commented 9 years ago

patch This might do it, but it's completely untested.

nico commented 9 years ago

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

pcc commented 9 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.

zmodem commented 9 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?

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.

pcc commented 9 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?)

zmodem commented 9 years ago

Output from llvm-go test -x I tried with LLVM r221592 and still get the same error. Attaching the output when adding the -x flag.

zmodem commented 9 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.

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

I'll see if it still happens on trunk.

pcc commented 9 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.