Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MinGW on Windows 2022 #5729

Merged
merged 5 commits into from
Jun 16, 2022
Merged

Update MinGW on Windows 2022 #5729

merged 5 commits into from
Jun 16, 2022

Conversation

abrown
Copy link
Contributor

@abrown abrown commented Jun 13, 2022

Description

Previously, the GitHub virtual environments only had MinGW v8.1.0
installed. That version was released in October of 2018 and, since then,
MinGW has released versions all the way up to v11.2.0. This change
updates the MinGW version to the latest available on Chocolatey for the
Windows 2022 environment. Windows 2019 retains the current v8.1.0
version. Fixes #5530.

Related issue:

Check list

  • Related issue / work item is attached
  • Tests are written (if applicable)
  • Documentation is updated (if applicable)
  • Changes are tested and related VM images are successfully generated

abrown added 3 commits June 13, 2022 10:01
Previously, the GitHub virtual environments only had MinGW v8.1.0
installed. That version was released in October of 2018 and, since then,
MinGW has released versions all the way up to v11.2.0. This change
updates the MinGW version to the latest available on Chocolatey for the
Windows 2022 environment. Windows 2019 retains the current v8.1.0
version. Fixes actions#5530.
@abrown
Copy link
Contributor Author

abrown commented Jun 13, 2022

cc: @miketimofeev, @igorboskovic3; not sure what the correct flow is to merge this kind of PR so some help is appreciated. I don't believe this requires a new test (but you tell me) and I don't really have a great way to test this locally in any case so I'm hoping that the CI tests cover this change (?).

@@ -69,7 +69,7 @@
- Kind 0.14.0
- Kubectl 1.24.1
- Mercurial 5.0
- Mingw-w64 8.1.0
- Mingw-w64 11.2.0-07112021
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abrown no need to update the readme. It is autogenerated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I reverted that commit. Can you approve the CI run?

@miketimofeev
Copy link
Contributor

/azp run windows2019, windows2022

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@abrown
Copy link
Contributor Author

abrown commented Jun 15, 2022

@miketimofeev, I looked at the build error but I couldn't make much sense of it.

@al-cheb
Copy link
Contributor

al-cheb commented Jun 15, 2022

@abrown
Copy link
Contributor Author

abrown commented Jun 15, 2022

Ok, here is the current string when I install the latest version of MinGW using chocolatey:

> gcc --version
gcc.exe (MinGW-W64 x86_64-posix-seh, built by Brecht Sanders) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This means that reducing the Select-String pattern is probably enough to get things to work. Commit incoming...

@miketimofeev
Copy link
Contributor

/azp run windows2019, windows2022

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@miketimofeev miketimofeev merged commit 89ee433 into actions:main Jun 16, 2022
@abrown abrown deleted the update-mingw branch June 16, 2022 15:20
abrown added a commit to abrown/ittapi that referenced this pull request Jun 16, 2022
Now that actions/runner-images#5729 has
merged, GitHub runners using `windows-latest` (i.e., Windows 2022)
should have a later version of MinGW (i.e., 11.2.0) that solves the
build issues observed in this repository. Recall that the `strnlen_s`
function is not available on older versions of MinGW but was necessary
to compile the C library. With this change, CI will use GitHub's MinGW
version instead of manually installing a new one.
abrown added a commit to intel/ittapi that referenced this pull request Jun 23, 2022
Now that actions/runner-images#5729 has
merged, GitHub runners using `windows-latest` (i.e., Windows 2022)
should have a later version of MinGW (i.e., 11.2.0) that solves the
build issues observed in this repository. Recall that the `strnlen_s`
function is not available on older versions of MinGW but was necessary
to compile the C library. With this change, CI will use GitHub's MinGW
version instead of manually installing a new one.
@TheVice
Copy link

TheVice commented Jun 28, 2022

Hello.

Did somebody catch the issue with run of C++ application made by recently updated MinGW at the Windows virtual environment? It required some of libraries from MinGW bin directory and set it to the PATH will not help for some reason.

I planned to provided simple project that reproduce that issue, but they work correctly like with MinGW 8.1.0.
So made long story short I propose to view one of test workflow at the project where I detected an issue with MinGW 11.2 and where provided one of hard code way to bypass the issue (see run where patch provided for windows-2022 agent). Run with MinGW 8.1.0, for comparing, also provided at the link above.
Simple project can be found in issue #6103.

While reproduce the environment locally I detected - that choco adding path to bin at the PATH environment only for the user who install it. So if another user used to run pipeline – adding path to folder with libraries (libstdc++-6.dll and libgcc_s_seh-1.dll) that required to run C++ application will be enough. I added such path while pipeline run - at local environment it help, for remote - no.

Probably there is an conflict with another folder from PATH environment, where file(s) with same name(s) may be provided, so directly copying of that libraries to the directory with executable will help with searching of correct version of dll files.

Thank you.

P.S.
Patch that was provided is next:

    - name: Add libraries to the folder with application that was made with MinGW
      if: ${{ matrix.patch && 'mingw' == matrix.compiler }}
      run: |
        $path = "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin\cpp.exe"
        if(Test-Path -Path $path)
        {
          $argument = "--version"
          $source = "$env:TEMP\1.txt"
          Start-Process -FilePath $path -ArgumentList $argument -NoNewWindow -Wait -RedirectStandardOutput $source
          $source = [System.IO.File]::ReadAllLines($source)[0]
          $argument = $source.LastIndexOf(" ")
          $argument++
          $source = $source.Substring($argument)
          $ver = [System.Version]::Parse($source)
          if([System.Version]::Parse("9.0") -le $ver)
          {
            Write-Warning -Message "Patch will be apply."
            $path = "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin\libstdc++-6.dll"
            if(Test-Path -Path $path)
            {
              cp $path ${{ env.BINARY_PATH }}
            }
            else
            {
              Write-Warning -Message $path
            }
            $path = "C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin\libgcc_s_seh-1.dll"
            if(Test-Path -Path $path)
            {
              cp $path ${{ env.BINARY_PATH }}
            }
            else
            {
              Write-Warning -Message $path
            }
          }
          else
          {
            Write-Host "Nothing to do."
          }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Mingw on windows
4 participants