【问题标题】:"fatal error 'ncurses/ncurses.h' file not found" during `brew install cmake``brew install cmake`期间“找不到致命错误'ncurses/ncurses.h'文件”
【发布时间】:2016-04-12 09:53:40
【问题描述】:

我正在努力将 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.

收到上述错误后,我通过brew install ncurses 安装了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)
...

【问题讨论】:

  • WRT 更新 #2:天哪。你真的搞砸了你的系统。你知道你可以使用-I 来添加一个包含目录,对吧?
  • @trojanfoe 是的...我同意添加符号链接会弄乱我的系统...即使通过brew install 安装也可以添加 -I 选项吗?
  • 我不知道 TBH 我一直认为自制软件很垃圾,所以我使用 macports。看起来该端口(或他们称之为的任何端口)已损坏,因为它取决于 ncurses,但它并没有自动安装它。我会从自制论坛获得帮助。

标签: macos cmake homebrew


【解决方案1】:

这看起来像 Macports 版本,但是您使用的是自制软件,并且/opt/local/include 不太可能是包含目录:

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

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

所以这一切都说得通。

也许自制的东西坏了?坚持使用 Macports。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-31
    • 2016-02-08
    • 1970-01-01
    • 2018-12-18
    • 2019-04-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多