Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[llvm build] Host compiler must support std::atomic #63623

Closed
tesuji opened this issue Aug 16, 2019 · 5 comments
Closed

[llvm build] Host compiler must support std::atomic #63623

tesuji opened this issue Aug 16, 2019 · 5 comments
Labels
T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tesuji
Copy link
Contributor

tesuji commented Aug 16, 2019

I cannot build rustc locally with commit f7af19c.

The build log is:

% ./x.py test src/test/ui --pass check
Updating only changed submodules
Submodules updated in 0.06 seconds
    Finished dev [unoptimized] target(s) in 0.21s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.29s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.22s
Copying stage0 test from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.27s
Copying stage0 rustc from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building LLVM for x86_64-unknown-linux-gnu
running: "cmake" "/home/lzutao/forked/rust/compiler-rust/src/llvm-project/llvm" "-G" "Ninja" "-DLLVM_ENABLE_ASSERTIONS=OFF" "-DLLVM_TARGETS_TO_BUILD=AArch64;ARM;X86" "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=" "-DLLVM_INCLUDE_EXAMPLES=OFF" "-DLLVM_INCLUDE_TESTS=OFF" "-DLLVM_I
NCLUDE_DOCS=OFF" "-DLLVM_INCLUDE_BENCHMARKS=OFF" "-DLLVM_ENABLE_ZLIB=OFF" "-DWITH_POLLY=OFF" "-DLLVM_ENABLE_TERMINFO=OFF" "-DLLVM_ENABLE_LIBEDIT=OFF" "-DLLVM_ENABLE_Z3_SOLVER=OFF" "-DLLVM_PARALLEL_COMPILE_JOBS=32" "-DLLVM_TARGET_ARCH=x86_64" "-DLLVM_DEFAULT_TARGET_TRIPLE=
x86_64-unknown-linux-gnu" "-DLLVM_OCAML_INSTALL_PATH=usr/lib/ocaml" "-DLLVM_LINK_LLVM_DYLIB=ON" "-DLLVM_ENABLE_LIBXML2=OFF" "-DLLVM_VERSION_SUFFIX=-rust-1.39.0-dev-48818e9f5" "-DPYTHON_EXECUTABLE=/home/lzutao/.local/bin/python2.7" "-DCMAKE_INSTALL_MESSAGE=LAZY" "-DCMAKE_C
_COMPILER_LAUNCHER=ccache" "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache" "-DCMAKE_C_COMPILER=cc" "-DCMAKE_CXX_COMPILER=c++" "-DCMAKE_C_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_INSTALL_PREFIX
=/home/lzutao/forked/rust/compiler-rust/build/x86_64-unknown-linux-gnu/llvm" "-DCMAKE_BUILD_TYPE=Release"
-- Could NOT find Z3: Found unsuitable version "0.0.0", but required is at least "4.7.1" (found Z3_LIBRARIES-NOTFOUND)
CMake Error at cmake/modules/CheckAtomic.cmake:50 (message):
  Host compiler must support std::atomic!
Call Stack (most recent call first):
  cmake/config-ix.cmake:349 (include)
  CMakeLists.txt:618 (include)


-- Configuring incomplete, errors occurred!
See also "/home/lzutao/forked/rust/compiler-rust/build/x86_64-unknown-linux-gnu/llvm/build/CMakeFiles/CMakeOutput.log".
See also "/home/lzutao/forked/rust/compiler-rust/build/x86_64-unknown-linux-gnu/llvm/build/CMakeFiles/CMakeError.log".
thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', /home/lzutao/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.38/src/lib.rs:813:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
        finished in 0.100
failed to run: /home/lzutao/forked/rust/compiler-rust/build/bootstrap/debug/bootstrap test src/test/ui --pass check
Build completed unsuccessfully in 0:00:02

Host machine

% uname -a
Linux gcc122.bak.milne.osuosl.org 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u2 (2019-05-13) x86_64 GNU/Linux

Custom config.toml

--- config.toml.example 2019-08-09 12:13:49.714819942 +0000
+++ config.toml 2019-08-09 17:26:12.650918099 +0000
@@ -30,7 +30,7 @@
 #assertions = false
 
 # Indicates whether ccache is used when building LLVM
-#ccache = false
+ccache = true
 # or alternatively ...
 #ccache = "/path/to/ccache"
 
@@ -46,7 +46,7 @@
 # Tell the LLVM build system to use Ninja instead of the platform default for
 # the generated build system. This can sometimes be faster than make, for
 # example.
-#ninja = false
+ninja = true
 
 # LLVM targets to build support for.
 # Note: this is NOT related to Rust compilation targets. However, as Rust is
@@ -57,12 +57,13 @@
 # support. You'll need to write a target specification at least, and most
 # likely, teach rustc about the C ABI of the target. Get in touch with the
 # Rust team and file an issue if you need assistance in porting!
-#targets = "AArch64;ARM;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86"
+targets = "AArch64;ARM;X86"
 
 # LLVM experimental targets to build support for. These targets are specified in
 # the same format as above, but since these targets are experimental, they are
 # not built by default and the experimental Rust compilation targets that depend
-# on them will not work unless the user opts in to building them.
+# on them will not work unless the user opts in to building them. By default the
+# `WebAssembly` and `RISCV` targets are enabled when compiling LLVM from scratch.
 #experimental-targets = ""
 
 # Cap the number of parallel linker invocations when compiling LLVM.
@Centril Centril added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 16, 2019
@andjo403
Copy link
Contributor

what gcc version are you using?
when did it work last time? a week ago llvm-project submodule was updated last time

@tesuji
Copy link
Contributor Author

tesuji commented Aug 16, 2019

what gcc version are you using?

% gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/lzutao/.local/libexec/gcc/x86_64-pc-linux-gnu/9.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-9.1.0/configure --prefix=/home/lzutao/.local --enable-languages=c,c++
Thread model: posix
gcc version 9.1.0 (GCC) 
% cc -v
clang version 10.0.0 (https://github.com/llvm/llvm-project.git 2bf522aea62e4fb653cacb68072167d25149099e)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/lzutao/.local/bin
Found candidate GCC installation: /home/lzutao/.local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.1.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0
Selected GCC installation: /home/lzutao/.local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.1.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

when did it work last time?

Probably a few days ago. Then I hit git clean -xfd at root dir of the repo and cause
llvm to be rebuilt.

@andjo403
Copy link
Contributor

strange the atomic test code works on godbolt as expected.
can it be some problem with the ccache?

@tesuji
Copy link
Contributor Author

tesuji commented Aug 16, 2019

Thanks. This shall be problem with my llvm build

% clang -std=c++11 test.cpp
ld: error: undefined symbol: __cxa_begin_catch
>>> referenced by test.cpp
>>>               /tmp/test-64b1e6.o:(__clang_call_terminate)

ld: error: undefined symbol: std::terminate()
>>> referenced by test.cpp
>>>               /tmp/test-64b1e6.o:(__clang_call_terminate)

ld: error: undefined symbol: __gxx_personality_v0
>>> referenced by test.cpp
>>>               /tmp/test-64b1e6.o:(.eh_frame+0x6B)
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)

I will check it later and report here.

@tesuji
Copy link
Contributor Author

tesuji commented Aug 16, 2019

I rebuilt and install clang from scratch. rust llvm has been build fine since then.
Closing as not a bug.

Thanks @andjo403 for the help you give.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants