Coder Social home page Coder Social logo

setup-mingw's Introduction

Set up MinGW-w64

Test

This GitHub action sets up MinGW-w64 in your workflow run.

  1. Installs MinGW-w64 on either Ubuntu or Windows.
  2. Fixes the infamous libwinpthread-1.dll static linking issue.

Use it in your workflow like this:

- name: Set up MinGW
  uses: egor-tensin/setup-mingw@v2
  with:
    platform: x64
  • x64 is the default value for the platform parameter and can be omitted. Use x86 if you want to build 32-bit binaries.
  • Set the cygwin parameter to 1 to set up MinGW inside an existing Cygwin installation (see my other action for setting up Cygwin itself).
  • cc and c++ executables are set up, pointing to the *-gcc and *-g++ executables. Disable this by setting the cc parameter to 0.

API

Input Value Default Description
platform x64 Install the x86_64 toolchain.
any Install the i686 toolchain.
cygwin any Install native binaries.
1 Install Cygwin packages.
static 1 Enable the static-linking workaround.
any Disable the static-linking workaround.
cc 1 Set up cc/c++ executables.
any Don't set up cc/c++.
hardlinks any Cygwin: don't convert any symlinks.
1 Cygwin: convert symlinks in /usr/bin to hardlinks.
version Install the default (latest) version.
any Install the specified version, if possible.
Output Example Description
prefix x86_64-w64-mingw32 Cross-compilation toolchain prefix
gcc x86_64-w64-mingw32-gcc gcc binary name
gxx i686-w64-mingw32-g++ g++ binary name
windres i686-w64-mingw32-windres windres binary name

License

Distributed under the MIT License. See LICENSE.txt for details.

setup-mingw's People

Contributors

egor-tensin avatar general-kroll-4-life avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

setup-mingw's Issues

Can't run on windows-latest

I can't run it only on windows-latest
log:

Chocolatey v2.2.2
Upgrading the following packages:
mingw
By upgrading, you accept licenses for the packages.
mingw is not installed. Installing...

mingw v13.2.0
mingw package files upgrade completed. Performing other installation steps.
Downloading mingw 64 bit
  from 'https://github.com/niXman/mingw-builds-binaries/releases/download/13.2.0-rt_v11-rev0/x86_64-13.2.0-release-posix-seh-ucrt-rt_v11-rev0.7z'

Download of x86_64-13.2.0-release-posix-seh-ucrt-rt_v11-rev0.7z (69.57 MB) completed.
Hashes match.
Extracting C:\Users\runneradmin\AppData\Local\Temp\chocolatey\mingw\13.2.0\x86_64-13.2.0-release-posix-seh-ucrt-rt_v11-rev0.7z to C:\ProgramData\chocolatey\lib\mingw\tools\install...
C:\ProgramData\chocolatey\lib\mingw\tools\install
Testing path: C:\ProgramData\mingw64\mingw32\bin
Testing path: C:\ProgramData\mingw64\mingw64\bin
PATH environment variable does not have C:\ProgramData\mingw64\mingw64\bin in it. Adding...
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 The upgrade of mingw was successful.
  Software installed to 'C:\ProgramData\chocolatey\lib\mingw\tools\install'

Chocolatey upgraded 1/1 packages. 
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Remove-Item: D:\a\_temp\26a2006e-59c9-41e5-bcb8-2abcadb1ba96.ps1:140
Line |
 140 |          Remove-Item (Join-Path $mingw_lib 'libpthread.dll.a')
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path
     | 'C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\lib\libpthread.dll.a' because it
     | does not exist.

Error: Process completed with exit code 1.

Bug: Could not install MinGW on github runner

When executing

uses: egor-tensin/setup-mingw@v2 
    with:
        platform: x64

following error message is displayed.

Error while running 'C:\ProgramData\chocolatey\lib\mingw\tools\chocolateyinstall.ps1'.
 See log for details.
Chocolatey upgraded 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures
 - mingw (exited 404) - Error while running 'C:\ProgramData\chocolatey\lib\mingw\tools\chocolateyinstall.ps1'.
 See log for details.

Warning: The `set-output` command is deprecated

On this configuration:

uses: egor-tensin/setup-mingw@v2
with:
    platform: x86

This warning is printed:

Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

This doesn't work on self-hosted Windows runners

Most notably:

  • "pwsh" is often not the official command to start PowerShell
  • Running .ps1 scripts is disabled by default on Windows
  • This script relies on Chocolatey to run, which isn't part of the default package

Can this action be cached / sped up?

I am not as proficient with Github Actions, so forgive me for asking if this is a trivial thing.

For my project, I use this awesome action and it works as expected (Installs MinGW32 bit version). However, it takes 8-9 minutes to install MinGW. I was wondering if this step could be cached, as this step is everytime the same?

See also:
https://github.com/stefanhendriks/Dune-II---The-Maker/runs/4582880457?check_suite_focus=true

And the yml file:
https://github.com/stefanhendriks/Dune-II---The-Maker/blob/master/.github/workflows/build_cmake.yml

The plugin now no longer works on x86

The plugin now no longer works on x86 and throws this exception:

`Chocolatey` upgraded 1/1 packages. 
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Remove-Item: D:\a\_temp\d5bbce78-0bb4-467d-86c8-58d03d7142e8.ps1:140
Line |
 140 |          Remove-Item (Join-Path $mingw_lib 'libpthread.dll.a')
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path
     | 'C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw32\i686-w64-mingw32\lib\libpthread.dll.a' because it
     | does not exist.

Here the workflow

Successfully installed but failed when cleaning up temp files?

 Remove-Item: D:\a\_temp\79760d0f-a2ca-46fa-8a22-5a02d37125a5.ps1:140
Line |
 140 |          Remove-Item (Join-Path $mingw_lib 'libpthread.dll.a')
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path
     | 'C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\lib\libpthread.dll.a' because it
     | does not exist.

Error: Process completed with exit code 1.

It looked like the action was executing just fine and had installed MingW64, until this line. It caused the whole job to fail.

Can't get 32 bit version to work properly

Using this simple workflow:

name: Test Environment variables

on:
  workflow_dispatch:

jobs:
  Echo:
    name: Test Environment variables
    runs-on: windows-latest
  
    steps:
      - name: SetUp mingw
        uses: egor-tensin/setup-mingw@v2
        with:
          platform: x86

      - name: Show version
        run: |
          refreshenv
          make --version

I guess that mingw is installed into C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw32\ because I get
PATH environment variable does not have C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw32\bin in it. Adding...

However, running the make command I get the error
Cannot find file at '..\\lib\mingw\tools\install\mingw64\bin\mingw32-make.exe' (C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin\mingw32-make.exe). This usually indicates a missing or moved file.

Why is it looking in C:\ProgramData\Chocolatey\lib\mingw\tools\install\mingw64\bin while it was installed in a mingw32-directory?

`-Wformat` warnings when using `%z`

https://github.com/KhronosGroup/Vulkan-ValidationLayers/actions/runs/4349039769/jobs/7598236919

 [12/71] Building CXX object layers/CMakeFiles/VkLayer_khronos_validation.dir/core_checks/descriptor_validation.cpp.obj
D:/a/Vulkan-ValidationLayers/Vulkan-ValidationLayers/layers/core_checks/descriptor_validation.cpp: In member function 'virtual bool CoreChecks::PreCallValidateCmdBindDescriptorSets(VkCommandBuffer, VkPipelineBindPoint, VkPipelineLayout, uint32_t, uint32_t, VkDescriptorSet_T* const*, uint32_t, const uint32_t*) const':
D:/a/Vulkan-ValidationLayers/Vulkan-ValidationLayers/layers/core_checks/descriptor_validation.cpp:345:29: warning: unknown conversion type character 'z' in format [-Wformat=]
  345 |                          "(%zu) when pipeline layout was created",
      |                             ^
D:/a/Vulkan-ValidationLayers/Vulkan-ValidationLayers/layers/core_checks/descriptor_validation.cpp:343:26: warning: too many arguments for format [-Wformat-extra-args]
  343 |                          "vkCmdBindDescriptorSets(): Sum of firstSet (%u) and descriptorSetCount (%u) is greater than "
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  344 |                          "VkPipelineLayoutCreateInfo::setLayoutCount "
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  345 |                          "(%zu) when pipeline layout was created",
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Looks like the version of gcc installed by setup-mingw doesn't support %z?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.