The required function 'tputs' was not found in any library.
emacsのconfigure中にでてきた
checking for library containing tputs... no configure: error: The required function 'tputs' was not found in any library. The following libraries were tried (in order): libtinfo, libncurses, libterminfo, libcurses, libtermcap Please try installing whichever of these libraries is most appropriate for your system, together with its header files. For example, a libncurses-dev(el) or similar package.
configureの中身を見てみたらtputsの存在テストがあったので
extern void tputs (const char *, int, int (*)(int)); int main (int argc, char **argv) { if (argc == 10000) tputs (argv[0], 0, 0); return 0; }
これをコンパイル出来れば、そのシステムはemacsが動作する、というconfigureの考え方なのだろう。
そこだけコンパイルしてみる
$ gcc tputstest.c tputstest.c:1:18: 致命的エラー: term.h: そのようなファイルやディレクトリはありません #include <term.h> ^
includeディレクトリ追加
$ gcc tputstest.c -I ~/include/ncurses In file included from tputstest.c:1:0: /home/icbrains/include/ncurses/term.h:47:33: 致命的エラー: ncurses/ncurses_dll.h: そのようなファイルやディレクトリはありません #include <ncurses/ncurses_dll.h> ^
さらに追加
$ gcc tputstest.c -I ~/include/ncurses/ -I ~/include tputstest.c:3:15: エラー: ‘tputs’ と型が競合しています extern void tputs (const char *, int, int (*)(int)); ^ In file included from tputstest.c:1:0: /home/icbrains/include/ncurses/term.h:761:28: 備考: 前の ‘tputs’ の宣言はここです extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int)); ^
intとvoid どっちなの?ということ。
NCURSES_EXPORTマクロは単にint型になるだけなので、じゃあ、extern 宣言部分を
extern int tputs (const char *, int, int (*)(int));
に変えてみる。
$ gcc tputstest.c -I ~/include/ncurses/ -I ~/include -L ~/lib /tmp/cc2DuNTy.o: 関数 `main' 内: tputstest.c:(.text+0x2d): `tputs' に対する定義されていない参照です collect2: エラー: ld はステータス 1 で終了しました
リンク指定追加したらコンパイル成功
$ gcc tputstest.c -I ~/include/ncurses/ -I ~/include -L ~/lib -lncurses
したので、configure内のextern void tputsをextern int tputsに変更
メモ:--prefix=/独自の場所 だけでは追加されない configureディレクトリ追加パラメータ
リンク失敗時
LDFLAGS="-L/独自の場所/lib"
include追加
CFLAGS="-I/独自の場所/include"