llvm / llvm-project

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

Failed to link with latest Windows SDK error MSB6006: "llvm-lib.exe" exited with code 1 #58692

Open zhenkas opened 2 years ago

zhenkas commented 2 years ago

I am getting linkage error on all project types (libs and DLLs) in 64-bit compilation

1>  C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\um\x64\ntdll.lib: truncated or malformed archive (long name offset characters after the '/' are not all decimal numbers: '<XFGHASHMAP>/' for archive member header at offset 262184)
1>  D:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1542,5): error MSB6006: "llvm-lib.exe" exited with code 1.

If I change SDK version to 10.0.19041.0 then it works.

Clang version

$ clang --version
clang version 14.0.5
Target: i686-pc-windows-msvc
Thread model: posix
InstalledDir: D:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\bin

MSBuild version

$ msbuild --version
MSBuild version 17.3.1+2badb37d1 for .NET Framework
17.3.1.41501

Windows SDK used

image

EugeneZelenko commented 2 years ago

Could you please try 15 or main branch?

zhenkas commented 2 years ago

I can do it only once it will arrive with VS 2022 update

On Sun, Oct 30, 2022, 15:36 EugeneZelenko @.***> wrote:

Could you please try 15 or main branch?

— Reply to this email directly, view it on GitHub https://github.com/llvm/llvm-project/issues/58692#issuecomment-1296260809, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGRSCMJOY267E22HLI3JEDWFZ2UPANCNFSM6AAAAAARSGXGVE . You are receiving this because you authored the thread.Message ID: @.***>

zhenkas commented 1 year ago

Finally I got version 15 and it is still failed to compile, but with another error 1>/<XFGHASHMAP>/: not a COFF object, bitcode, archive, import library or resource file 1>D:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1544,5): error MSB6006: "llvm-lib.exe" exited with code 1.

Also I discovered that this happens only to lib projects

DHowett commented 1 year ago

This is still an issue. The COFF check is emitting a diagnostic in LibDriver!appendFile after it attempts to determine what the incoming object type is.

kankowski commented 1 year ago

Agreed, it's still an issue in MSVC. If you install clang and the latest SDK (Windows 11) from Visual Studio installer, it's broken. You have to use Windows 10 SDK.

vinhnguyen500 commented 1 year ago

I get this error even when targeting Windows 10.0.19041.0

1> [CMake] -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19041.0.
1> [CMake] -- The C compiler identification is Clang 16.0.5 with MSVC-like command-line
1> [CMake] -- The CXX compiler identification is Clang 16.0.5 with MSVC-like command-line
    /<XFGHASHMAP>/: not a COFF object, bitcode, archive, import library or resource file
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1582,5): error MSB6006: "llvm-lib.exe" exited with code 1. 
determin1st commented 4 months ago

why do you use those build systems, they only obfuscate problems and let linkers stay obscure and unfriendly. im unable to find any docs of building with lld-link.exe, its kind of closed cult

zhenkas commented 4 months ago

You are right about "open source" but not about "close source"

On Mon, 15 Jul 2024, 03:13 determin1st, @.***> wrote:

why do you use those build systems, they only obfuscate problems and let linkers stay obscure and unfriendly. im unable to find any docs of building with lld-link.exe, its kind of closed cult

— Reply to this email directly, view it on GitHub https://github.com/llvm/llvm-project/issues/58692#issuecomment-2227532217, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGRSCIPF2JM2WKQGZ37KALZMMHZNAVCNFSM6AAAAABK3SKKTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRXGUZTEMRRG4 . You are receiving this because you authored the thread.Message ID: @.***>