pingcap / pingcap/tiflash

TiFlash cannot build when CXX compiler is specified via -DCMAKE_CXX_COMPILER

Open
#5,847 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type/enhancement
Dominant language
C++
Stars
1k
Forks
423
Avg merge
1d 15h
Merged PRs (30d)
24

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

A clean Ubuntu 20.04 (which does not have build-essential installed) + llvm 14.

cmake .. -GNinja -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_C_COMPILER=/usr/bin/clang-14 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-14
ninja tiflash
2. What did you expect to see? (Required)

TiFlash is build successfully.

3. What did you see instead (Required)
error: failed to run custom build command for `snappy-sys v0.1.0 (https://github.com/busyjay/rust-snappy.git?branch=static-link#8c12738b)`

Caused by:
  process didn't exit successfully: `/home/ubuntu/tiflash/contrib/tiflash-proxy/target/release/build/snappy-sys-4bb1c1b3c53e7d57/build-script-build` (exit status: 101)
  --- stdout
  running: "cmake" "/home/ubuntu/.cargo/git/checkouts/rust-snappy-0ed33e4b7b96fc57/8c12738/snappy-sys/snappy" "-DCMAKE_INSTALL_PREFIX=/home/ubuntu/tiflash/contrib/tiflash-proxy/target/x86_64-unknown-linux-gnu/release/build/snappy-sys-3c3ee3f3563c6036/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" "-DCMAKE_CXX_COMPILER=c++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Release"
  -- The CXX compiler identification is unknown
  -- Configuring incomplete, errors occurred!
  See also "/home/ubuntu/tiflash/contrib/tiflash-proxy/target/x86_64-unknown-linux-gnu/release/build/snappy-sys-3c3ee3f3563c6036/out/build/CMakeFiles/CMakeOutput.log".
  See also "/home/ubuntu/tiflash/contrib/tiflash-proxy/target/x86_64-unknown-linux-gnu/release/build/snappy-sys-3c3ee3f3563c6036/out/build/CMakeFiles/CMakeError.log".

  --- stderr
  CMake Error at CMakeLists.txt:2 (project):
    The CMAKE_CXX_COMPILER:

      c++

    is not a full path and was not found in the PATH.

    Tell CMake where to find the compiler by setting either the environment
    variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
    to the compiler, or to the compiler name if it is in the PATH.


  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 1

  build script failed, must exit now', /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.45/src/lib.rs:894:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
make[1]: *** [Makefile:178: build] Error 101
make[1]: Leaving directory '/home/ubuntu/tiflash/contrib/tiflash-proxy'
make: *** [Makefile:194: release] Error 2
ninja: build stopped: subcommand failed
4. What is your TiFlash version? (Required)

master

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from the reported CMake and Ninja commands on clean Ubuntu 20.04, then inspect contrib/tiflash-proxy and the snappy-sys CMake build invocation shown in the error. Done means the tiflash target builds successfully when CMAKE_CXX_COMPILER is set to the specified clang++ path.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, rust
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.