“brew install cmake”期间发现“致命错误'ncurses / ncurses.h'文件未找到”

时间:2016-04-12 09:53:40

标签: macos cmake homebrew

我正在努力将cmake安装到OSX 10.8(山狮)

$ brew install -v cmake

但是,我收到了以下错误。

[  2%] Built target cmcompress
In file included from /tmp/cmake20160412-70643-1kq4xsy/cmake-3.4.0/Source/CursesDialog/form/fld_arg.c:33:
In file included from /tmp/cmake20160412-70643-1kq4xsy/cmake-3.4.0/Source/CursesDialog/form/form.priv.h:34:
/tmp/cmake20160412-70643-1kq4xsy/cmake-3.4.0/Source/CursesDialog/form/form.h:46:12: fatal error: 'ncurses/ncurses.h' file not found
#  include <ncurses/ncurses.h>
           ^
1 error generated.

收到上述错误后,我通过ncurses安装了brew install ncurses。但是,仍然会出现错误消息'ncurses/ncurses.h' file not found

请帮助解决此问题...

更新

根据locate命令,我的文件系统中有多个ncurses.h个文件:

$ locate ncurses.h
/Applications/XAMPP/xamppfiles/include/ncurses/ncurses.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/ncurses.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/ncurses.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/usr/include/ncurses.h
/opt/local/include/ncurses/ncurses.h
/opt/local/include/ncursesw/ncurses.h
/sw/include/ncurses.h
/usr/include/ncurses.h

更新2

这可以解决问题:

$ ln -s /opt/local/include/ncurses /usr/include

因为c编译器会搜索以下路径

$ clang++ -x c -v -E /dev/null
...
/usr/local/include
 /usr/bin/../lib/clang/5.1/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
...

1 个答案:

答案 0 :(得分:0)

这看起来像Macports版本,但是您使用自制程序,而/opt/local/include不太可能是包含目录:

/opt/local/include/ncurses/ncurses.h

其他人都不在ncurses子目录中。

所以一切都有意义。

也许家酿的东西坏了?坚持Macports。