msys2 / setup-msys2

GitHub Action to setup MSYS2
https://github.com/marketplace/actions/setup-msys2
MIT License
285 stars 38 forks source link

is there an install syntax to specify package version? #287

Closed fangq closed 1 year ago

fangq commented 1 year ago

I would trying to install a specific version of gcc (gcc-9) in an action setting, but could not find any examples to do so - is this supported?

additionally, I am looking for the package that provides static library libgomp.a, I only found that mingw-w64-x86_64-gcc-libs provides libgomp.so, but not the static library.

any help is appreciated!

Biswa96 commented 1 year ago

It is not possible to install old packages like that. Old packages can be found in https://mirror.msys2.org/mingw/ repository. But installing them may break the whole setup and you have to manually install those packages with pacman -U <full-link-here> command.

Biswa96 commented 1 year ago

I would trying to install a specific version of gcc (gcc-9) in an action setting

In the actions log, there seems to be some path conflict between the mingw toolchains in chocolatey and msys2. If you have any issue with latest gcc toolchain it may be fixed faster than using old gcc.

fangq commented 1 year ago

thanks for your quick reply and helpful comments. I realized that pacman and msys2 was made for rolling releases, which is aimed to only serve the latest.

In the actions log, there seems to be some path conflict between the mingw toolchains in chocolatey and msys2. If you have any issue with latest gcc toolchain it may be fixed faster than using old gcc.

I agree. The actual issue I am trying to solve is the missing of static libraries: libz.a, libgomp.a and libpthread.a when I used the default Mingw64 8.1 gcc toolchain provided by the windows-2019 runner. here is the log

https://github.com/fangq/mmc/actions/runs/4356395089/jobs/7614344016

I searched and only found commands to install packages via msys2, if I am able to locate the packages in msys2 that provides these .a files, I should be able to set shell: msys2 and use the mingw64 gcc installed on msys2 (12.x) to complete the compilation;

I just tried to mix the mingw64 gcc (9.0.2) with the .a files extracted from msys2, but it failed with undefined reference errors

https://github.com/fangq/mmc/actions/runs/4357600651/jobs/7617111580

I thought that if I could downgrade the msys2 gcc version, I may have a better luck to link.

alternatively, I may be able to solve this by finding an action script to install libraries for mingw64 instead of msys2, but I failed to find such command :-(

Biswa96 commented 1 year ago

if I am able to locate the packages in msys2 that provides these .a files

You can search files with pacman. For example, here I am searching for libpthread.a in ucrt64

$ pacman -Fq libpthread.a | grep ucrt
ucrt64/mingw-w64-ucrt-x86_64-winpthreads-git
fangq commented 1 year ago

In the actions log, there seems to be some path conflict between the mingw toolchains in chocolatey and msys2. If you have any issue with latest gcc toolchain it may be fixed faster than using old gcc.

@Biswa96, you were spot-on! turned out most of my struggle was a result of mixing gcc versions - I added path to Octave's bin folder which also contains a bundled gcc. After appending mingw64's gcc path in GITHUB_ENV, I was able to run static linking without needing to install any additional package (or msys2 environment).

closing the ticket. thanks again for all the helpful comments!