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

[Package Request]: mingw-w64 #122962

Open
1 task
BrainSlugs83 opened this issue Oct 17, 2023 · 17 comments
Open
1 task

[Package Request]: mingw-w64 #122962

BrainSlugs83 opened this issue Oct 17, 2023 · 17 comments
Labels
Package-Request This is a request for a package (new or updated version)

Comments

@BrainSlugs83
Copy link

BrainSlugs83 commented Oct 17, 2023

How can we help?

I would like someone else to build the manifest.

Please read and ensure the following

  • The installer meets the above requirements

Please provide the following information

Download Page Url: https://www.mingw-w64.org/downloads/, https://www.msys2.org/
Package Name: mingw-w64
Description: mingw gcc compilers for windows
Installer URL: https://github.com/msys2/msys2-installer/releases/download/2023-07-18/msys2-x86_64-20230718.exe

Right now installing mingw on Windows is a bear.

No, this does not meet the above requirements, but some cross collaboration between the MSYS2 and Winget teams would be really helpful.

Every other platform has a standard package manager that can install gcc. IMO, Windows really needs this.

Currently, we have to install a completely different package manager to get it installed... it's a lot of hoops to jump through just to compile some code.

@BrainSlugs83 BrainSlugs83 added Help-Wanted This is a good candidate work item from the community. Package-Request This is a request for a package (new or updated version) labels Oct 17, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage This work item needs to be triaged by a member of the core team. label Oct 17, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added In-PR and removed Help-Wanted This is a good candidate work item from the community. labels Oct 18, 2023
@mdanish-kh
Copy link
Contributor

mdanish-kh commented Oct 18, 2023

This package should already be available under PackageId MSYS2.MSYS2

Can you give winget install MSYS2.MSYS2 a try?

@Dragon1573
Copy link
Contributor

Checks with winget search and winget show.

PS> winget search MSYS2.MSYS2
名称  ID          版本     源
----------------------------------
MSYS2 MSYS2.MSYS2 20230718 winget
PS> winget show MSYS2.MSYS2
已找到 MSYS2 [MSYS2.MSYS2]
版本: 20230718
发布者: The MSYS2 Developers
发布服务器 URL: https://www.msys2.org/
发布服务器支持 URL: https://www.msys2.org/contact/
作者: The MSYS2 Developers
描述: MSYS2 是一套工具和库的集合,为构建、安装和运行原生 Windows 软件提供易于使用的环境。
主页: https://github.com/msys2/msys2-installer
许可证: BSD-3-Clause
许可证 URL: https://github.com/msys2/msys2-installer/blob/main/LICENSE
版权所有: Copyright 2023 MSYS2 devs
发行说明: - The usual round of package updates
发行说明 URL: https://github.com/msys2/msys2-installer/releases/tag/2023-07-18
文档:
  文档: https://www.msys2.org/docs/what-is-msys2/
  Wiki: https://www.msys2.org/wiki/Home/
安装:
  安装程序类型: exe
  安装程序 URL: https://github.com/msys2/msys2-installer/releases/download/2023-07-18/msys2-x86_64-20230718.exe
  安装程序 SHA256: deab67221a974e68a62f5967fe4b6fe895eb396585fe0ed4eaf9f3e656b873e0
  发布日期: 2023-07-18

Originally posted by @Dragon1573 in #123032 (comment)

@BrainSlugs83
Copy link
Author

BrainSlugs83 commented Oct 18, 2023

This package should already be available under PackageId MSYS2.MSYS2

Can you give winget install MSYS2.MSYS2 a try?

Right, but once you install msys2 -- you need to open their special msys2 console and then do a pacman -S mingw-w64-ucrt-x86_64-gcc -- and then you need to manually configure it (not documented on their site that I can see) by adding a bunch of environment variables and paths and such...

So like I said, you still need to use a second package manager and do a bunch of manual steps to fully install the full mingw toolchain to be usable from the regular console.

I would like to see a single package that I can just install and then be able to call gcc or gpp, etc. from the commandline -- rather than install multiple package managers and doing a bunch of manual steps. (That's kind of the point of package managers, to do less manual work installing packages...)

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention This work item needs to be reviewed by a member of the core team. and removed Needs-Author-Feedback This needs a response from the author. labels Oct 18, 2023
@BrainSlugs83 BrainSlugs83 removed their assignment Oct 18, 2023
@stephengillie stephengillie removed Needs-Triage This work item needs to be triaged by a member of the core team. Needs-Attention This work item needs to be reviewed by a member of the core team. labels Oct 18, 2023
@Dragon1573
Copy link
Contributor

So like I said, you still need to use a second package manager and do a bunch of manual steps to fully install the full mingw toolchain to be usable from the regular console.

I see several vendors release their toolchains as compressed ZIP archives. winget.exe does support ZIP archive as installer, but it would prefer "portable", "standalone", "all-in-one" executable as the nested installer of target main application. gcc.exe, g++.exe, gdb.exe and other development tools have huge external dependencies (header files, dynamic link libraries) and could not be automatically solved by adding PackageDependencies in the manifest, so it will be regarded as "loose executable". Also, winget.exe does not have the ability to modify environment variables. We can extract these compiler application from the ZIP and create *.symlink files for them, but we can't sure if *.symlink files works as expected.

Not only GCC, MSVC (mainly cl.exe, recommended by Microsoft) can't be used directly in the terminal either. They recommend to launch a "Developer Shell" and use MSVC in it. The special shell will configure MSVC environment for you with a script at startup. If you want to use MSVC at anytime in any shell, you still have to configure 3 environment variables on your own.

image

@Dragon1573
Copy link
Contributor

If a vendor provides MSI or EXE installation wizard for GCC, the wizard can run unattendedly and will automatically configure everything (especially envrionment variables) for us, this issue will be easier to solve.

@BrainSlugs83
Copy link
Author

They recommend to launch a "Developer Shell" and use MSVC in it.

That's not really the same though... like it's just another cmd / powershell prompt with different settings.

MSYS2 is requiring you to run bash, and even then, it's still not configured, you have to open up their special bash prompt and then run pacman to install the gcc packages there.

@Dragon1573
Copy link
Contributor

skeeto/w64devkit may be better than MSYS2 in this case? Users only needs to decompress the zip file and launch w64devkit/w64devkit.exe (another shell prompt). This time gcc.exe, g++.exe, gdb.exe are immediately available.

(WSL2 Ubuntu fish) $ wslpath -w w64devkit/ && ls -alh w64devkit/
D:\Download\Aria2\Compressed\w64devkit
总计 72K
drwxr-xr-x 1 dragon1573 dragon1573 4.0K  8月  1 12:22 ./
drwxr-xr-x 1 dragon1573 dragon1573 4.0K 10月 19 13:39 ../
drwxr-xr-x 1 dragon1573 dragon1573 4.0K  8月  1 12:22 bin/
-rwxr--r-- 1 dragon1573 dragon1573  14K  8月  1 12:22 COPYING.MinGW-w64-runtime.txt*
-rwxr--r-- 1 dragon1573 dragon1573  18K  8月  1 11:21 Dockerfile*
drwxr-xr-x 1 dragon1573 dragon1573 4.0K  8月  1 12:22 include/
drwxr-xr-x 1 dragon1573 dragon1573 4.0K  8月  1 12:22 lib/
drwxr-xr-x 1 dragon1573 dragon1573 4.0K  8月  1 12:11 libexec/
-rwxr--r-- 1 dragon1573 dragon1573  11K  7月  6 17:41 README.md*
drwxr-xr-x 1 dragon1573 dragon1573 4.0K  8月  1 12:22 share/
drwxr-xr-x 1 dragon1573 dragon1573 4.0K  8月  1 12:21 src/
-rwxr--r-- 1 dragon1573 dragon1573    7  8月  1 12:22 VERSION.txt*
-rwxr--r-- 1 dragon1573 dragon1573  20K  8月  1 12:22 w64devkit.exe*
-rwxr--r-- 1 dragon1573 dragon1573  731  8月  5  2022 w64devkit.ini*
drwxr-xr-x 1 dragon1573 dragon1573 4.0K  8月  1 12:11 x86_64-w64-mingw32/                                                                                                                    
PS> cd D:\Download\Aria2\Compressed\w64devkit\
PS> .\w64devkit.exe
~ $ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=D:/Download/Aria2/Compressed/w64devkit/bin/../libexec/gcc/x86_64-w64-mingw32/13.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: /gcc-13.2.0/configure --prefix=/w64devkit --with-sysroot=/w64devkit/x86_64-w64-mingw32 --with-native-system-header-dir=/include --target=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-static --disable-shared --with-pic --with-gmp-include=/deps/include --with-gmp-lib=/deps/lib --with-mpc-include=/deps/include --with-mpc-lib=/deps/lib --with-mpfr-include=/deps/include --with-mpfr-lib=/deps/lib --enable-languages=c,c++ --enable-libgomp --enable-threads=posix --enable-version-specific-runtime-libs --disable-dependency-tracking --disable-multilib --disable-nls --disable-win32-registry --enable-mingw-wildcard CFLAGS_FOR_TARGET=-Os CXXFLAGS_FOR_TARGET=-Os LDFLAGS_FOR_TARGET=-s CFLAGS=-Os CXXFLAGS=-Os LDFLAGS=-s
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.0 (GCC)
~ $ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=D:/Download/Aria2/Compressed/w64devkit/bin/../libexec/gcc/x86_64-w64-mingw32/13.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: /gcc-13.2.0/configure --prefix=/w64devkit --with-sysroot=/w64devkit/x86_64-w64-mingw32 --with-native-system-header-dir=/include --target=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-static --disable-shared --with-pic --with-gmp-include=/deps/include --with-gmp-lib=/deps/lib --with-mpc-include=/deps/include --with-mpc-lib=/deps/lib --with-mpfr-include=/deps/include --with-mpfr-lib=/deps/lib --enable-languages=c,c++ --enable-libgomp --enable-threads=posix --enable-version-specific-runtime-libs --disable-dependency-tracking --disable-multilib --disable-nls --disable-win32-registry --enable-mingw-wildcard CFLAGS_FOR_TARGET=-Os CXXFLAGS_FOR_TARGET=-Os LDFLAGS_FOR_TARGET=-s CFLAGS=-Os CXXFLAGS=-Os LDFLAGS=-s
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.2.0 (GCC)
~ $ gdb -v
GNU gdb (GDB) 13.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
~ $ echo $SHELL
/bin/sh
~ $

BUT you still have to launch another shell for using GCC toolchains.

@BrainSlugs83
Copy link
Author

BrainSlugs83 commented Oct 19, 2023

BUT you still have to launch another shell for using GCC toolchains.

If it's just unzipping some exes, why do you need another command prompt? (I'm assuming it's some bash version and not the regular windows one?)

@Dragon1573
Copy link
Contributor

If it's just unzipping some exes, why do you need another command prompt? (I'm assuming it's some bash version and not the regular windows one?)

Yes, it is. This package provides a /bin/sh environment for running GCC series.

As I said, winget.exe have no ability to modify environment variables. This stuff should be done by the installation wizard. Installing build toolchains is not as easy as Installing a game.

@Dragon1573
Copy link
Contributor

In this case, use Scoop or Chocolatey may be better.

As I know, manifests in Scoop are written in JSON. They all support adding "pre-install" and "post-install" script for setting environment variables or registry. They may be able to install what you want.

@Redhawk18
Copy link

This package should already be available under PackageId MSYS2.MSYS2
Can you give winget install MSYS2.MSYS2 a try?

Right, but once you install msys2 -- you need to open their special msys2 console and then do a pacman -S mingw-w64-ucrt-x86_64-gcc -- and then you need to manually configure it (not documented on their site that I can see) by adding a bunch of environment variables and paths and such...

So like I said, you still need to use a second package manager and do a bunch of manual steps to fully install the full mingw toolchain to be usable from the regular console.

I would like to see a single package that I can just install and then be able to call gcc or gpp, etc. from the commandline -- rather than install multiple package managers and doing a bunch of manual steps. (That's kind of the point of package managers, to do less manual work installing packages...)

I agree with this, installing a C or C++ compiler is still a nightmare. All my plugins for Neovim need a C++ compiler to work properly. Anything else, Python, Nodejs, Ruby, has worked flawlessly like it would on linux.

@Kagami-sama
Copy link

This package should already be available under PackageId MSYS2.MSYS2
Can you give winget install MSYS2.MSYS2 a try?

Right, but once you install msys2 -- you need to open their special msys2 console and then do a pacman -S mingw-w64-ucrt-x86_64-gcc -- and then you need to manually configure it (not documented on their site that I can see) by adding a bunch of environment variables and paths and such...
So like I said, you still need to use a second package manager and do a bunch of manual steps to fully install the full mingw toolchain to be usable from the regular console.
I would like to see a single package that I can just install and then be able to call gcc or gpp, etc. from the commandline -- rather than install multiple package managers and doing a bunch of manual steps. (That's kind of the point of package managers, to do less manual work installing packages...)

I agree with this, installing a C or C++ compiler is still a nightmare. All my plugins for Neovim need a C++ compiler to work properly. Anything else, Python, Nodejs, Ruby, has worked flawlessly like it would on linux.

For using Neovim/LazyVim plugins, I used clang as c++ compiler (winget install llvm.llvm as admin).

@fgimian
Copy link
Contributor

fgimian commented Dec 14, 2024

I'm also hoping for this. Looking at the official MinGW website and the Scoop package. It seems that the MinGW-W64-builds as listed on the official website would be ideal.

These are available as compressed archives under https://github.com/niXman/mingw-builds-binaries/releases and provide pre-compiled binaries for gcc and g++, although they also provide quite a few other binaries too. Usually portable winget packages provide a few binaries, but this download provides a total of 59 which may not be quite what winget is hoping for.

@Dragon1573
Copy link
Contributor

These are available as compressed archives under https://github.com/niXman/mingw-builds-binaries/releases and provide pre-compiled binaries for gcc and g++, although they also provide quite a few other binaries too.

Warning

winget.exe DOES support compressed archives, but they HAVE TO be zip compressed.

@fgimian
Copy link
Contributor

fgimian commented Dec 14, 2024

These are available as compressed archives under https://github.com/niXman/mingw-builds-binaries/releases and provide pre-compiled binaries for gcc and g++, although they also provide quite a few other binaries too.

Warning

winget.exe DOES support compressed archives, but they HAVE TO be zip compressed.

Thanks for the reply, yeah I'm aware of that actually, but my point is that this particular compressed archive contains a very large number of executables which would need to be registered in the winget package and would possibly be considered polution of the path.

Indeed as you mentioned, the format of the archive is another problem.

Cheers
Fotis

@SpecterShell
Copy link
Contributor

SpecterShell commented Dec 14, 2024

Thanks for the reply, yeah I'm aware of that actually, but my point is that this particular compressed archive contains a very large number of executables which would need to be registered in the winget package and would possibly be considered polution of the path.

As most executables are located in mingw{32,64}/bin, only one directory would be added to PATH.

Indeed as you mentioned, the format of the archive is another problem.

WinGet by default uses the Windows Shell API, which only supports zip, for decompressing archive (see microsoft/winget-cli#2899). Other archive types such as .rar and .7z are not directly supported at the moment.

Right now you can use BrechtSanders.WinLibs as an alternative, which is also listed on the mingw-w64 website. I'll add LLVM-MinGW later.

@fgimian
Copy link
Contributor

fgimian commented Dec 14, 2024

Right now you can use BrechtSanders.WinLibs as an alternative, which is also listed on the mingw-w64 website. I'll add LLVM-MinGW later.

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package-Request This is a request for a package (new or updated version)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants