New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译安装的方法 #45

Closed
xiangshouding opened this Issue May 11, 2015 · 7 comments

Comments

Projects
None yet
4 participants
@xiangshouding
Copy link
Collaborator

xiangshouding commented May 11, 2015

最近发现很多 Linux glibc 由于内核不同 glibc 版本匹配有误,导致已经提供的二进制包加载不起来,如果遇到此种情况,可以按照以下的方法进行编译安装;

编译方法

  $ git clone https://github.com/zhangyuanwei/node-images
  $ cd node-images
  $ git submodule init
  $ git submodule update
  $ cd gyp
  $ sh third-party.sh
  $ cd ..
  $ npm install
  $ node-gyp rebuild

大概四个步骤

  • Clone 代码,包括主代码和依赖gyp
  • 执行 sh third-party.sh 来下载 gyp 用到的所有的源码包,可能会由于墙之类的下载会比较吃力,请自备梯子。另外需要 cmake 请安装它 sudo apt-get install cmake
  • 安装 nannpm install
  • 编译, node-gyp rebuild;可能你没有 node-gyp 请安装它 npm install -g node-gyp
@corecible

This comment has been minimized.

Copy link

corecible commented Dec 5, 2015

我的操作系统为debian 8
脚本中 libpng 的1.6.16已经无法下载,自己手动换成了 1.6.19。在使用node-gyp rebuild
时遇到如下问题,估计是什么问题。
obj.target/zlib/gyp/third-party/zlib/inffast.o
CC(target) Release/obj.target/zlib/gyp/third-party/zlib/inflate.o
CC(target) Release/obj.target/zlib/gyp/third-party/zlib/inftrees.o
CC(target) Release/obj.target/zlib/gyp/third-party/zlib/trees.o
CC(target) Release/obj.target/zlib/gyp/third-party/zlib/uncompr.o
CC(target) Release/obj.target/zlib/gyp/third-party/zlib/zutil.o
AR(target) Release/obj.target/gyp/gyp/zlib.a
COPY Release/zlib.a
CXX(target) Release/obj.target/binding/src/Image.o
../src/Image.cc:27:11: error: ‘v8::MaybeLocal’ has not been declared
using v8::MaybeLocal;
^
../src/Image.cc: In static member function ‘static void Image::Init(v8::Localv8::Object)’:
../src/Image.cc:65:33: error: ‘class v8::Object’ has no member named ‘GetIsolate’
Isolate isolate = exports->GetIsolate();
^
../src/Image.cc: In static member function ‘static void Image::ToBuffer(const v8::FunctionCallbackInfov8::Value&)’:
../src/Image.cc:425:25: error: ‘MaybeLocal’ was not declared in this scope
MaybeLocal maybeBuffer = node::Buffer::New(args.GetIsolate(), (size_t) length);
^
../src/Image.cc:425:42: error: expected primary-expression before ‘>’ token
MaybeLocal maybeBuffer = node::Buffer::New(args.GetIsolate(), (size_t) length);
^
../src/Image.cc:425:44: error: ‘maybeBuffer’ was not declared in this scope
MaybeLocal maybeBuffer = node::Buffer::New(args.GetIsolate(), (size_t) length);
^
../src/Image.cc: In constructor ‘Image::Image()’:
../src/Image.cc:53:78: warning: value computed is not used [-Wunused-value]
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc));
^
../src/Image.cc:469:5: note: in expansion of macro ‘AdjustAmountOfExternalAllocatedMemory’
AdjustAmountOfExternalAllocatedMemory(size);
^
../src/Image.cc: In destructor ‘virtual Image::~Image()’:
../src/Image.cc:53:78: warning: value computed is not used [-Wunused-value]
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc));
^
../src/Image.cc:479:5: note: in expansion of macro ‘AdjustAmountOfExternalAllocatedMemory’
AdjustAmountOfExternalAllocatedMemory(-size);
^
../src/Image.cc: In member function ‘ImageState PixelArray::Malloc(size_t, size_t)’:
../src/Image.cc:53:78: warning: value computed is not used [-Wunused-value]
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc));
^
../src/Image.cc:524:5: note: in expansion of macro ‘AdjustAmountOfExternalAllocatedMemory’
AdjustAmountOfExternalAllocatedMemory(size);
^
../src/Image.cc: In member function ‘void PixelArray::Free()’:
../src/Image.cc:53:78: warning: value computed is not used [-Wunused-value]
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc));
^
../src/Image.cc:550:9: note: in expansion of macro ‘AdjustAmountOfExternalAllocatedMemory’
AdjustAmountOfExternalAllocatedMemory(-size);
^
binding.target.mk:109: recipe for target 'Release/obj.target/binding/src/Image.o' failed
make: ** [Release/obj.target/binding/src/Image.o] Error 1
make: Leaving directory '/home/yangqw/node-images/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/yangqw/nodejs/node-v0.12.7-linux-x86/lib/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.16.0-4-686-pae
gyp ERR! command "node" "/home/yangqw/nodejs/node-v0.12.7-linux-x86/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/yangqw/node-images
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok

@xiangshouding

This comment has been minimized.

Copy link
Collaborator

xiangshouding commented Dec 6, 2015

5.0 貌似接口都改了

@corecible

This comment has been minimized.

Copy link

corecible commented Dec 9, 2015

有解决办法吗?

@painty

This comment has been minimized.

Copy link

painty commented Jun 28, 2016

请问,Windows下如何自己编译呢?虽然有编译好的,但不适用于electron,所以想自己编译。

@sdming

This comment has been minimized.

Copy link

sdming commented Jun 5, 2017

centos6.6上运行报错:需要安装glibc2.14,根据此文rebuild时报错

/gyp/third-party/libjpeg-turbo/jpeglib.h:902:36: error: ‘JPEG_LIB_VERSION’ undeclared (first use in this function)

@xiangshouding

This comment has been minimized.

Copy link
Collaborator

xiangshouding commented Jun 5, 2017

@sdming cmake 装了么

@sdming

This comment has been minimized.

Copy link

sdming commented Jun 6, 2017

@xiangshouding
已经装了,报错的信息如下

`
In file included from ../gyp/third-party/libjpeg-turbo/cdjpeg.h:17:0,
from ../gyp/third-party/libjpeg-turbo/bmp.c:33:
../gyp/third-party/libjpeg-turbo/jpeglib.h:67:1: error: unknown type name ‘JSAMPLE’
typedef JSAMPLE JSAMPROW; / ptr to one image row of pixel samples. /
^
../gyp/third-party/libjpeg-turbo/jpeglib.h:656:3: error: unknown type name ‘JSAMPLE’
JSAMPLE * sample_range_limit; /
table for fast range-limiting */
^
../gyp/third-party/libjpeg-turbo/bmp.c: In function ‘loadbmp’:
../gyp/third-party/libjpeg-turbo/jpeglib.h:899:34: error: ‘JPEG_LIB_VERSION’ undeclared (first use in this function)
jpeg_CreateCompress((cinfo), JPEG_LIB_VERSION, \

`

系统信息
`
[root@centos66 node-images]# node -v
v6.9.1
[root@centos66 node-images]# npm -v
3.10.3
[root@centos66 node-images]# strings /lib64/libc.so.6 |grep GLIBC_
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_PRIVATE
[root@centos66 node-images]# rpm -qa |grep glibc
glibc-headers-2.12-1.149.el6.x86_64
glibc-common-2.12-1.149.el6.x86_64
glibc-devel-2.12-1.149.el6.x86_64
glibc-2.12-1.149.el6.x86_64
[root@centos66 node-images]# cat /proc/version
Linux version 2.6.32-504.el6.x86_64 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed Oct 15 04:27:16 UTC 2014

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment