[swift-corelibs-dev] Defining _GNU_SOURCE for module-map-included headers

Jordan Rose jordan_rose at apple.com
Mon Dec 21 11:34:37 CST 2015

Hm. If this is the right setting to set on everybody's system, we could add it as part of Clang initialization (for the Clang inside Swift). Otherwise, you can use "-Xcc" to pass extra flags to Clang, in this case "-Xcc -D_GNU_SOURCE=1".

Hope that helps,

> On Dec 20, 2015, at 2:29 , Dmitri Gribenko <gribozavr at gmail.com> wrote:
> + swift-dev, Jordan
> On Sun, Dec 20, 2015 at 2:21 AM, Dan Stenmark via swift-corelibs-dev
> <swift-corelibs-dev at swift.org> wrote:
>> I'm trying to invoke Linux's unshare() system call from Swift, but without much success.  From C, it requires _GNU_SOURCE to be #define'd before the #include <sched.h>.  The Glibc module map does indeed include sched.h, so the lack of _GNU_SOURCE appears to be the likely culprit.  What's the appropriate action to take here?
>> Dan
>> _______________________________________________
>> swift-corelibs-dev mailing list
>> swift-corelibs-dev at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the swift-corelibs-dev mailing list