Posts

Post not yet marked as solved
0 Replies
683 Views
Ventura, Xcode 14.2 + CLTs The macOS SDK currently ships ncurses 5. If you want to build your project against a private copy of ncurses 6, and also use modules, that seems to be impossible. Here's a reduced test case that illustrates the problem. Create a file named moduletest.c: #include <ncurses.h> int main(void) { beep(); return 0; } Install ncurses 6 headers into a directory alongside, called ncurses6/include. Compile like so: clang -c -fmodules -I./ncurses6/include moduletest.c This results in a number of errors like this: In file included from moduletest.c:1: ./ncurses6/include/ncurses.h:684:45: error: conflicting types for 'keyname' extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int);              /* implemented */                                             ^ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ncurses.h:598:45: note: previous declaration is here extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int);              /* implemented */                                             ^ This seems to be happening because when ./ncurses6/include/ncurses.h includes some standard C headers, having modules enabled somehow causes /usr/include/ncurses.h to be included as well. Building without -fmodules works fine. Building without -I./ncurses6/include also works fine for this simple test case, of course, because you just get the system ncurses. I've also seen basically the opposite problem, where importing system frameworks like Cocoa will indirectly include /usr/include/ncurses.h, and that will then include ./ncurses6/include/unctrl.h instead of /usr/include/unctrl.h, which of course also results in errors. I haven't been able to come up with a reduced test case to repro the latter yet. These seem like they must be bugs in the SDK or clang. What's the best way to get progress on a fix started? Open an issue at llvm.org? Apple Feedback report? Paid developer support incident? Anyone know a good workaround in the meantime?
Posted
by jmr16.
Last updated
.