msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.27k stars 1.21k forks source link

[gcc] Allow multiple versions #21661

Open felixf4xu opened 2 months ago

felixf4xu commented 2 months ago

Package name

gcc

New version number

No response

Other information that may be useful

On Ubuntu 24, gcc has 2 versions, default is version 13 and gcc-14 is also available.

On in msys2, I would suggest to have multiple versions of gcc (or maybe other packages), default is gcc (version 14, since msys2 always use the latest version as default), then gcc-13 can also be available.

Are you willing to submit a PR?

No response

Biswa96 commented 2 months ago

Why do you need multiple versions of gcc in mingw packages?

felixf4xu commented 2 months ago

As to my experience, later gcc compiler has stricter rules.

Some code can only be compiled by gcc-13, I know I can change the code itself, but in the open source world, every project has a very long chain of dependencies, it takes time and process to update.

In msys2, the latest version is always installed. So in CI/CD, when gcc is always installed from fresh, a gcc installation script worked a year ago when it's gcc-13, but it does not work today which is now gcc-14, and it can't go back.

By having 2 versions of gcc, the versions of the compiler can be co-existed and tested in parallel.

Biswa96 commented 2 months ago

Some code can only be compiled by gcc-13

Could you provide links to such projects?

felixf4xu commented 2 months ago

not sure if it will go offtopic, but save the code into main.c (not .cpp) and try with gcc-13 and 14:

#include <stdio.h>

int main(int, char**){
    static initialized; 
    printf("Hello, from ctest! %d\n", initialized++);
}

in gcc-13, it's a warning; in gcc-14, it's an error (default compiler switches).

More on this: https://gcc.gnu.org/gcc-14/porting_to.html

lazka commented 2 months ago

It would help testing for regressions etc. so I wouldn't mind providing current-1.

Kreijstal commented 2 months ago

It would help testing for regressions etc. so I wouldn't mind providing current-1.

would you name it gcc-previous or explicit gcc13

Biswa96 commented 2 months ago

would you name it gcc-previous or explicit gcc13

Arch Linux uses the later one gcc13 https://archlinux.org/packages/extra/x86_64/gcc13/

felixf4xu commented 1 month ago

thanks, I found in msys2 there are clang (v18) and clang-15