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

Cannot build compiler_builtins with Visual Studio 2019 Build Tools #61911

Closed
ehuss opened this issue Jun 17, 2019 · 3 comments · Fixed by #62018
Closed

Cannot build compiler_builtins with Visual Studio 2019 Build Tools #61911

ehuss opened this issue Jun 17, 2019 · 3 comments · Fixed by #62018

Comments

@ehuss
Copy link
Contributor

ehuss commented Jun 17, 2019

Trying to build rustc with Visual Studio 2019 Build Tools results in the following error:

running: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.21.27702\\bin\\HostX64\\x64\\cl.exe" "/nologo" "/MT" "/O2" "/Zl" "/D__func__=__FUNCTION__" "/FoC:\\Proj\\rust\\build\\x86_64-pc-windows-msvc\\stage0-std\\x86_64-pc-windows-msvc\\release\\build\\compiler_builtins-21b4e69466e2594a\\out\\divdc3.o" "/c" "C:\\Proj\\rust\\src/llvm-project/compiler-rt\\lib/builtins\\divdc3.c"
divdc3.c
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\include\xkeycheck.h(45): warning C4005: 'bool': macro redefinition
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\include\stdbool.h(15): note: see previous definition of 'bool'
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\include\xkeycheck.h(47): fatal error C1189: #error:  The C++ Standard Library forbids macroizing the keyword "bool". Enable warning C4005 to find the forbidden define.
exit code: 2

I've tried version versions 16.1.1 and 16.1.3 on different machines with the same result.

Visual Studio 2017 Build Tools work fine.

Is there some magic incantation I'm missing?

@scottmcm
Copy link
Member

I get this as well.

I've been hacking around it with

--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -179,8 +179,9 @@ pub fn std_cargo(builder: &Builder<'_>,
     // `compiler-rt` is located.
     let compiler_builtins_root = builder.src.join("src/llvm-project/compiler-rt");
     let compiler_builtins_c_feature = if compiler_builtins_root.exists() {
-        cargo.env("RUST_COMPILER_RT_ROOT", &compiler_builtins_root);
-        " compiler-builtins-c".to_string()
+        //cargo.env("RUST_COMPILER_RT_ROOT", &compiler_builtins_root);
+        //" compiler-builtins-c".to_string()
+        String::new() // HACK! the c builtins don't build for me
     } else {
         String::new()
     };

I think this was introduced in #60981, so cc @alexcrichton

@alexcrichton
Copy link
Member

I don't think that anything is being missed here. This is probably a bug with either:

  • An upstream compiler-rt bug that needs to be fixed
  • A bug with how we build compiler-rt since we're not using the standard build system

The former may already even be fixed upstream, the latter is probably some missing /D flag we're not passing and would require inspecting the source. In both cases the source needs to be inspected likely :)

@Zoxc
Copy link
Contributor

Zoxc commented Jun 20, 2019

This patch was applied to our compiler-rt fork, but it was lost somehow, breaking VS 2019 builds.

bors added a commit that referenced this issue Jun 21, 2019
Update LLVM to fix VS 2019 compilation

Fixes #61911.

r? @alexcrichton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants