Hi all,

I'm trying to build something with ncurses. There's this outdated tutorial: http://dev.iachieved.it/iachievedit/ncurses-with-swift-on-linux/. In order to build, a system module map was provided here: https://github.com/iachievedit/CNCURSES. This assumes `/usr/include/ncurses.h`, which is not available on MacOS 10.12. So I've installed ncurses through homebrew and updated the modulemap: https://github.com/Bouke/CNCurses. Sadly though, it doesn't work and I can't figure out how to get it working.

brew install homebrew/dupes/ncurses

Module map:

module CNCurses [system] {
    header "/usr/local/Cellar/ncurses/6.0_2/include/ncurses.h"
    link "ncurses"
    export *
}

I'm building with the following command, the flags taken from the package provided ncurses.pc:

swift build \
        -Xcc -D_DARWIN_C_SOURCE \
        -Xcc -I/usr/local/Cellar/ncurses/6.0_2/include \
        -Xcc -I/usr/local/Cellar/ncurses/6.0_2/include/ncursesw \
        -Xlinker -L/usr/local/Cellar/ncurses/6.0_2/lib

This produces the following error message (shortened):

Compile Swift Module 'TermDraw' (1 sources)
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/usr/local/Cellar/ncurses/6.0_2/include/ncurses.h"
        ^
/usr/local/Cellar/ncurses/6.0_2/include/ncurses.h:60:10: error: 'ncursesw/ncurses_dll.h' file not found with <angled> include; use "quotes" instead
#include <ncursesw/ncurses_dll.h>
         ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/usr/local/Cellar/ncurses/6.0_2/include/ncurses.h"
        ^
/usr/local/Cellar/ncurses/6.0_2/include/ncurses.h:653: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/MacOSX10.12.sdk/usr/include/curses.h:598:45: note: previous declaration is here extern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int); /* implemented */
                                            ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/usr/local/Cellar/ncurses/6.0_2/include/ncurses.h"
        ^

(and goes on for quite a few other conflicting types)

Any help on getting this to build is greatly appreciated. Example code can be found here: https://github.com/Bouke/TermDraw

---
Thanks,
Bouke


_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to