llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

The 18.1.2 binary windows release (the .tar.xz file) has a dependency on visual studio 2019 professional

Open ThosRTanner opened this issue 1 year ago • 5 comments

Trying to build a cmake project with visual studio 2022 community after unpacking "clang+llvm-18.1.2-x86_64-pc-windows-msvc.tar.xz" results in this output:

------ Build started: Project: CMakeLists, Configuration: Debug ------ C:\Users\Dad\Repositories\github\Include What You Use\include-what-you-use\out\build\x64-Clang-Debug\ninja : error : 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/DIA SDK/lib/amd64/diaguids.lib', needed by 'bin/include-what-you-use.exe', missing and no known rule to make it

Build failed.

ThosRTanner avatar Mar 22 '24 06:03 ThosRTanner

https://discourse.llvm.org/t/llvm-17-0-0-rc2-tagged/72643/8

cc @zmodem

zufuliu avatar Mar 22 '24 10:03 zufuliu

I don't think building against the .lib files in that package is likely to work in general. If anyone wants to try to make it work, patches are welcome.

zmodem avatar Mar 22 '24 11:03 zmodem

I don't think building against the .lib files in that package is likely to work in general. If anyone wants to try to make it work, patches are welcome.

I'm sorry, I think I misread OP's question: using the package to build "include-what-you-use", and CMake doesn't find diaguids.lib from Visual Studio 2022's DIA SDK but strangely refer to Visual Studio 2019's.

@ThosRTanner I think you need to run CMake under "x64 Native Tools Command Prompt for VS 2022" (or similar) to correct set build environments for Visual Studio's DIA SDK. So, maybe this is not a LLVM problem or some CMake files in the package hard-coded MSVC_DIA_SDK_DIR, need time to check.

zufuliu avatar Mar 22 '24 12:03 zufuliu

I find following (line 475 to 478) from clang+llvm-18.1.2-x86_64-pc-windows-msvc\lib\cmake\llvm\LLVMExports.cmake:

# Create imported target LLVMDebugInfoPDB
add_library(LLVMDebugInfoPDB STATIC IMPORTED)

set_target_properties(LLVMDebugInfoPDB PROPERTIES
  INTERFACE_LINK_LIBRARIES "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/DIA SDK/lib/amd64/diaguids.lib;LLVMBinaryFormat;LLVMObject;LLVMSupport;LLVMDebugInfoCodeView;LLVMDebugInfoMSF"
)

zufuliu avatar Mar 22 '24 14:03 zufuliu

That looks very like a hardcoded reference that I can't avoid however I build.

ThosRTanner avatar Mar 24 '24 06:03 ThosRTanner

https://discourse.llvm.org/t/llvm-assumes-specific-visual-studio-installation-after-build/79857/3

zufuliu avatar Jun 28 '24 11:06 zufuliu

ok this can be fixed via

      - name: install DIA SDK
        run: |
          set -x
          mkdir -p "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional" || true
          cp -rv "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/DIA SDK" "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/DIA SDK"

ZLangJIT avatar Jul 10 '24 09:07 ZLangJIT

ok this can be fixed via

      - name: install DIA SDK
        run: |
          set -x
          mkdir -p "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional" || true
          cp -rv "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/DIA SDK" "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/DIA SDK"
      - name: install DIA SDK
        if: runner.os == 'Windows'
        shell: bash
        run: |
          set -x
          mkdir -p "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional" || true
          cp -rv "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/DIA SDK" "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/DIA SDK"

Ziqi-Yang avatar Jul 31 '24 07:07 Ziqi-Yang

So other than copying from where it is on the current machine to where LLVM expects it to be, what's the fix here?

makslevental avatar Aug 15 '24 03:08 makslevental

This problem still persists in 19.1.7

hyt589 avatar Feb 22 '25 15:02 hyt589

Still an issue in 20.1.8, who the hell thought it is a good idea to hardcode specific version of Visual Studio? The very reason I installed clang is that I don't want to use MSVC

dkaszews avatar Aug 21 '25 08:08 dkaszews