Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup jenkins windows slave node to support msys2 mingw shell

I want to build a program with a jenkins windows 7 node. The program is build using cmake but in the configure stage cmake tells me that there is no g++ compiler. I think this error occurs due to the wrong shell but I don't know how to set the right shell. The documentation says that the first sh file on windows is executed but msys2 needs mingw32.exe as the correct shell.

like image 399
Gustavo Avatar asked Sep 02 '25 05:09

Gustavo


1 Answers

For anyone coming across this in the future: There's a much simpler solution: Just run the Jenkins build agent directly within MSYS2 (specifically within the MinGW64 (or MinGW32) terminal/shell). All commands issued by Jenkins will then run inside of MSYS2.

The only trick here is to add an environment variable to the node (in the Jenkins master instance Web UI) to add the MinGW64 (or MinGW32) binaries to the PATH. For this, add an environment variable named PATH with value /mingw64/bin:$PATH.

That's literally all it takes.

I've created a detailed guide: https://blog.insane.engineer/post/jenkins_msys2

like image 128
Joel Bodenmann Avatar answered Sep 04 '25 23:09

Joel Bodenmann