pkrumins / node-gif

A node.js C++ module for creating GIF images and animated GIFs from RGB or RGBA buffers.
http://www.catonmat.net
214 stars 29 forks source link

Does not compile on debian, node v0.8.22. node-gif v2.0.1 compiles fine. #13

Closed mape closed 11 years ago

mape commented 11 years ago

When using npm it fails to compile. v2.0.1 compiles fine but is missing AnimatedGif.setOutputCallback.

dunderklumpen:/var/www/project# npm install gif
npm http GET https://registry.npmjs.org/gif
npm http 304 https://registry.npmjs.org/gif
npm http GET https://registry.npmjs.org/bindings/1.1.0
npm http 304 https://registry.npmjs.org/bindings/1.1.0

> gif@2.0.2 install /var/www/project/node_modules/gif
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/0.8.22"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/var/www/project/node_modules/gif/.node-gyp"
gyp http GET http://nodejs.org/dist/v0.8.22/node-v0.8.22.tar.gz
gyp http 200 http://nodejs.org/dist/v0.8.22/node-v0.8.22.tar.gz
make: Entering directory `/var/www/project/node_modules/gif/build'
  CC(target) Release/obj.target/giflib/deps/giflib/dgif_lib.o
  CC(target) Release/obj.target/giflib/deps/giflib/egif_lib.o
  CC(target) Release/obj.target/giflib/deps/giflib/gif_err.o
  CC(target) Release/obj.target/giflib/deps/giflib/gif_font.o
  CC(target) Release/obj.target/giflib/deps/giflib/gif_hash.o
  CC(target) Release/obj.target/giflib/deps/giflib/gifalloc.o
  CC(target) Release/obj.target/giflib/deps/giflib/quantize.o
  AR(target) Release/obj.target/deps/giflib/giflib.a
  COPY Release/giflib.a
  CXX(target) Release/obj.target/gif/src/animated_gif.o
In file included from ../src/animated_gif.cpp:3:0:
../src/common.h: In constructor ‘Color::Color(unsigned char, unsigned char, unsigned char, bool)’:
../src/common.h:25:25: warning: ‘Color::b’ will be initialized after [-Wreorder]
../src/common.h:24:10: warning:   ‘bool Color::color_present’ [-Wreorder]
../src/common.h:26:5: warning:   when initialized here [-Wreorder]
In file included from ../src/animated_gif.cpp:5:0:
../src/animated_gif.h: In constructor ‘AnimatedGif::AnimatedGif(int, int, buffer_type)’:
../src/animated_gif.h:16:11: warning: ‘AnimatedGif::transparency_color’ will be initialized after [-Wreorder]
../src/animated_gif.h:15:20: warning:   ‘unsigned char* AnimatedGif::data’ [-Wreorder]
../src/animated_gif.cpp:29:1: warning:   when initialized here [-Wreorder]
../src/animated_gif.cpp: In member function ‘v8::Handle<v8::Value> AnimatedGif::Push(unsigned char*, int, int, int, int)’:
../src/animated_gif.cpp:56:12: warning: enumeration value ‘BUF_RGBA’ not handled in switch [-Wswitch]
../src/animated_gif.cpp:56:12: warning: enumeration value ‘BUF_BGRA’ not handled in switch [-Wswitch]
../src/animated_gif.cpp:79:1: warning: control reaches end of non-void function [-Wreturn-type]
  CXX(target) Release/obj.target/gif/src/async_animated_gif.o
In file included from ../src/async_animated_gif.cpp:4:0:
../src/common.h: In constructor ‘Color::Color(unsigned char, unsigned char, unsigned char, bool)’:
../src/common.h:25:25: warning: ‘Color::b’ will be initialized after [-Wreorder]
../src/common.h:24:10: warning:   ‘bool Color::color_present’ [-Wreorder]
../src/common.h:26:5: warning:   when initialized here [-Wreorder]
../src/async_animated_gif.cpp: In static member function ‘static void AsyncAnimatedGif::EIO_Push(eio_req*)’:
../src/async_animated_gif.cpp:66:1: warning: unused variable ‘scopeGuard66’ [-Wunused-variable]
../src/async_animated_gif.cpp: In static member function ‘static void AsyncAnimatedGif::push_fragment(unsigned char*, int, int, buffer_type, unsigned char*, int, int, int, int)’:
../src/async_animated_gif.cpp:283:12: warning: enumeration value ‘BUF_RGBA’ not handled in switch [-Wswitch]
../src/async_animated_gif.cpp:283:12: warning: enumeration value ‘BUF_BGRA’ not handled in switch [-Wswitch]
../src/async_animated_gif.cpp:281:20: warning: unused variable ‘fragmentp’ [-Wunused-variable]
../src/async_animated_gif.cpp: In static member function ‘static void AsyncAnimatedGif::EIO_Encode(eio_req*)’:
../src/async_animated_gif.cpp:328:76: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t {aka long unsigned int}’ [-Wformat]
../src/async_animated_gif.cpp:328:76: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t {aka long unsigned int}’ [-Wformat]
../src/async_animated_gif.cpp:352:60: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t {aka long unsigned int}’ [-Wformat]
../src/async_animated_gif.cpp:352:60: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘size_t {aka long unsigned int}’ [-Wformat]
../src/async_animated_gif.cpp:361:1: warning: unused variable ‘scopeGuard361’ [-Wunused-variable]
../src/async_animated_gif.cpp:364:1: warning: unused variable ‘scopeGuard364’ [-Wunused-variable]
../src/async_animated_gif.cpp:338:1: warning: unused variable ‘scopeGuard338’ [-Wunused-variable]
../src/async_animated_gif.cpp:344:1: warning: unused variable ‘scopeGuard344’ [-Wunused-variable]
  CXX(target) Release/obj.target/gif/src/buffer_compat.o
  CXX(target) Release/obj.target/gif/src/common.o
In file included from ../src/common.cpp:3:0:
../src/common.h: In constructor ‘Color::Color(unsigned char, unsigned char, unsigned char, bool)’:
../src/common.h:25:25: warning: ‘Color::b’ will be initialized after [-Wreorder]
../src/common.h:24:10: warning:   ‘bool Color::color_present’ [-Wreorder]
../src/common.h:26:5: warning:   when initialized here [-Wreorder]
  CXX(target) Release/obj.target/gif/src/dynamic_gif_stack.o
In file included from ../src/dynamic_gif_stack.cpp:1:0:
../src/common.h: In constructor ‘Color::Color(unsigned char, unsigned char, unsigned char, bool)’:
../src/common.h:25:25: warning: ‘Color::b’ will be initialized after [-Wreorder]
../src/common.h:24:10: warning:   ‘bool Color::color_present’ [-Wreorder]
../src/common.h:26:5: warning:   when initialized here [-Wreorder]
../src/dynamic_gif_stack.cpp: In static member function ‘static void DynamicGifStack::EIO_GifEncode(eio_req*)’:
../src/dynamic_gif_stack.cpp:281:17: warning: unused variable ‘pbt’ [-Wunused-variable]
  CXX(target) Release/obj.target/gif/src/gif.o
In file included from ../src/gif.cpp:3:0:
../src/common.h: In constructor ‘Color::Color(unsigned char, unsigned char, unsigned char, bool)’:
../src/common.h:25:25: warning: ‘Color::b’ will be initialized after [-Wreorder]
../src/common.h:24:10: warning:   ‘bool Color::color_present’ [-Wreorder]
../src/common.h:26:5: warning:   when initialized here [-Wreorder]
  CXX(target) Release/obj.target/gif/src/gif_encoder.o
In file included from ../src/gif_encoder.h:7:0,
                 from ../src/gif_encoder.cpp:8:
../src/common.h: In constructor ‘Color::Color(unsigned char, unsigned char, unsigned char, bool)’:
../src/common.h:25:25: warning: ‘Color::b’ will be initialized after [-Wreorder]
../src/common.h:24:10: warning:   ‘bool Color::color_present’ [-Wreorder]
../src/common.h:26:5: warning:   when initialized here [-Wreorder]
../src/gif_encoder.cpp: In member function ‘void GifEncoder::encode()’:
../src/gif_encoder.cpp:191:13: warning: narrowing conversion of ‘i’ from ‘int’ to ‘char’ inside { } is ill-formed in C++11 [-Wnarrowing]
../src/gif_encoder.cpp:196:57: error: ‘FALSE’ was not declared in this scope
../src/gif_encoder.cpp:151:1: warning: unused variable ‘scopeGuard151’ [-Wunused-variable]
../src/gif_encoder.cpp:156:1: warning: unused variable ‘scopeGuard156’ [-Wunused-variable]
../src/gif_encoder.cpp:174:1: warning: unused variable ‘scopeGuard174’ [-Wunused-variable]
In file included from ../src/gif_encoder.cpp:8:0:
../src/gif_encoder.h: In constructor ‘AnimatedGifEncoder::AnimatedGifEncoder(int, int, buffer_type)’:
../src/gif_encoder.h:52:11: warning: ‘AnimatedGifEncoder::write_user_data’ will be initialized after [-Wreorder]
../src/gif_encoder.h:47:10: warning:   ‘bool AnimatedGifEncoder::headers_set’ [-Wreorder]
../src/gif_encoder.cpp:236:1: warning:   when initialized here [-Wreorder]
../src/gif_encoder.cpp: In member function ‘void AnimatedGifEncoder::new_frame(unsigned char*, int)’:
../src/gif_encoder.cpp:271:60: error: ‘FALSE’ was not declared in this scope
../src/gif_encoder.cpp:322:5: warning: narrowing conversion of ‘(delay % 256)’ from ‘int’ to ‘char’ inside { } is ill-formed in C++11 [-Wnarrowing]
../src/gif_encoder.cpp:322:5: warning: narrowing conversion of ‘(delay / 256)’ from ‘int’ to ‘char’ inside { } is ill-formed in C++11 [-Wnarrowing]
../src/gif_encoder.cpp:325:57: error: ‘FALSE’ was not declared in this scope
../src/gif_encoder.cpp: At global scope:
../src/gif_encoder.cpp:31:1: warning: ‘int nearest_pow2(int)’ defined but not used [-Wunused-function]
make: *** [Release/obj.target/gif/src/gif_encoder.o] Error 1
make: Leaving directory `/var/www/project/node_modules/gif/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/npm/node_modules/node-gyp/lib/build.js:256: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-5-amd64
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/project/node_modules/gif
gyp ERR! node -v v0.8.22
gyp ERR! node-gyp -v v0.8.5
gyp ERR! not ok 
npm ERR! gif@2.0.2 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! 
npm ERR! Failed at the gif@2.0.2 install script.
npm ERR! This is most likely a problem with the gif package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls gif
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 2.6.32-5-amd64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "gif"
npm ERR! cwd /var/www/project
npm ERR! node -v v0.8.22
npm ERR! npm -v 1.2.14
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/www/project/npm-debug.log
npm ERR! not ok code 0
mape commented 11 years ago

Seems adding

#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif

to gif_encoder.cpp does the trick.

mlilley commented 11 years ago

FYI, this issue in gif_encoder.cpp (missing FALSE definition, line 196 et al) is still present. Is a fix for this planned or is something else going wrong?

pkrumins commented 11 years ago

Can someone send a pull request? I don't wan't to mess it up as I'm not completely sure how to fix it with those TRUE and FALSE definitions.

dariusk commented 11 years ago

As you can see above, I've submitted a pull request. In the meantime, you can point your package.json to the tarball of my fork and it should work:

  "dependencies": {
    "gif": "https://github.com/dariusk/node-gif/archive/master.tar.gz"
  }