2012-08-03 128 views
1

我想使用cygwin在Windows上編譯enc2ly(http://enc2ly.sourceforge.net/en/),但它會給出錯誤。當我鍵入./configure,結果如下:在Windows上編譯:爲什麼cygwin無法識別gettext?

checking for a BSD-compatible install... /usr/bin/install -c 
checking whether build environment is sane... yes 
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p 
checking for gawk... gawk 
checking whether make sets $(MAKE)... yes 
checking build system type... i686-pc-cygwin 
checking host system type... i686-pc-cygwin 
checking for gcc... gcc 
checking whether the C compiler works... yes 
checking for C compiler default output file name... a.exe 
checking for suffix of executables... .exe 
checking whether we are cross compiling... no 
checking for suffix of object files... o 
checking whether we are using the GNU C compiler... yes 
checking whether gcc accepts -g... yes 
checking for gcc option to accept ISO C89... none needed 
checking for style of include used by make... GNU 
checking dependency style of gcc... gcc3 
checking whether NLS is requested... yes 
checking for msgfmt... /usr/bin/msgfmt 
checking for gmsgfmt... /usr/bin/msgfmt 
checking for xgettext... /usr/bin/xgettext 
checking for msgmerge... /usr/bin/msgmerge 
checking for ld used by GCC... /usr/i686-pc-cygwin/bin/ld.exe 
checking if the linker (/usr/i686-pc-cygwin/bin/ld.exe) is GNU ld... yes 
checking for shared library run path origin... done 
checking how to run the C preprocessor... gcc -E 
checking for grep that handles long lines and -e... /usr/bin/grep 
checking for egrep... /usr/bin/grep -E 
checking for CFPreferencesCopyAppValue... no 
checking for CFLocaleCopyCurrent... no 
checking for GNU gettext in libc... no 
checking for iconv... yes 
checking for working iconv... yes 
checking how to link with libiconv... -liconv 
checking for GNU gettext in libintl... yes 
checking whether to use NLS... yes 
checking where the gettext function comes from... external libintl 
checking how to link with libintl... -lintl 
checking for ANSI C header files... yes 
checking for sys/types.h... yes 
checking for sys/stat.h... yes 
checking for stdlib.h... yes 
checking for string.h... yes 
checking for memory.h... yes 
checking for strings.h... yes 
checking for inttypes.h... yes 
checking for stdint.h... yes 
checking for unistd.h... yes 
checking for stdlib.h... (cached) yes 
checking for string.h... (cached) yes 
checking for error_at_line... yes 
checking for memset... yes 
checking for strstr... yes 
configure: creating ./config.status 
config.status: creating Makefile 
config.status: creating dok/Makefile 
config.status: creating iloj/Makefile 
config.status: creating kod/Makefile 
config.status: creating enc2ly.spec 
config.status: creating enc2ly.lsm 
config.status: creating po/Makefile.in 
config.status: creating config.h 
config.status: executing depfiles commands 
config.status: executing po-directories commands 
config.status: creating po/POTFILES 
config.status: creating po/Makefile 

當我鍵入make,它失敗。我懷疑問題在這裏:

checking for CFPreferencesCopyAppValue... no 
checking for CFLocaleCopyCurrent... no 
checking for GNU gettext in libc... no 

那麼,什麼軟件包丟失?或者是另一回事?不管怎麼說,還是要謝謝你。

----------------------編輯----------------------- -

我用./configure --disable-nls它工作。所以問題就是gettext。

checking for GNU gettext in libc... no 

我已經安裝了gettext包。有什麼遺漏?我必須解決這個問題,因爲程序的主要語言是世界語!

回答

2

我花了一些時間(可能太多)玩這個,我已經設法讓它建立。

在Ubuntu 12.04上,它構建出 .tar.gz文件沒有問題,查找和使用GNU gettext。在Cygwin上,我會遇到同樣的錯誤。

一個區別是,在Cygwin上,使用gettext的程序需要鏈接到-lintl;在Ubuntu上,它不會(顯然gettext在標準C庫中)。

經過一番與configure腳本亂搞,我想出了以下解決方法:

首先,調用./configure前的環境變量$LIBS設置爲"-lintl"。其次,看起來Ubuntu庫,但不是Cygwin庫,提供了一個未公開的符號_nl_domain_bindings,由configure生成的小測試程序依賴於該符號。所以我砍了configure腳本,在生成的C測試程序中註釋了對_nl_domain_bindings的引用。

黑客configure不是解決此問題的正確方法;其他工具會生成configure腳本(釋放源之前)。您需要熟悉GNU autoconf的人才能提出更好的解決方案。並且configure應該能夠自己檢測需要-lintl選項。

而且這裏的東西真的很奇怪:的-lintl源樹只發生在​​以下行:

LIBS=`echo " $LIBS " | sed -e 's/ -lintl//' -e 's/^ //' -e 's/ $//'` 

它是由修改$LIBS去除-lintl任何發生。如果有一些評論解釋這一點,那很可能是世界語。 (從來沒有想過我會說,除了作爲一個笑話。)

所以我註釋掉這一行,和它的工作,產生enc2ly.exe文件,如果我不帶任何參數調用它至少打印用法消息:

$ /usr/local/apps/enc2ly-0.2/bin/enc2ly.exe 
Dosieroj sukcese procezitaj: 0 (domaĝe!) 
$ 

是的,這就是世界語;谷歌翻譯翻譯它,而不是完全成功,要

Files successfully procezitaj: 0 (domaĝe!) 

我保存在本地的Git倉庫我 修改 醜陋的黑客。下面是git diff輸出:

diff --git a/configure b/configure 
index 1605a50..8d1a1b7 100755 
--- a/configure 
+++ b/configure 
@@ -5162,12 +5162,12 @@ else 
#include <libintl.h> 
$gt_revision_test_code 
extern int _nl_msg_cat_cntr; 
-extern int *_nl_domain_bindings; 
+/* extern int *_nl_domain_bindings; */ 
int 
main() 
{ 
bindtextdomain ("", ""); 
-return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings 
+return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr /* + *_nl_domain_bindings */ 
    ; 
    return 0; 
} 
diff --git a/m4/gettext.m4 b/m4/gettext.m4 
index f84e6a5..6c77c3a 100644 
--- a/m4/gettext.m4 
+++ b/m4/gettext.m4 
@@ -247,7 +247,7 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a 
     USE_INCLUDED_LIBINTL=yes 
     LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" 
     LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" 
-  LIBS=`echo " $LIBS " | sed -e 's/ -lintl//' -e 's/^ //' -e 's/ $//'` 
+#  LIBS=`echo " $LIBS " | sed -e 's/ -lintl//' -e 's/^ //' -e 's/ $//'` 
     fi 

     CATOBJEXT= 

enc2ly-0.2.tar.gz,解開它,應用上述變化(足夠容易做手工),環境變量$LIBS設置爲-lintl,建立和正常安裝,並且你應該是好走。

你可能想聯繫維護人員解決這個問題;我確定他們想要實施比這更清潔的解決方案。

+0

問題是,事情仍然是在世界語(我不知道你是否注意到我的問題編輯)。但至少它是有效的,語言並不是真正的障礙,因爲這是一個簡單的程序,谷歌翻譯就在那裏。如你所說,我(我們)在這方面花費了太多時間。也許我會嘗試使用minGW來構建它,或者請求我的一些朋友在Linux上進行交叉編譯。無論如何,感謝您的時間和精力。 – TiagoPC 2012-08-08 15:28:54

相關問題