microsoft / winget-pkgs

The Microsoft community Windows Package Manager manifest repository
MIT License
8.77k stars 4.58k forks source link

[Package Request]: mingw-w64 #122962

Open BrainSlugs83 opened 1 year ago

BrainSlugs83 commented 1 year ago

How can we help?

I would like someone else to build the manifest.

Please read and ensure the following

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.

mdanish-kh commented 1 year ago

This package should already be available under PackageId MSYS2.MSYS2

Can you give winget install MSYS2.MSYS2 a try?

Dragon1573 commented 1 year ago

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 https://github.com/microsoft/winget-pkgs/issues/123032#issuecomment-1768697429

BrainSlugs83 commented 1 year ago

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...)

Dragon1573 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 2 months ago

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).