Linux CMake 找不到 Curses
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4678926/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CMake can't find Curses
提问by waffleShirt
I am trying to compile the openlase library from www.marcansoft.comand have been running into problems with CMake. CMake is returning an error stating that it cannot find Curses, and after a lot of looking I am still stumped as to what the issue is. I have checked that I have the various ncurses packages installed but still the error persists. Im not very familiar with CMake but I was able to resolve other dependency issues that arose before this one. The following is the output in terminal.
我正在尝试从www.marcansoft.com编译 openlase 库并且遇到了 CMake 的问题。CMake 返回一个错误,指出它找不到 Curses,经过大量查找后,我仍然对问题所在感到困惑。我已经检查过我安装了各种 ncurses 包,但错误仍然存在。我对 CMake 不是很熟悉,但我能够解决在此之前出现的其他依赖问题。以下是终端中的输出。
tom@SILVER:~/dev/openlase$ cmake ./
-- Found Hyman
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:70 (MESSAGE):
Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindCurses.cmake:159 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
examples/27c3_slides/CMakeLists.txt:3 (find_package)
-- Configuring incomplete, errors occurred!
Any help would be greatly appreciated.
任何帮助将不胜感激。
- Tom
- 汤姆
回答by sarnold
Do you have the corresponding -dev
package installed too? On Ubuntu (and probably anything derived from Debian) it is libncurses5-dev
. Other systems may use -devel
or similar tags.
你也-dev
安装了相应的包吗?在 Ubuntu(可能还有来自 Debian 的任何东西)上,它是libncurses5-dev
. 其他系统可能使用-devel
或类似的标签。
The compiler is looking for the library headers, and those aren't provided by the standard package. (The headers aren't needed at runtime, only when compiling software, so they make it easy to remove extra useless stuff for systems that aren't going to be doing any software compiling.)
编译器正在寻找库头文件,而标准包没有提供这些头文件。(在运行时不需要头文件,只有在编译软件时才需要头文件,因此它们可以很容易地为不进行任何软件编译的系统删除额外的无用内容。)
回答by waffleShirt
Temporarily set CURSES_USE_NCURSES to TRUE to force the use of NCURSES, rather than letting CMake try to find CURSES.
暂时将 CURSES_USE_NCURSES 设置为 TRUE 以强制使用 NCURSES,而不是让 CMake 尝试查找 CURSES。
回答by Martin Zeitler
Another way to fix it is to add these 2 lines to FindCurses.cmake (on top):
另一种修复方法是将这两行添加到 FindCurses.cmake(在顶部):
set(CURSES_LIBRARY "/opt/lib/libncurses.so")
set(CURSES_INCLUDE_PATH "/opt/include")
回答by Jason Briggs
The openlase wiki was not displaying all of the needed packages. Check there wiki pages on github for updated instructions. For curses the missing package was libncurses5-dev sudo apt-get install libncurses5-dev
openlase wiki 没有显示所有需要的包。检查 github 上的 wiki 页面以获取更新的说明。对于curses,缺少的包是libncurses5-devsudo apt-get install libncurses5-dev
回答by rnordeen
Here is what fixed my problems on Ubuntu 12.04 x86_64(64 bit) (Thanks syslogic )
这是在 Ubuntu 12.04 x86_64(64 位)上解决我的问题的方法(感谢 syslogic)
For whatever reason (1:00 am maybe?) setting CURSES_USE_NCURSES TRUE didn't seem to work. So I went with a hack job.
无论出于何种原因(可能是凌晨 1:00?)将 CURSES_USE_NCURSES TRUE 设置似乎不起作用。所以我去做了一份黑客工作。
Verified it's installed:
验证是否已安装:
$ sudo apt-get install libncurses5-dev
You will see something to the effect: libncurses5-dev is already the newest version.
你会看到一些效果: libncurses5-dev is already the newest version.
So find the library and include.
所以找到图书馆并包括在内。
$ locate libncurses.so
$ locate libncurses.so
Note location, mine: /usr/lib/x86_64-linux-gnu/libncurses.so
注意位置,我的: /usr/lib/x86_64-linux-gnu/libncurses.so
$ locate curses.h
$ locate curses.h
Note location again, mine:
/usr/include
再次注意位置,我的:
/usr/include
In: <cmake source dir>/Modules/FindCurses.cmake
在: <cmake source dir>/Modules/FindCurses.cmake
add at the top, right after the comments
添加在顶部,就在评论之后
set( CMAKE_INCLUDE_PATH "/usr/include")
set( CMAKE_LIBRARY_PATH "/usr/lib/x86_64-linux-gnu/libncurses.so")
then rinse repeat the build process
然后冲洗重复构建过程
./bootstrap
make
sudo make install
ccmake should now be installed.
现在应该安装 ccmake。
Your pal,
你的朋友,
回答by JoeAndrieu
Temporarily set CURSES_NEED_NCURSESto TRUE to force the use of NCURSES, rather than letting CMake try to find CURSES.
暂时将CURSES_NEED_NCURSES设置为 TRUE 以强制使用 NCURSES,而不是让 CMake 尝试查找 CURSES。
set(CURSES_NEED_NCURSES TRUE)
CURSES_USE_NCURSES is used by FindCurses.cmake internally, so setting that won't help.
CURSES_USE_NCURSES 由 FindCurses.cmake 内部使用,因此设置无济于事。