GNOME Bugzilla – Bug 790981
Crash when generating puzzle
Last modified: 2017-11-29 16:45:26 UTC
This might be different with GCC, but building with Clang and trying to start a game results in a crash when generating the puzzle. This is due to calling call_once() without linking to pthread. Some context: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55394
Created attachment 364620 [details] [review] Link with pthreads Calling call_once() without having linked to a pthread library will result in an unhandled exception when generating puzzles.
Here’s the exception: terminate called after throwing an instance of 'std::system_error' what(): Unknown error -1 And here’s the stack trace:
+ Trace 238201
Review of attachment 364620 [details] [review]: ::: configure.ac @@ +55,3 @@ AC_SUBST([GLIB_REQUIRED]) +AX_PTHREAD Heh, I didn't know about AX_PTHREAD! ::: lib/Makefile.am @@ +19,3 @@ +libsudoku_la_CXXFLAGS = \ + $(PTHREAD_CFLAGS) Yay, this looks right, but it's managed to violate the well-defined convention of using _CFLAGS variables only for stuff that should be added to... _CPPFLAGS. I don't know what to think of that, since AX_PTHREAD is being sane here, where pkg-config is insane, but the insane pkg-config convention is so entrenched at this point that violating it seems like a bad idea. Oh well. I would just leave a warning comment to mention that this _CXXFLAGS is really the right place for it, or someone is bound to assume it's only for include directories and move it to _CPPFLAGS. I should really port this thing to meson....
Attachment 364620 [details] pushed as ec20e84 - Link with pthreads
(In reply to Michael Catanzaro from comment #3) > Yay, this looks right, but it's managed to violate the well-defined > convention of using _CFLAGS variables only for stuff that should be added > to... _CPPFLAGS. Just when I think that I managed to escape the shackles of Autotools, I learn this. > I don't know what to think of that, since AX_PTHREAD is > being sane here, where pkg-config is insane, but the insane pkg-config > convention is so entrenched at this point that violating it seems like a bad > idea. Oh well. I would just leave a warning comment to mention that this > _CXXFLAGS is really the right place for it, or someone is bound to assume > it's only for include directories and move it to _CPPFLAGS. My thought process was just “this affects only the C++ code, so CXXFLAGS it is”, but I’m glad to hear that I wasn’t too far off. > I should really port this thing to meson.... This is not that big, maybe I’ll free up some time to do it, if you don’t mind. :p
Meson ports are always appreciated. ;)