Это действительно странно:
: josh@josh; wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.bz2
: josh@josh; tar xvjf ruby-1.8.7.tar.bz2
: josh@josh; cd ruby-1.8.7/
: josh@josh; CFLAGS='-O0 -g -Wall' ./configure --disable-pthread
: josh@josh; make
gcc -O0 -g -Wall -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c array.c
[...]
gcc -O0 -g -Wall -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c math.c
math.c: In function ‘domain_check’:
math.c:37: error: missing binary operator before token "("
make: *** [math.o] Error 1
Разумеется, math.c не может быть скомпилирован:
: josh@josh; gcc -O0 -g -Wall -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c math.c
math.c: In function ‘domain_check’:
math.c:37: error: missing binary operator before token "("
В math.c нет ничего явно плохого:
static void
domain_check(x, msg)
double x;
char *msg;
{
while(1) {
if (errno) {
rb_sys_fail(msg);
}
if (isnan(x)) {
#if defined(EDOM)
errno = EDOM;
#elif define(ERANGE) # <== this is line 37
errno = ERANGE;
#endif
continue;
}
break;
}
}
Давайте посмотрим, что генерирует препроцессор:
: josh@josh; gcc -E -O0 -g -Wall -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c math.c >/tmp/math.c
math.c:37: error: missing binary operator before token "("
Хорошо, выглядит нормально, поэтому давайте скомпилируем его и посмотрим, в чем проблема:
: josh@josh; gcc -O0 -g -Wall -DRUBY_EXPORT -D_GNU_SOURCE=1 -I. -I. -c /tmp/math.c
: josh@josh; echo $?
0
: josh@josh; ls -l math.o
-rw-r--r-- 1 josh josh 20904 2011-03-04 13:47 math.o
Теперь, когда я вручную скомпилировал math.c в math.o, я могу построить Рубин. Но мне все равно хотелось бы знать, что в мире происходит.
Есть идеи?