Fix crash on Windows with -j option#4229
Fix crash on Windows with -j option#4229orbitcowboy merged 39 commits intocppcheck-opensource:mainfrom
Conversation
|
No idea why Cygwin can't grok this, |
|
Seems like the Cygwin detection doesn't work, since the additional flags don't even show up. |
|
Very quick fix!! 👍 |
|
The idea of passing |
|
Do we have evidence that anyone even uses Cygwin? I was unable to build cppcheck on a fresh installation due to some missing defines. |
I don't know. |
|
Does anybody know what exact Cygwin setup the CI uses? |
54724ff to
be493b7
Compare
I do frequently including a local build of cppcheck 2.7. Most or all of my cppcheck tickets were done with the Cygwin version. Cppcheck-2.7 could be build with a minor tweak: re-add |
|
After messing around with defines and config.h, I was able to complete a build. But the executable didn’t crash, unlike the CI.
|
So your build is broken, although we have Cygwin as a CI workflow? That's also interesting... |
Indeed. Which version of the Cygwin g++ toolchain and which If If this is fixed by either defining |
I take that partly back: --- lib/config.h.orig 2022-05-21 12:54:19.000000000 +0200
+++ lib/config.h 2022-07-03 14:13:55.919810500 +0200
@@ -111,5 +111,5 @@
#define THREADING_MODEL_THREAD
#define STDCALL
-#elif ((defined(__GNUC__) || defined(__sun)) && !defined(__MINGW32__) && !defined(__CYGWIN__)) || defined(__CPPCHECK__)
+#elif ((defined(__GNUC__) || defined(__sun)) && !defined(__MINGW32__)) || defined(__CPPCHECK__)
#define THREADING_MODEL_FORK
#elseA quick check of 2.8 with |
|
As far as I can tell, the CI installs Cygwin from a |
|
The reason I asked was that Cygwin gcc is also available as a cross toolchain for Fedora which is typically much older. The chocolatey package only installs a recent Cygwin setup*.exe which should then always pull the most recent packages. I still wonder how your CI builds work for Cygwin (not for a MinGW* build on Cygwin), as it obviously (see above) fails in |
|
Interesting. I will investigate this further and report the result separately as a ticket. |
|
You can use According to some cleanups in https://gitlab.gnome.org/GNOME/libxml2/-/commit/2489c1d024906d0f72bbcf709aeb53a24602c219 The Cygwin detection in the The GitHub CI might also not be great for these "Linux on Windows" derivates. I had build failures with MinGW in the CI but it was building fine locally. I have code locally which will provide the built-in define information in the build. |
|
I would even say that Cygwin detection does not work at all, see my earlier attempts in 54724ff |
|
There's another GitHub action which installs Cygwin: https://github.com/cygwin/cygwin-install-action
I think the detection is usually performed via Maybe we should try to build it with CMake and deprecate the (broken) make build for it to make things easier. |
|
It seems that Cygwin installation is just extremely old or somehow broken. Trying to build with MSYS2 also triggers the MSYS2 also does not set A PR to enable a MSYS build will be posted some time in the future. So we need to collect some more information from the Cygwin and MinGW jobs (compiler version, built-in defines, etc.) and then should probably disable them as they don't seem to represent what is current and go with local builds for now. |
The |
|
Yeah, but then why do Cygwin detection if those special flags aren't even needed for the CI build to succeed? The current Makefile is a mess.
I agree. |
Add |
|
From the CI: |
So it isn't actually Cygwin. Or it invokes a totally different compiler. It seems like they only carry the MinGW compiler now, but that should be at GCC 11.3.x: https://cygwin.com/pipermail/cygwin-announce/2022-May/010546.html So MSYS is now more Cygwin than Cygwin - what the... Also Cygwin 32-Bit will no longer be supported in the upcoming 3.4: https://cygwin.com/pipermail/cygwin-announce/2022-January/010439.html https://github.com/cygwin/cygwin-install-action is using the actual Cygwin setup and not chocolatey. Maybe that should be used instead. |
|
The Cygwin build now uses THREADING_MODEL_FORK. There was some discussion a couple of years ago indicating that forking does not work so well: https://trac.cppcheck.net/ticket/8973 |
|
Is it really a Cygwin compiler? In one of the earlier attempts I saw that it's a MinGW compiler. I also saw a hang with the MSYS build which is Cygwin based - no idea if it was with the thread or process code. |
I don't know what that means. The vanilla |
|
That means the compiler needs to have |
|
I think it is, since I was able to fix the build with 6b7538f |
Alright. This whole thing is something to take a closer look at when the whole thread/process stuff is being simplified. The suppression/ErrorLogger stuff needs to be sorted out first and it's a bitch... |
Short answer: The Cygwin fork() emulation works as expected. Long answer: A POSIX emulation layer like Cygwin would be useless if PS: You could also enable |
This reverts commit dd5d3e6.
|
Thanks for the approval. Someone still has to merge it though... |
So it seems like Cygwin is working quite okay. Do you think we can close https://trac.cppcheck.net/ticket/8973? FYI a potential hang with |
Yes. Build from current git HEAD uses THREADING_MODEL_FORK which works for me on 32-bit and 64-bit Cygwin without any problem. |
Thanks. The ticket is now closed. |
https://sourceforge.net/p/cppcheck/discussion/general/thread/b806eec38c/