在Solaris上构buildNode.JS:“使用<stdbool.h>仅在c99编译环境中有效。”

我正在尝试在Solaris上安装Node.JS。 这是开箱即用的Solaris 9/10 x86(2010年9月最新的版本),仅使用默认软件包。

我在下面的指示是: https : //github.com/joyent/node/wiki/Installation 。 我正在使用他们的主页http://nodejs.org上find的最新的稳定版本的Node.JS

这是我试过的…

-bash-3.00# export PATH=$PATH:/usr/sfw/bin:/usr/xpg4/bin -bash-3.00# ./configure --prefix=/tmp/node Checking for program g++ or c++ : /usr/sfw/bin/g++ Checking for program cpp : /usr/sfw/bin/cpp Checking for program ar : /usr/xpg4/bin/ar Checking for program ranlib : not found Checking for g++ : ok Checking for program gcc or cc : /usr/sfw/bin/gcc Checking for program ar : /usr/xpg4/bin/ar Checking for program ranlib : not found Checking for gcc : ok Checking for library dl : yes Checking for openssl : yes Checking for library util : not found Checking for library rt : yes Checking for library socket : yes Checking for library nsl : yes --- libeio --- Checking for library pthread : yes Checking for function pthread_create : yes Checking for function pthread_atfork : yes Checking for futimes(2) : no Checking for readahead(2) : no Checking for fdatasync(2) : no Checking for pread(2) and pwrite(2) : yes Checking for sendfile(2) : no Checking for sync_file_range(2) : no --- libev --- Checking for header sys/inotify.h : not found Checking for header sys/epoll.h : not found Checking for header port.h : yes Checking for function port_create : yes Checking for header poll.h : yes Checking for function poll : yes Checking for header sys/event.h : not found Checking for header sys/queue.h : yes Checking for function kqueue : not found Checking for header sys/select.h : yes Checking for function select : yes Checking for header sys/eventfd.h : not found Checking for SYS_clock_gettime : no Checking for library rt : yes Checking for function clock_gettime : yes Checking for function nanosleep : yes Checking for function ceil : yes Checking for fdatasync(2) with c++ : no 'configure' finished successfully (1.936s) -bash-3.00# make Waf: Entering directory `/tmp/node-v0.4.3/build' DEST_OS: sunos DEST_CPU: ia32 Parallel Jobs: 1 Product type: program [ 3/75] cc: deps/c-ares/ares_strcasecmp.c -> build/default/deps/c-ares/ares_strcasecmp_1.o /usr/sfw/bin/gcc -D_GNU_SOURCE -DHAVE_CONFIG_H=1 -threads -m32 -g -O3 -DHAVE_OPENSSL=1 -DEV_FORK_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_MULTIPLICITY=0 -DX_STACKSIZE=65536 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DEV_MULTIPLICITY=0 -DHAVE_FDATASYNC=0 -DPLATFORM="sunos" -D__POSIX__=1 -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -DNDEBUG -Idefault/deps/c-ares -I../deps/c-ares -Idefault/deps/c-ares/sunos-ia32 -I../deps/c-ares/sunos-ia32 ../deps/c-ares/ares_strcasecmp.c -c -o default/deps/c-ares/ares_strcasecmp_1.o In file included from ../deps/c-ares/setup_once.h:73, from ../deps/c-ares/sunos-ia32/ares_setup.h:195, from ../deps/c-ares/ares_strcasecmp.c:18: /usr/include/stdbool.h:42:2: #error "Use of <stdbool.h> is valid only in a c99 compilation environment." Waf: Leaving directory `/tmp/node-v0.4.3/build' Build failed: -> task failed (err #1): {task: cc ares_strcasecmp.c -> ares_strcasecmp_1.o} *** Error code 1 The following command caused the error: python tools/waf-light --product-type=program build make: Fatal error: Command failed for target `program' -bash-3.00# 

我认为关键的错误是

 /usr/include/stdbool.h:42:2: #error "Use of <stdbool.h> is valid only in a c99 compilation environment." 

我可以像这样重新创build

 -bash-3.00# cd build -bash-3.00# /usr/sfw/bin/gcc -D_GNU_SOURCE -DHAVE_CONFIG_H=1 -threads -m32 -g -O3 -DHAVE_OPENSSL=1 -DEV_FORK_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_MULTIPLICITY=0 -DX_STACKSIZE=65536 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DEV_MULTIPLICITY=0 -DHAVE_FDATASYNC=0 -DPLATFORM="sunos" -D__POSIX__=1 -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -DNDEBUG -Idefault/deps/c-ares -I../deps/c-ares -Idefault/deps/c-ares/sunos-ia32 -I../deps/c-ares/sunos-ia32 ../deps/c-ares/ares_strcasecmp.c -c -o default/deps/c-ares/ares_strcasecmp_1.o In file included from ../deps/c-ares/setup_once.h:73, from ../deps/c-ares/sunos-ia32/ares_setup.h:195, from ../deps/c-ares/ares_strcasecmp.c:18: /usr/include/stdbool.h:42:2: #error "Use of <stdbool.h> is valid only in a c99 compilation environment." -bash-3.00# cd .. -bash-3.00# 

有任何想法吗? 我是否需要指定不同的选项来使用C99或不使用C99?

同样,这是x86上的Solaris 9/10。 我没有做过任何会改变任何编译器或任何其他默认安装的东西。

       

网上收集的解决方案 "在Solaris上构buildNode.JS:“使用<stdbool.h>仅在c99编译环境中有效。”"

在调用./configure之前,尝试在CFLAGS添加-std=c99-std=gnu99 ,如下所示:

CFLAGS=-std=c99 ./configure --prefix=/tmp/node

这个错误意味着当Node.JS应该使用AC_PROG_CC ,它的configure.ac脚本中可能使用了AC_PROG_CC_C99 ,请参阅autoconf手册上的C编译器检测页面 。 您应该向Node.JS开发人员报告此错误,并testing适当的解决scheme在您的系统上工作。