uim-1.5.0-betaをDebian etchでコンパイルしようとすると、
LLONG_MIN undeclaredエラーが発生します。

* 現象
Debian etchで以下のコンパイルエラーが発生します。

|  gcc -DHAVE_CONFIG_H -I. -I../uim -I../replace -I../uim -g -O2 -pedantic 
-pipe -Wall -Wchar-subscripts -Wmissing-declarations -Wredundant-decls 
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align 
-Wsign-compare -Wno-long-long -DNDEBUG -MT strtonum.lo -MD -MP -MF 
.deps/strtonum.Tpo -c strtonum.c  -fPIC -DPIC -o .libs/strtonum.o
| strtonum.c: In function 'uim_strtonum':
| strtonum.c:58: error: 'LLONG_MIN' undeclared (first use in this function)
| strtonum.c:58: error: (Each undeclared identifier is reported only once
| strtonum.c:58: error: for each function it appears in.)
| strtonum.c:60: error: 'LLONG_MAX' undeclared (first use in this function)

* 原因
configureでLLONG_MIN/LLONG_MAXが検出できないようで、
config.hで#defineされていません。
Sanity checkに失敗していました。

gcc 3.xだと以下のifは意図通りfalseになるが、
gcc 4.1だとllmin - 1 < llmin || llmax + 1 > llmaxが
常にtrueとみなされるようで、意図しない結果になっています。
        /* Sanity check */
        if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax

以下のBugと同じ原因だと思います。詳細な分析があります。
Gentoo Bug 136300 - app-backup/boxbackup-0.10 fails with gcc-4.1.x
http://bugs.gentoo.org/show_bug.cgi?id=136300

* 対処
試しに一度変数に入れて比較すると大丈夫だったので、
以下のように変更してコンパイルしました。
trunkにはcommitしました(r5402)。

Index: configure.ac
===================================================================
--- configure.ac        (revision 5400)
+++ configure.ac        (working copy)
@@ -425,7 +425,7 @@
 
 int main(void) {
        FILE *f;
-       long long i, llmin, llmax = 0;
+       long long i, llmin, llmax = 0, llmin1, llmax1;
 
        if((f = fopen(DATA,"w")) == NULL)
                exit(1);
@@ -443,7 +443,9 @@
 #endif
 
        /* Sanity check */
-       if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
+       llmin1 = llmin - 1;
+       llmax1 = llmax + 1;
+       if (llmin + 1 < llmin || llmin1 < llmin || llmax1 > llmax
            || llmax - 1 > llmax || llmin == llmax || llmin == 0
            || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
                fprintf(f, "unknown unknown\n");


なお、上記のboxbackup-0.10では、LLONG_MAXを使うのをやめて、
std::numeric_limits<long long>::maxに変更したようです。

* 環境
Debian GNU/Linux 4.0 ("etch")
ただし、coLinux 0.7.1上。
Root FS Images(2.6.x-based)はDebian-4.0r0-etch.ext3.1gb.bz2
この上でapt-get update; apt-get upgradeした環境。
% uname -a
Linux colinux 2.6.12-co-0.7.1 #1 Sat Jul 14 12:13:49 UTC 2007 i686 GNU/Linux
% cat /etc/debian_version
4.0
% gcc --version
gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

-- 
木原 英人 / KIHARA, Hideto / 
[&#x30E1;&#x30FC;&#x30EB;&#x30A2;&#x30C9;&#x30EC;&#x30B9;&#x4FDD;&#x8B77;]
http://www1.interq.or.jp/~deton/


--~--~---------~--~----~------------~-------~--~----~
Google Groups "uim-ja" group
uim-ja@googlegroups.com
http://groups.google.com/group/uim-ja/about
-~----------~----~----~----~------~----~------~--~---

メールによる返信