llvm / llvm-project

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

LLVM doesn't compile with Visual Studio 2017 Express edition: missing atlbase.h #41936

Open llvmbot opened 5 years ago

llvmbot commented 5 years ago
Bugzilla Link 42591
Version 8.0
OS Windows XP
Reporter LLVM Bugzilla Contributor
CC @JDevlieghere,@walkerkd,@pogo59,@rnk

Extended Description

I ran into an issue when attempting to compile LLVM on Windows 10 using the Visual Studio 2017 Express edition. Express edition does not come with ATL support, and several files have a dependency on atlbase.h.

It is possible to install ATL for 2017 as part of the Visual Studio Build Tools ["C++ ATL for for v141 build tools (x86 & x64)"]. But only Build Tools 2019 is available, and the ATL header/lib files get installed in the "C:\Program Files (x86)\Microsoft Visual Studio\2019" not "...2017" directory. The CL compiler can't find them in that non-standard location.

This problem is fixed by using Visual Studio 2017 Community Edition or higher, which have ATL support build-in. But unfortunately the Express edition is the only version that allows for free commercial use.

Is it possible to make LLVM independent of ATL when it's not available? If no, I suggest you modify your Getting Started guide (https://llvm.org/docs/GettingStarted.html) to mention that VS Express Edition is not supported.

Compile log snip...

C:\build\2017\llvm>cmake --build . --config Release Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

etc...

DIAEnumSourceFiles.cpp v:\llvm-project\llvm\include\llvm\debuginfo\pdb\dia\DIASupport.h(25): fatal error C1083: Cannot open include file: 'atl base.h': No such file or directory (compiling source file V:\llvm-project\llvm\lib\DebugInfo\PDB\DIA\DIAEnumFrameData.c pp) [C:\build\2017\llvm\lib\DebugInfo\PDB\LLVMDebugInfoPDB.vcxproj] v:\llvm-project\llvm\include\llvm\debuginfo\pdb\dia\DIASupport.h(25): fatal error C1083: Cannot open include file: 'atl base.h': No such file or directory (compiling source file V:\llvm-project\llvm\lib\DebugInfo\PDB\DIA\DIADataStream.cpp) [C:\build\2017\llvm\lib\DebugInfo\PDB\LLVMDebugInfoPDB.vcxproj] v:\llvm-project\llvm\include\llvm\debuginfo\pdb\dia\DIASupport.h(25): fatal error C1083: Cannot open include file: 'atl base.h': No such file or directory (compiling source file V:\llvm-project\llvm\lib\DebugInfo\PDB\DIA\DIAEnumDebugStream s.cpp) [C:\build\2017\llvm\lib\DebugInfo\PDB\LLVMDebugInfoPDB.vcxproj] v:\llvm-project\llvm\include\llvm\debuginfo\pdb\dia\DIASupport.h(25): fatal error C1083: Cannot open include file: 'atl base.h': No such file or directory (compiling source file V:\llvm-project\llvm\lib\DebugInfo\PDB\DIA\DIAEnumInjectedSou rces.cpp) [C:\build\2017\llvm\lib\DebugInfo\PDB\LLVMDebugInfoPDB.vcxproj] v:\llvm-project\llvm\include\llvm\debuginfo\pdb\dia\DIASupport.h(25): fatal error C1083: Cannot open include file: 'atl base.h': No such file or directory (compiling source file V:\llvm-project\llvm\lib\DebugInfo\PDB\DIA\DIAEnumSectionCont ribs.cpp) [C:\build\2017\llvm\lib\DebugInfo\PDB\LLVMDebugInfoPDB.vcxproj] v:\llvm-project\llvm\include\llvm\debuginfo\pdb\dia\DIASupport.h(25): fatal error C1083: Cannot open include file: 'atl base.h': No such file or directory (compiling source file V:\llvm-project\llvm\lib\DebugInfo\PDB\DIA\DIAEnumLineNumbers .cpp) [C:\build\2017\llvm\lib\DebugInfo\PDB\LLVMDebugInfoPDB.vcxproj] v:\llvm-project\llvm\include\llvm\debuginfo\pdb\dia\DIASupport.h(25): fatal error C1083: Cannot open include file: 'atl base.h': No such file or directory (compiling source file V:\llvm-project\llvm\lib\DebugInfo\PDB\DIA\DIAEnumSourceFiles .cpp) [C:\build\2017\llvm\lib\DebugInfo\PDB\LLVMDebugInfoPDB.vcxproj] DIAEnumSymbols.cpp

rnk commented 5 years ago

I meant to mention, you can disable DIA support by passing -DLLVM_ENABLE_DIA_SDK=OFF to cmake, and then the build should succeed with VS express.

rnk commented 5 years ago

I think you can disable DIA support. I don't know to what extend DIA depends on ATL or if LLVM uses ATL, but I do know that it should be limited to the LLVM code that uses DIA, which is optional.

h-vetinari commented 1 month ago

I've started hitting this with llvm 18.1.6 using VS2022 (targetting vc142, so like VS2019). This didn't happen for any other llvm release since 11.x (which was when I started to get involved).

[545/3645] Building CXX object lib\DebugInfo\PDB\CMakeFiles\LLVMDebugInfoPDB.dir\PDB.cpp.obj
FAILED: lib/DebugInfo/PDB/CMakeFiles/LLVMDebugInfoPDB.dir/PDB.cpp.obj 
C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\cl.exe  /nologo /TP -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I%SRC_DIR%\build\lib\DebugInfo\PDB -I%SRC_DIR%\llvm\lib\DebugInfo\PDB -I%SRC_DIR%\build\include -I%SRC_DIR%\llvm\include -external:I"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\DIA SDK\include" -external:I%PREFIX%\Library\include -external:W0 -MD  /DWIN32 /D_WINDOWS   /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -w14062 -we4238 /Gw /O2 /Ob2 /DNDEBUG -std:c++17 -MD  /EHs-c- /GR /showIncludes /Folib\DebugInfo\PDB\CMakeFiles\LLVMDebugInfoPDB.dir\PDB.cpp.obj /Fdlib\DebugInfo\PDB\CMakeFiles\LLVMDebugInfoPDB.dir\LLVMDebugInfoPDB.pdb /FS -c %SRC_DIR%\llvm\lib\DebugInfo\PDB\PDB.cpp
%SRC_DIR%\llvm\include\llvm\DebugInfo\PDB\DIA\DIASupport.h(25): fatal error C1083: Cannot open include file: 'atlbase.h': No such file or directory
h-vetinari commented 1 month ago

To follow up here, Microsoft deleted some components out of their images, which caused this failure: https://github.com/actions/runner-images/issues/9873.

In particular, installing

                  "Microsoft.VisualStudio.Component.VC.v141.ATL"
                  "Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL"

(or whatever equivalent for the given VS version) should fix things.

I guess this issues can thus be closed.