Project

General

Profile

Bug #1728

Darwin clang compilation fails without -D_DARWIN_C_SOURCE on Sierra

Added by Eric Bohm over 1 year ago. Updated over 1 year ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
10/30/2017
Due date:
% Done:

0%


Description

Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Application

Performing 'make charm++ OPTS= QUIET=' in multicore-darwin-x86_64-test1/tmp
Makefile:1028: Variable OPTS is defined to an empty string. Are you sure this is what you want?
../bin/charmc -I. -c -o DummyLB.o DummyLB.C
In file included from DummyLB.C:6:
In file included from ./DummyLB.h:9:
In file included from ./CentralLB.h:9:
In file included from ./BaseLB.h:9:
In file included from ./LBDatabase.h:100:
In file included from ./LBDatabase.decl.h:3:
In file included from ./charm++.h:134:
In file included from ./CkMarshall.decl.h:6:
In file included from ./sdag.h:46:
In file included from ../bin/../include/pup_stl.h:35:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:247:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/sstream:174:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ostream:138:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios:216:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale:18:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/mutex:189:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__mutex_base:17:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__threading_support:156:1: error: unknown type name 'mach_port_t'
mach_port_t _libcpp_thread_get_port();

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/
_threading_support:300:1: error: unknown type name 'mach_port_t'
mach_port_t _libcpp_thread_get_port() {

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/
_threading_support:301:12: error: use of undeclared identifier 'pthread_mach_thread_np'
return pthread_mach_thread_np(pthread_self());
^
3 errors generated.
Fatal Error by charmc in directory /Users/ebohm/ppl/charm/multicore-darwin-x86_64-test1/tmp

This goes away if you add -D_DARWIN_C_SOURCE to the compile line. but you then also have to add it to the build line for all charm applications.

We should be able to autodetect when this is necessary and wire it into whichever of cc-clang or conv-mach-darwin is to blame, as I'm not certain if the versioning threshold here is clang or macOS.


Related issues

Related to Charm++ - Bug #1743: Darwin (MacOS) build error with Xcode 9 Merged 11/12/2017

History

#1 Updated by Sam White over 1 year ago

I added Matthias as a watcher here because I think he found a fix for this issue?

#2 Updated by Matthias Diener over 1 year ago

This seems to be a common bug with the new Xcode 9 on macOS Sierra (10.12): https://github.com/tensorflow/tensorflow/issues/13220 (e.g.).
Workaround is to either update to High Sierra (10.13) or downgrade Xcode to version 8.

There is also the possibility of modifying Xcode 9's installed files (citing from https://charmplusplus.slack.com/archives/C03BRHNNP/p1506041051000016):

Workaround is to comment lines 156 and 300-302 in file
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__threading_support

#3 Updated by Matthias Diener over 1 year ago

So to summarize, I wouldn't bother fixing this, as it affects only a specific and very particular system configuration, and the bug is not in charm++. It might make sense to mention this in the release notes, though.

#4 Updated by Eric Bohm over 1 year ago

updating to high Sierra has landed me at a different bug.

Makefile:1028: Variable OPTS is defined to an empty string. Are you sure this is what you want?
autoreconf
./configure
checking build system type... x86_64-apple-darwin17.2.0
checking host system type... x86_64-apple-darwin17.2.0
checking target system type... x86_64-apple-darwin17.2.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/ebohm/ppl/charm/multicore-darwin-x86_64-wtf/tmp':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
make1: * [conv-autoconfig.h] Error 1
make: *
[headers] Error 2
-------------------------------------------------
Charm++ NOT BUILT. Either cd into multicore-darwin-x86_64-wtf/tmp and try
to resolve the problems yourself, visit

Which is a bit of a puzzle, since compilation seems to work otherwise. Digging deeper, but figured I'd put an update here as a note that telling people to upgrade to high Sierra may be opening a new can of worms.

#5 Updated by Matthias Diener over 1 year ago

hmm, thats strange. I just did a fresh checkout on High Sierra 10.13.1/Xcode 9.1, and charm++ compiles without problem.

./build AMPI multicore-darwin-x86_64 --with-production -j4

#6 Updated by Sam White over 1 year ago

Can you check config.log for hwloc? That will have more details of what went wrong

#7 Updated by Eric Bohm over 1 year ago

  • Status changed from New to Rejected

I had revised the path to place a macports installed gcc first. So the most recent issue I hit was due to a problem in that compiler, as the formerly working installation is now broken in high Sierra.

Fixed that by commenting out my path change and the build works fine.

#8 Updated by Eric Bohm over 1 year ago

FYI updating macports properly also allows a build targeted to gcc to work. So really the issue here was a incomplete update of the development environment to high Sierra on my part.

#9 Updated by Evan Ramos over 1 year ago

  • Related to Bug #1743: Darwin (MacOS) build error with Xcode 9 added

Also available in: Atom PDF