zhangyuanwei / node-images

Cross-platform image decoder(png/jpeg/gif) and encoder(png/jpeg) for Nodejs
https://npmjs.org/package/images
MIT License
1.55k stars 205 forks source link

建议说一下linux环境下如何安装 #12

Closed kongyuan closed 5 years ago

kongyuan commented 11 years ago

麻烦补充一下linux下的安装指导 或者想办法把依赖的几个库并在node-images下一起安装

qdsang commented 11 years ago

centos 机器下

yum install giflib yum install libpng yum install libjpeg-turbo

npm install -g node-gyp cd node-images node-gyp rebuild --target=0.10.13

oxUnd commented 11 years ago

@kongyuan 先clone代码,然后进入代码目录。执行@qdsang 提到的步骤。把编译后的Release目录cp到fis/node_modules/fis-spriter-csssprites/node_modules/目录下,祝好运~

qdsang commented 11 years ago

@xiangshouding 刚刚安装了 libjpeg-turbo 重新编译 报错 make: Entering directory /usr/local/lib/node_modules/fis/node_modules/fis-spriter-csssprites/node_modules/node-images/build' CXX(target) Release/obj.target/node_images/src/Image.o CXX(target) Release/obj.target/node_images/src/Png.o CXX(target) Release/obj.target/node_images/src/Jpeg.o ../src/Jpeg.cc: In function ‘ImageState decodeJpeg(PixelArray*, ImageData*)’: ../src/Jpeg.cc:71: error: ‘jpeg_mem_src’ was not declared in this scope ../src/Jpeg.cc: In function ‘ImageState encodeJpeg(PixelArray*, ImageData*, ImageConfig*)’: ../src/Jpeg.cc:112: error: ‘jpeg_mem_dest’ was not declared in this scope make: *** [Release/obj.target/node_images/src/Jpeg.o] Error 1 make: Leaving directory/usr/local/lib/node_modules/fis/node_modules/fis-spriter-csssprites/node_modules/node-images/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/node-gyp/lib/build.js:267:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:99:17) gyp ERR! stack at Process._handle.onexit (child_process.js:678:10) gyp ERR! System Linux 2.6.32-71.el6.i686 gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild" "--target=0.8.0" gyp ERR! cwd /usr/local/lib/node_modules/fis/node_modules/fis-spriter-csssprites/node_modules/node-images gyp ERR! node -v v0.8.15 gyp ERR! node-gyp -v v0.10.10 gyp ERR! not ok

Package libjpeg-turbo-1.2.1-1.el6.i686 already installed and latest version Package 2:libpng-1.2.49-1.el6_2.i686 already installed and latest version Package giflib-4.1.6-3.1.el6.i686 already installed and latest version 求助 @xiangshouding , 怀疑是版本不对.

oxUnd commented 11 years ago

@qdsang 确认系统默认的-ljpeg就是libjpeg-trubo吗?

qdsang commented 11 years ago

@xiangshouding

ll | grep jpeg
libjpeg.so -> libjpeg.so.62.0.0 libjpeg.so.62 -> libjpeg.so.62.0.0 libjpeg.so.62.0.0 libopenjpeg.so.2 -> libopenjpeg.so.2.1.3.0 libopenjpeg.so.2.1.3.0

这个怎么确认?

oxUnd commented 11 years ago

@qdsang 执行jpegtran -v 'null',如果显示如下 jpegtran -v 'null' Independent JPEG Group's JPEGTRAN, version 8d 15-Jan-2012 Copyright (C) 2012, Thomas G. Lane, Guido Vollbeding jpegtran: can't open null for reading

说明用的是jpeg-8d

如果显示 libjpeg-turbo version 1.3.0 (build 20130613) Copyright (C) 1991-2012 Thomas G. Lane, Guido Vollbeding Copyright (C) 1999-2006 MIYASAKA Masaru Copyright (C) 2009 Pierre Ossman for Cendio AB Copyright (C) 2009-2013 D. R. Commander Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)

Emulating The Independent JPEG Group's software, version 8d 15-Jan-2012

就说明是jpeg-turbo