[在OS X 10.8上安装ncurses时发生GCC错误

问题描述 投票:0回答:3

我正在尝试在安装了GCC 4.9的OS X 10.8上安装ncurses 5.9。当我在ncurses目录中运行./configure时,没有错误或警告出现,但是当我运行ncurses时,我得到了make。搜寻问题(并进行尝试)后,我发现gcc: error: unrecognized command line option ‘-no-cpp-precomp’(带有两个破折号,即长标记形式)是有效的命令。

我不确定是什么促使GCC运行无效命令-无论是--no-cpp-precomp,还是make本身指定的命令。

有什么办法解决这个问题?如果是这样,如何?

编辑:我尝试使用文本编辑器将ncurses文件中的引用从./configure手动更改为-no-cpp-precomp,尽管GCC似乎接受了--no-cpp-precomp选项,但还是遇到了这个问题。之后,我尝试运行--no-cpp-precomp,并得到以下信息:

autoreconf

使用configure:6558: error: possibly undefined macro: AC_DIVERT_HELP If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. autoreconf: /opt/local/bin/autoconf failed with exit status: 1 选项运行后:

m4_pattern_allow

仍然运行autoreconf: 'configure.ac' or 'configure.in' is required 之后:

./configure && make
gcc makefile ncurses
3个回答
3
投票

看来这已在ncurses 5.9的最新补丁中得到修复

5.9来源可在此处找到:cd man && make DESTDIR="" all sh ./MKterminfo.sh ./terminfo.head ./../include/Caps ./terminfo.tail >terminfo.5 cd include && make DESTDIR="" all cat curses.head >curses.h AWK=gawk sh ./MKkey_defs.sh ./Caps >>curses.h sh -c 'if test "chtype" = "cchar_t" ; then cat ./curses.wide >>curses.h ; fi' cat ./curses.tail >>curses.h gawk -f MKterm.h.awk ./Caps > term.h sh ./edit_cfg.sh ../include/ncurses_cfg.h term.h ** edit: HAVE_TCGETATTR 1 ** edit: HAVE_TERMIOS_H 1 ** edit: HAVE_TERMIO_H 0 ** edit: BROKEN_LINKER 0 cd ncurses && make DESTDIR="" all gcc -o make_hash -DHAVE_CONFIG_H -I../ncurses -I. -I./../include -I../include -DUSE_BUILD_CC -DHAVE_CONFIG_H -I../ncurses -I. -D_DARWIN_C_SOURCE -DNDEBUG -I. -I../include -I/usr/local/include/ncurses -O2 --param max-inline-insns-single=1200 --no-cpp-precomp ./tinfo/make_hash.c -Wl,-search_paths_first gcc: error: unrecognized command line option ‘--no-cpp-precomp’ make[1]: *** [make_hash] Error 1 make: *** [all] Error 2

最新的修补程序在这里:ftp://invisible-island.net/ncurses/ncurses-5.9.tar.gz,但最新的汇总修补程序似乎具有修复程序:ftp://invisible-island.net/ncurses/5.9/

要应用补丁,请获取上面的2个文件:

ftp://invisible-island.net/ncurses/5.9/patch-5.9-20130504.sh.gz

0
投票

$ tar xvf ncurses-5.9.tar.gz $ cd ncurses-5.9 $ gzip -dc ../patch-5.9-20130504.sh.gz | sh 是一个过时的Apple GCC选项,它应该生成警告而不是错误,但是如果将--no-cpp-precomp标志传递给编译器,则它将在出现警告时失败,无论哪种方式,您都必须从构建脚本中手动将其删除。然后运行-Werror,也可以直接将其从autoreconf脚本中删除。


0
投票

我意识到这现在已经很老了,但是由于遇到了同样的问题(需要在Mac Yosemite 10.10和GCC 4.9上构建),也许它也会对其他人有所帮助。即使PATH中的'gcc'是GNU,configure脚本仍在检测它是否是Mac,并假设使用了clang。似乎他们将检测逻辑固定在较新的版本中。我在Boost 1.37中发现了相同的问题,并且它在Boost 1.55(之前的某个位置)已得到修复。

© www.soinside.com 2019 - 2024. All rights reserved.