在 Solaris 上构建 Node.JS:“使用”仅在 c99 编译环境中有效。”
我正在尝试在 Solaris 上安装 Node.JS。这是开箱即用的 Solaris 9/10 x86(最新版本是 2010 年 9 月)并且仅使用默认软件包。
我遵循的指示在这里: https://github.com/joyent/node/wiki/Installation 。我正在使用在其主页上找到的最新稳定版本的 Node.JS http://nodejs.org
这是我的已经尝试过......
-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."
我可以像这样重新创建
-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。我没有做任何会改变任何编译器或默认安装的任何其他东西的事情。
I am attempting to install Node.JS on Solaris. This is out of the box Solaris 9/10 x86 (September 2010 which is most recent) and using only default packages.
The directions I am following are here: https://github.com/joyent/node/wiki/Installation. I am using the latest stable version of Node.JS found on their home page http://nodejs.org
Here is what I have tried...
-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#
I think the key error is
/usr/include/stdbool.h:42:2: #error "Use of <stdbool.h> is valid only in a c99 compilation environment."
which I can recreate like this
-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#
Any ideas? Do I need to specify a different option to use C99 or to not use C99?
Again, this is out of the box Solaris 9/10 on x86. I have not done anything that would change any of the compilers or for that matter any other stuff that is installed by default.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在调用
./configure
之前,尝试将-std=c99
或-std=gnu99
添加到CFLAGS
中,如下所示:CFLAGS=-std=c99 ./configure --prefix=/tmp/node
此错误意味着 Node.JS 可能在其
configure 中使用
脚本何时应使用AC_PROG_CC
。 acAC_PROG_CC_C99
,请参阅 autoconf手册上关于C编译器检测的页面。您应该向 Node.JS 开发人员报告此错误,并测试正确的解决方案是否适用于您的系统。Try adding
-std=c99
or-std=gnu99
to yourCFLAGS
before invoking./configure
, like so:CFLAGS=-std=c99 ./configure --prefix=/tmp/node
This error means that Node.JS is probably using
AC_PROG_CC
in itsconfigure.ac
script when it should be usingAC_PROG_CC_C99
, see the page on C compiler detection on autoconf's manual. You should report this bug to the Node.JS developers, and test that the proper solution works on your system.我通过执行以下操作克服了此错误:
CC=/path/to/solaris_32/bin/gcc (然后是我尝试运行的 make 命令)
这样它就知道使用 gcc 而不是抛出的 /usr/bin/cc错误。
I got past this error by doing:
CC=/path/to/solaris_32/bin/gcc (and then the make command I was trying to run)
This way it knew to use gcc and not /usr/bin/cc which was throwing the error.