question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using MSVC compiler with msys

See original GitHub issue

I’ve been having trouble configuring my windows build to use the Visual Studio compiler (cl) in an msys shell. I’ve tried a variety of configurations and PATH manipulations, but nothing seems to work. Example workflow:

- name: Run batch file and set path
  run: | 
    C:\"Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
    echo "/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29910/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
    which cl # returns the correct path
- uses: msys2/setup-msys2@v2
  with:
    update: true
    install: >-
      base-devel
      git
    path-type: inherit
- name: Build project
  run: |
    ./coinbrew/coinbrew build my-repo
  shell: msys2 {0}

Running this workflow errors because it can’t find the compiler:

checking for icl... no
checking for cl... no
configure: error: Neither MS nor Intel C compiler found in PATH and CC is unset.
Error: Process completed with exit code 1.

I’ve confirmed that the PATH is being preserved with the inherit parameter, but for some reason my program can’t seem to find the compiler. This configuration work fine on AppVeyor.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
xmunozcommented, May 14, 2021

For posterity, here is what my final config looked like:

...
      - name: Set up msvc
        uses: ilammy/msvc-dev-cmd@v1
      - name: Set up msys
        uses: msys2/setup-msys2@v2
        with:
          update: true
          install: >-
            base-devel
            git
          path-type: inherit
      - name: Build project
        run: |
          # all my build commands
        shell: msys2 {0}
...
1reaction
Biswa96commented, May 14, 2021

Why do you want to use MSVC in msys2?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bringing Visual Studio compiler into MSYS2 environment
One solution is to use MSYS2 environment. It's a msys/cygwin-like shell that effectively provides you with a bash shell, and this runs on ......
Read more >
Environments - MSYS2
The MSYS environment contains the unix-like/cygwin based tools, lives under /usr and are special in that it is always active. All the other...
Read more >
Get Started with C++ and Mingw-w64 in Visual Studio Code
In this tutorial, you configure Visual Studio Code to use the GCC C++ compiler (g++) and GDB debugger from mingw-w64 to create programs...
Read more >
Using Visual Studio Code for C++ (Part 1 - Windows, MSYS ...
Installing and using Visual Studio Code and g++ (plus other tools) for (re)learning programming (and some entertainment purposes) - Part 1 - Windows...
Read more >
Do libraries compiled with MinGW work with MSVC?
No, libraries compiled on MinGW can't be used with MSVC. The main reasons are: Lack of ABI compatibility. That is to say that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found