Repository navigation
Fix C11 threads.h compatibility - #64
Conversation
|
Let me know when this is ready to test - Twitter @znmeb works ;-) |
|
Tested with C11 threads supported required one change to ensure the environment was populated for the script then built successfully. diff --git a/src/Makevars b/src/Makevars
index 78f82a3..dcacf0e 100644
--- a/src/Makevars
+++ b/src/Makevars
@@ -7,7 +7,7 @@ PKG_LIBS = -pthread
# Does this platform support C11's <threads.h>? Note that not all C11
# compilers and pthread libraries support <threads.h>, and that compilers that
# use older standards (like C99) sometimes do support <threads.h>.
-THREADS_H_SUPPORT:=$(shell ./threads_h_support.sh)
+THREADS_H_SUPPORT:=$(shell CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" PKG_CFLAGS="$(PKG_CFLAGS)" CFLAGS="$(CFLAGS)" PKG_LIBS="$(PKG_LIBS)" ./threads_h_support.sh)
ifeq ($(THREADS_H_SUPPORT), 1)
PKG_CPPFLAGS += -DTHREADS_H_SUPPORT |
| // jcheng 2017-11-03: _XOPEN_SOURCE 600 is necessary to prevent Solaris headers | ||
| // from complaining about the combination of C99 and _XOPEN_SOURCE <= 500. The | ||
| // error message starts with: | ||
| // "Compiler or options invalid for pre-UNIX 03 X/Open applications" |
There was a problem hiding this comment.
Is it OK that we're losing this?
There was a problem hiding this comment.
I think we want to keep this and maybe a few other things -- I haven't yet reviewed the changes we made to tinycthread that we may want to preserve in the new version.
|
|
||
| /* If there's C11 <threads.h> support, use it; otherwise use tinycthread.h, | ||
| * which has a compatible API. */ | ||
| #ifdef THREADS_H_SUPPORT |
There was a problem hiding this comment.
I think I'd rather see this require THREADS_H_SUPPORT to be defined one way or another, so we know that the build environment made a conscious choice rather than not knowing this issue exists. (For example, Makevars.win doesn't deal with this yet, but it would happily compile anyway...)
|
@loqs Thanks! Although it happens to work, I think it's still not quite right. When I run it, the output is: The problem is that The next thing I tried is to change This time, it gets the correct I think it is possible to hack the Makevars so that things will happen in the right order, but everything I'm finding looks pretty messy. It might be better to use a top-level configure script, similar to the one here: https://github.com/jeroen/openssl/blob/master/configure |
|
The fix-c-thread branch as it is now works for me on Arch! Thanks. |
9952c2b to
dda9192
Compare
This fixes #45 and fixes #63.
Still needs some work and documentation, but hopefully it will install on platforms with glibc 2.28 (Arch) and musl (Alpine).