llvm / llvm-project

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

Compilation error LLVM 11.0 with Windows 64-bit compiler #47276

Open llvmbot opened 3 years ago

llvmbot commented 3 years ago
Bugzilla Link 47932
Version trunk
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @AaronBallman,@pogo59

Extended Description

I try to compile LLVM version 11.0 with 64-bit Windows compiler and I get: [ 72%] Building CXX object tools/clang/lib/ARCMigrate/CMakeFiles/obj.clangARCMigrate.dir/Transforms.cpp.obj Transforms.cpp E:\Programs\LLVM\11.0\llvm-project\clang\lib\ARCMigrate\Transforms.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj

How to overcome this problem (or is it a bug)?

Mote important information (as far as I can see) from cmake stage:

cmake -G "NMake Makefiles" -DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra ..\llvm -- The C compiler identification is MSVC 19.16.27034.0 -- The CXX compiler identification is MSVC 19.16.27034.0 -- The ASM compiler identification is MSVC -- Found assembler: D:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works

llvmbot commented 3 years ago

In the master version I found: llvm/cmake/modules/HandleLLVMOptions.cmake: append("/bigobj" CMAKE_CXX_FLAGS)

so here it looks like to be solved, maybe a port back for 11.0 would be in place.

In the mean time I found another place in 11.0: file: clang-tools-extra\clang-tidy\modernize\CMakeLists.txt missing: if (MSVC) set_source_files_properties(LoopConvertCheck.cpp PROPERTIES COMPILE_FLAGS /bigobj) endif()

Not that in the master version I still found: clang/lib/ARCMigrate/CMakeLists.txt: set_source_files_properties(Transforms.cpp PROPERTIES COMPILE_FLAGS /bigobj)

AaronBallman commented 3 years ago

Aaron, didn't we fix the CMake files to turn /bigobj on unconditionally instead of doing it file-by-file? I remember there was talk about it.

Yeah, wasn't that done by https://reviews.llvm.org/rG80bd6ae13ea23d453a1f45d6ccdbfc7d0c877bb0 in order to address llvm/llvm-project#46078 ?

pogo59 commented 3 years ago

Aaron, didn't we fix the CMake files to turn /bigobj on unconditionally instead of doing it file-by-file? I remember there was talk about it.

llvmbot commented 3 years ago

Looks like the file: clang/lib/ARCMigrate/CMakeLists.txt

in the master version has been corrected for this with:

By default MSVC has a 2^16 limit on the number of sections in an object

file, and Transforms.cpp needs more than that.

if (MSVC) set_source_files_properties(Transforms.cpp PROPERTIES COMPILE_FLAGS /bigobj) endif()

Probably this should be ported back to version 11.0 as well