vim-jp / ctags

Use https://ctags.io instead (This was fork of http://ctags.sourceforge.net/)
GNU General Public License v2.0
26 stars 7 forks source link

autoheaderを実行するとエラーになる #14

Closed h-east closed 10 years ago

h-east commented 10 years ago

Reopen出来なかったので新しくIssue立てました。 from https://github.com/vim-jp/ctags/pull/12#issuecomment-38987724

$ autoheader
autoheader: warning: missing template: HAVE_ICONV
autoheader: Use AC_DEFINE([HAVE_ICONV], [], [Description])
autoheader: warning: missing template: MBCS_CODE
The command "autoheader" exited with 1.

from https://travis-ci.org/vim-jp/ctags/jobs/21810141

h-east commented 10 years ago

https://github.com/vim-jp/ctags/pull/12#issuecomment-38988521

こうかな?

diff --git a/configure.ac b/configure.ac
index 4c3c813..e484b04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,7 +59,7 @@ AH_VERBATIM([EXTERNAL_SORT], [
 # undef EXTERNAL_SORT
 #endif
 ])
-AH_TEMPLATE([ICONV],
+AH_TEMPLATE([HAVE_ICONV],
    [Define this value if support multibyte character encoding.])
 AH_TEMPLATE([TMPDIR],
    [If you wish to change the directory in which temporary files are stored,
@@ -236,7 +236,6 @@ if test "$enable_iconv" = yes ; then
    fi
    if test "x$HAVE_ICONV" != "x"; then
        AC_DEFINE(HAVE_ICONV)
-       AC_DEFINE(MBCS_CODE,[])
    fi
 fi

これでautoheaderは通るけど、makeするとコンパイルエラーが出ますね:sweat_smile:

gcc -I. -I. -DHAVE_CONFIG_H  -c args.c
In file included from /usr/include/stdio.h:33:0,
                 from args.c:17:
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/stddef.h:212:27: エラー: ‘unsigned’ が重複しています
 typedef __SIZE_TYPE__ size_t;
                           ^
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/stddef.h:212:36: エラー: 宣言指定内に二個またはそれ以上の型があります
 typedef __SIZE_TYPE__ size_t;
                                    ^
In file included from args.c:17:0:
/usr/include/stdio.h:90:17: エラー: 宣言指定内に二個またはそれ以上の型があります
 typedef __off_t off_t;
                 ^
/usr/include/stdio.h:90:22: エラー: 宣言指定内に二個またはそれ以上の型があります
 typedef __off_t off_t;
                      ^
make: *** [args.] エラー 1
h-east commented 10 years ago

configure.acのiconv関係のifの所をコメントアウトすると普通にmake通る。 (当然 iconv使わないものが出来上がります)

んー、なんかこのifのトコ弄ってautoconfして出来上がったconfigureがmake通る時のそれと全然違うし、ifのネストとか変な気がするんです。 autoconf職人さん助けて!

diff --git a/configure.ac b/configure.ac
index 4c3c813..32bd741 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,7 +59,7 @@ AH_VERBATIM([EXTERNAL_SORT], [
 # undef EXTERNAL_SORT
 #endif
 ])
-AH_TEMPLATE([ICONV],
+AH_TEMPLATE([HAVE_ICONV],
    [Define this value if support multibyte character encoding.])
 AH_TEMPLATE([TMPDIR],
    [If you wish to change the directory in which temporary files are stored,
@@ -224,21 +224,20 @@ if test "$enable_macro_patterns" = yes ; then
    AC_MSG_RESULT(tag file will use patterns for macros by default)
 fi

-if test "$enable_iconv" = yes ; then
-   AC_CHECK_LIB([c], [iconv_open], [LDFLAGS="$LDFLAGS -lc" HAVE_ICONV=1], [])
-   if test "x$HAVE_ICONV" = "x"; then
-       dnl But it's possible this implementation of libiconv doesn't have a libiconv_* define
-       AC_CHECK_LIB([iconv], [iconv_open], [LDFLAGS="$LDFLAGS -liconv" HAVE_ICONV=1], [])
-   fi
-   if test "x$HAVE_ICONV" = "x"; then
-       dnl No iconv library was found; issue a warning to the console
-       AC_MSG_ERROR([Could not find libiconv. Please install libiconv and libiconv-devel.])
-   fi
-   if test "x$HAVE_ICONV" != "x"; then
-       AC_DEFINE(HAVE_ICONV)
-       AC_DEFINE(MBCS_CODE,[])
-   fi
-fi
+#if test "$enable_iconv" = yes ; then
+#  AC_CHECK_LIB([c], [iconv_open], [LDFLAGS="$LDFLAGS -lc" HAVE_ICONV=1], [])
+#  if test "x$HAVE_ICONV" = "x"; then
+#      dnl But it's possible this implementation of libiconv doesn't have a libiconv_* define
+#      AC_CHECK_LIB([iconv], [iconv_open], [LDFLAGS="$LDFLAGS -liconv" HAVE_ICONV=1], [])
+#  fi
+#  if test "x$HAVE_ICONV" = "x"; then
+#      dnl No iconv library was found; issue a warning to the console
+#      AC_MSG_ERROR([Could not find libiconv. Please install libiconv and libiconv-devel.])
+#  fi
+#  if test "x$HAVE_ICONV" != "x"; then
+#      AC_DEFINE(HAVE_ICONV)
+#  fi
+#fi

 # Checks for programs
 # -------------------

makeまでの手順

autoheader
autoconf
./configure
make
h-east commented 10 years ago

@mattn チェックお願いします。

mattn commented 10 years ago

iconv は環境によって必要だったり必要無かったり(glibに含まれるので)なので、そのチェックを入れたつもりでしたが、必要ないという意味ですか?

k-takata commented 10 years ago

これでautoheaderは通るけど、makeするとコンパイルエラーが出ますね:sweat_smile:

そのパッチでautoheaderもmakeも通りました。(Ubuntu 12.04)

h-east commented 10 years ago

違います。 まっつんさんのPull RequestをMergeした状態でautoheaderを実行するとエラーになります。 それを直すpatchを https://github.com/vim-jp/ctags/issues/14#issuecomment-40680862 で提案させて貰いました。 そのpatchでautoheaderは成功するんですが、今度は ./configuremake するとコンパイルエラーが出るんです。

その原因を探っていたら configure.ac のiconvの判定のところが引き金になっているみたいでした。

if test "$enable_iconv" = yes ; then
  ~
fi

なのでその部分をコメントアウトしたらmakeが通るけどよく分かんないやー。。がhttps://github.com/vim-jp/ctags/issues/14#issuecomment-40682006 です。

私の環境(fedora 19 64bit)が壊れかけているのかな。。

h-east commented 10 years ago

@k-takata

そのパッチでautoheaderもmakeも通りました。(Ubuntu 12.04)

報告ありがとうございます。 他のfedora使いの人の報告が欲しいですね。

crazymaster commented 10 years ago

これでautoheaderは通るけど、makeするとコンパイルエラーが出ますね:sweat_smile:

そのパッチでautoheaderもmakeも通りました。(Ubuntu 12.04)

https://github.com/vim-jp/ctags/issues/14#issuecomment-40680862 このパッチではmakeするとコンパイルエラーが出ましたよ (Ubuntu 14.04 64bit) (もしかして下のパッチと取り違えてません?)

k-takata commented 10 years ago

いや、私のところだと上ので通りました。Ubuntu 14.04でも。

ちょっと違ったパッチも書いてみましたが、効果があるかどうかは不明。 https://gist.github.com/k-takata/11174721

crazymaster commented 10 years ago

@k-takata OSは何bitです?

k-takata commented 10 years ago

12.04: 32bit, 64bit 14.04: 64bit

syngan commented 10 years ago

make までの手順で, configure にオプション --enable-iconv ? が必要ではないでしょうか.

configure に引数なしで make 通りました 12.04 32bit

k-takata commented 10 years ago

iconv を有効にするなら --enable-iconvは当然必要ですね。 ああ、逆に --enable-iconv を外すとエラーになりました。

k-takata commented 10 years ago

AC_CHECK_LIBAC_PROG_CCより後でなければならないみたい?

syngan commented 10 years ago

あれ、私も enable で make 通って, disable でエラーになりました。 ubuntu 12.04 32bit

k-takata commented 10 years ago

パッチ更新 https://gist.github.com/k-takata/11174721 "Checks for programs" のブロックをごっそり上に持って行った方がよいのかも。

h-east commented 10 years ago

みなさん情報ありがとうございます。 そうですよねiconv使うなら ./configure の時--enable-iconv 要りますね。 こちらでも./configure 後のmakeでコンパイルエラーになり、./configure --enable-iconv 後のmakeがOKになるのを確認しました。

@k-takata patchありがとうございます。 このpatchで--enable-iconv有無に関係なくmake通ることを確認しました! commitしてもらって良いですか?

mattn commented 10 years ago

@k-takata do it plesae

k-takata commented 10 years ago

cygwinで動かない…。iconv.hをインクルードしないと、iconv_openが使えないようです。(実体はlibiconv_openというシンボルになっているようで。) とりあえず、こうかな? https://gist.github.com/k-takata/11174721/a6733afee1df55de91b5dee20db3bcf51e687c08 libiconv with iconv.h → libc w/o iconv.h → libiconv w/o iconv.h の検索順になっているはずですが、それでいいのかはよく分かりません。

あと、これをどうするか。

"Checks for programs" のブロックをごっそり上に持って行った方がよいのかも。

k-takata commented 10 years ago

"Checks for programs" のブロックをごっそり上に持って行った方がよいのかも。

逆に、libiconvのチェックを他のライブラリのチェックよりも後に移動してしまいました。 ライブラリの検索順序は libiconv with iconv.h → libc w/o iconv.h に簡素化、チェック結果表示を追加。 https://gist.github.com/k-takata/11174721/9aa4b149f5b13c6c65f1d94ff1546a6ddf231b03

k-takata commented 10 years ago

autoheaderのエラーは直りましたが、テストで別のエラーが出てしまっていますね。

$ make test CTAGS_TEST=./dctags
Testing tag inclusion...ctags.ref: Warning: ignoring null tag in Test/1878155.js
dctags: Warning: ignoring null tag in Test/1878155.js
Passed
Testing extension fields...ctags.ref: Warning: ignoring null tag in Test/1878155.js
dctags: Warning: ignoring null tag in Test/1878155.js
Passed
Testing extra tags...ctags.ref: Warning: ignoring null tag in Test/1878155.js
dctags: Warning: ignoring null tag in Test/1878155.js
Passed
Testing line directives...Passed
Testing TAGS output...ctags.ref: Unexpected end of file: Test/ocaml_empty.ml
make: *** [test.etags] Error 1

The command "make test CTAGS_TEST=./dctags" exited with 2.
h-east commented 10 years ago

@k-takata コミッツありがとうございます! ocaml_empty.mlのテストがエラーになるのは前からです。 https://github.com/vim-jp/ctags/pull/3#issuecomment-25785018 @crazymaster さんが本家にpatch送付済みです。 https://github.com/vim-jp/ctags/pull/3#issuecomment-26707978

ということでこのIssueはクローズさせて頂きます。Thanks.