ilammy / msvc-dev-cmd

GitHub Action to setup Developer Command Prompt for Microsoft Visual C++
MIT License
329 stars 44 forks source link

When specified `with arch: x86`, Python is actually the `x64` version. #67

Closed sunshaoce closed 11 months ago

sunshaoce commented 11 months ago

This issue may come from updates to the Visual Studio version in the GitHub CI, as I am not an expert in this field. I hope to receive some assistance.

I have a CI setup to build LLVM for Win32 once a week. This is the link to the last successful action: https://github.com/sunshaoce/install-llvm/actions/runs/5638918633

This is the link to the failed action one week later: https://github.com/sunshaoce/install-llvm/actions/runs/5779073267

I think the issue might stem from the variations here: https://github.com/sunshaoce/install-llvm/actions/runs/5638918633/job/15273529887#step:3:1048

https://github.com/sunshaoce/install-llvm/actions/runs/5779073267/job/15660949742#step:3:1084

pzhlkj6612 commented 11 months ago

Hi.

Question: is the minimal reproducible example of your action as the follows?

jobs:
  build_and_test:
    name: Build LLVM on Windows
    runs-on: windows-latest
    steps:

    - name: Install Ninja (Windows)
      run: choco install -y --no-progress ninja
      shell: pwsh

    - name: Checkout LLVM project (Windows)
      uses: actions/checkout@v3.5.0
      with:
        repository: 'llvm/llvm-project'
        ref: 'llvmorg-16.0.1'
        path: './llvm-project'

    # Required to find cl.exe
    - name: Setup devcmd (Windows)
      uses: ilammy/msvc-dev-cmd@v1.12.1
      with:
        arch: x86

    - name: Build and install LLVM project (Windows)
      env:
        # CMake build type
        BUILD_TYPE: Release
      run: |
        cd "${{github.workspace}}\llvm-project"
        cmake -G Ninja -B ".\build" -S ".\llvm" -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DLLVM_ENABLE_PROJECTS="clang;lldb" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DLLDB_INCLUDE_TESTS=OFF
        cmake --build ".\build" --config ${{env.BUILD_TYPE}}
        cmake --install ".\build" --config ${{env.BUILD_TYPE}} --prefix ".\inst"
      shell: pwsh

If not, please provide a simple config to make it easier for others to debug.

sunshaoce commented 11 months ago

That's right, it's indeed the issue. Thank you so much for offering this helpful minimal example.

pzhlkj6612 commented 11 months ago

OK.

What if you insert an "actions/setup-python" before the build step? This may cover possible bugs in "msvc-dev-cmd", but make your workflow work again.

sunshaoce commented 11 months ago

It works, thanks very much!