简体   繁体   English

macOS (OSX) 上的 ncurses 找不到 xterm-256color

[英]ncurses on macOS (OSX) cannot find xterm-256color

I'm trying to use ncurses 6.0 on macOS.我正在尝试在 macOS 上使用 ncurses 6.0。 I've downloaded the project and built the C++ demo using the supplied makefiles.我已经下载了该项目并使用提供的 makefile 构建了 C++ 演示。 However, when I run the demo, I get the error:但是,当我运行演示时,出现错误:

Error opening terminal: xterm-256color.打开终端时出错:xterm-256color。

This might be related: I do not have an x folder in my terminfo directory:这可能是相关的:我的terminfo目录中没有x文件夹:

$ ls /usr/share/terminfo/
31  36  45  51  64  69  6e  73  78
32  37  4c  58  65  6a  6f  74  7a
33  38  4d  61  66  6b  70  75
34  39  4e  62  67  6c  71  76
35  41  50  63  68  6d  72  77

The demo works correctly on Debian.该演示在 Debian 上正常运行。


The output of my configuration is:我的配置的输出是:

** Configuration summary for NCURSES 6.0 20150808:

       extended funcs: yes
       xterm terminfo: xterm-new

        bin directory: /usr/local/bin
        lib directory: /usr/local/lib
    include directory: /usr/local/include/ncurses
        man directory: /usr/local/share/man
   terminfo directory: /usr/local/share/terminfo

** Include-directory is not in a standard location

Because I'm lazy and don't read manuals I did not run the full setup procedure.因为我很懒惰并且不阅读手册,所以我没有运行完整的设置过程。 After running:运行后:

./configure
make
make install

It now works.它现在可以工作了。

When you built ncurses, the configure script tells you at the end where it will install.当您构建 ncurses 时,配置脚本会在最后告诉您它将安装在哪里。 If you give no options on OSX, it will look like this:如果您在 OSX 上不提供任何选项,它将如下所示:

creating headers.sh

** Configuration summary for NCURSES 6.0 20160409:

       extended funcs: yes
       xterm terminfo: xterm-new

        bin directory: /usr/local/bin
        lib directory: /usr/local/lib
    include directory: /usr/local/include/ncurses
        man directory: /usr/local/share/man
   terminfo directory: /usr/local/share/terminfo

** Include-directory is not in a standard location

You can override the location of the terminfo directory (read the INSTALL file), or tell the library at runtime by setting the TERMINFO and/or TERMINFO_DIRS environment variables.您可以覆盖 terminfo 目录的位置(读取INSTALL文件),或者通过设置TERMINFO和/或TERMINFO_DIRS环境变量在运行时告诉库。 But without doing one of those things, it will look for the terminal database in a different location.但是如果不做其中任何一件事情,它就会在不同的位置寻找终端数据库。

The ncurses configure script supplies a --prefix=/usr option for some systems (mainly Linux-based) because it is expected to be the system curses library (again, read INSTALL ). ncurses 配置脚本为某些系统(主要是基于 Linux 的)提供了一个--prefix=/usr选项,因为它应该是系统 curses 库(再次阅读INSTALL )。 OSX is not the odd one here. OSX 在这里并不奇怪。

OSX is different from the usual case: its filesystem (usually) ignores the difference between upper/lowercase names. OSX 与通常情况不同:它的文件系统(通常)忽略大写/小写名称之间的差异。 The configure script checks for this, and if so, it compiles in a workaround to encode those single letters as a hexadecimal number. configure 脚本会对此进行检查,如果是,它会在解决方法中进行编译,以将这些单个字母编码为十六进制数字。 For example, 0x78 is "x".例如, 0x78是“x”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM