Project

General

Profile

Bug #1743

Darwin (MacOS) build error with Xcode 9

Added by Omri Mor 7 days ago. Updated 7 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Machine Layers
Target version:
Start date:
11/12/2017
Due date:
% Done:

0%


Description

Compiling Charm++ with Xcode 9 results in a build failure, due to changes in header files.
Other projects (example from TensorFlow: https://github.com/tensorflow/tensorflow/issues/13220#issuecomment-331579775) have had the same issue.
The internal C++ __threading_support header (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__threading_support) defines the __libcpp_thread_get_port() function, which internally uses pthread_mach_thread_np().
That function is defined in pthread.h (/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h), but the function is hidden behind preprocessor conditions:

#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) || defined(__cplusplus)
_XOPEN_SOURCE is defined in src/arch/*-darwin-x86_64/conv-mach.h so that the ucontext functions can be used.
A workaround is to also define _POSIX_C_SOURCE or _DARWIN_C_SOURCE. I have no idea why __cplusplus isn't defined.

Another option is to use <sys/ucontext.h> instead of <ucontext.h>, which I don't think has the same requirement for _XOPEN_SOURCE

History

#1 Updated by Sam White 7 days ago

  • Target version set to 6.9.0

Also available in: Atom PDF