在SuSE10上,源码编译安装nodejs0.6.10,使用 ./configure --prefix=/usr/local/, 提示:

Checking for openssl: not found
Checking for function SSL_library_init: not found
Checking for header openssl/crypto.h: not found
/usr/local/src/node-v0.6.10/wscript:374: error: Could not autodetect OpenSSL support. Make sure OpenSSL development packages are installed. Use configure --without-ssl to disable this message.

如果不想使用openssl,可以用--without-ssl。但该机器上已经安装了openssl,估计是nodejs没找到openssl的lib路径。编辑/etc/ld.so.conf,添加openssl的安装路径:/usr/local/ssl/lib,然后执行ldconfig,仍然报错。然后:

cp /usr/local/ssl/lib/libcrypto.a libssl.a /usr/lib
cp /usr/local/openssl/include/openssl/*.h /usr/include/openssl

继续configure仍然报错,后来得知和nodejs如何检查开发包有关系,详细请看这里。大概就是 只要找到openssl package 或者 找到function SSL_library_init 即可通过 openssl的检查。首先:

echo $PKG_CONFIG_PATH

找到pkgconfig路径,编辑openssl.pc文件如下,并放到/usr/local/lib/pkgconfig下:

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: OpenSSL-libcrypto
Description: OpenSSL cryptography library
Version: 0.9.8a
Requires:
Libs: -L${libdir} -lcrypto -ldl
Cflags: -I${includedir}

再次./configure --prefix=/usr/local/,通过。make时,还是报错:

Build failed:  -> task failed (err #1):
{task: cxx node_zlib.cc -> node_zlib_5.o}

经检查测试猜测,这个错误可能和zilb版本有关系,于是将最新的zlib头文件和编译好的lib拷贝到/usr/local/include 和 /usr/lib 目录下,编译通过。

原文来源 http://www.sustep.net/journal/nodejs-make-install/

 posted on 2012-04-24 17:43 落叶满长沙 阅读(...) 评论(...) 编辑 收藏