Automattic / node-canvas

Node canvas is a Cairo backed Canvas implementation for NodeJS.
10.21k stars 1.17k forks source link

Warnings when compiling BMPParser.cc #1767

Open humblewizard opened 3 years ago

humblewizard commented 3 years ago

Command: sudo npm install canvas --build-from-source

The installation fails with errors. The log file is attached.

      npm ERR! code ELIFECYCLE
      npm ERR! errno 1
      npm ERR! canvas@2.7.0 install: `node-pre-gyp install --fallback-to-build`
      npm ERR! Exit status 1
      npm ERR! 
      npm ERR! Failed at the canvas@2.7.0 install script.

Hardware: Raspbery Pi 4 The OS: Raspbian GNU/Linux 10 (buster) npm: 6.14.11 node: 14.16.00

The following ran first without complaint: sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

Log file: 2021-03-20T22_36_55_859Z-debug.log

humblewizard commented 3 years ago

I have it loaded now. I started over with a fresh install of Raspberian OS and rpm. Ran rpm init. Also installed node-gyp and the following dependencies.

  sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

I haven't used it yet but it may be good. Some of the output and warnings from the build is very confusing to me though.

pi@raspberrypi:~ $ npm install canvas npm WARN deprecated node-pre-gyp@0.15.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future

canvas@2.7.0 install /home/pi/node_modules/canvas node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download node-pre-gyp WARN Tried to download(404): https://github.com/Automattic/node-canvas/releases/download/v2.7.0/canvas-v2.7.0-node-v83-linux-glibc-arm.tar.gz node-pre-gyp WARN Pre-built binaries not found for canvas@2.7.0 and node@14.16.0 (node-v83 ABI, glibc) (falling back to source compile with node-gyp) make: Entering directory '/home/pi/node_modules/canvas/build' SOLINK_MODULE(target) Release/obj.target/canvas-postbuild.node COPY Release/canvas-postbuild.node CXX(target) Release/obj.target/canvas/src/backend/Backend.o CXX(target) Release/obj.target/canvas/src/backend/ImageBackend.o CXX(target) Release/obj.target/canvas/src/backend/PdfBackend.o CXX(target) Release/obj.target/canvas/src/backend/SvgBackend.o CXX(target) Release/obj.target/canvas/src/bmp/BMPParser.o ../src/bmp/BMPParser.cc: In member function \u2018void BMPParser::Parser::parse(uint8_t, int, uint8_t)\u2019: ../src/bmp/BMPParser.cc:186:16: warning: comparison of integer expressions of different signedness: \u2018int\u2019 and \u2018unsigned int\u2019 [-Wsign-compare] E(ptr - data > imgdOffset, "image data overlaps with another structure");


../src/bmp/BMPParser.cc:10:25: note: in definition of macro \u2018E\u2019
 #define E(cond, msg) if(cond) return setErr(msg)
                         ^~~~
../src/bmp/BMPParser.cc:201:27: warning: comparison of integer expressions of different signedness: \u2018uint32_t\u2019 {aka \u2018unsigned int\u2019} and \u2018int\u2019 [-Wsign-compare]
   E(ptr - data + imgdSize > len, "not enough image data");
     ~~~~~~~~~~~~~~~~~~~~~~^~~~~
../src/bmp/BMPParser.cc:10:25: note: in definition of macro \u2018E\u2019
 #define E(cond, msg) if(cond) return setErr(msg)
                         ^~~~
  CXX(target) Release/obj.target/canvas/src/Backends.o
  CXX(target) Release/obj.target/canvas/src/Canvas.o
  CXX(target) Release/obj.target/canvas/src/CanvasGradient.o
  CXX(target) Release/obj.target/canvas/src/CanvasPattern.o
  CXX(target) Release/obj.target/canvas/src/CanvasRenderingContext2d.o
  CXX(target) Release/obj.target/canvas/src/closure.o
  CXX(target) Release/obj.target/canvas/src/color.o
  CXX(target) Release/obj.target/canvas/src/Image.o
  CXX(target) Release/obj.target/canvas/src/ImageData.o
  CXX(target) Release/obj.target/canvas/src/init.o
  CXX(target) Release/obj.target/canvas/src/register_font.o
  SOLINK_MODULE(target) Release/obj.target/canvas.node
  COPY Release/canvas.node
make: Leaving directory '/home/pi/node_modules/canvas/build'
npm notice created a lockfile as package-lock.json. You should commit this file.
+ canvas@2.7.0
added 72 packages from 36 contributors and audited 72 packages in 64.116s
zbjornson commented 3 years ago

Glad you figured it out.

Those warnings can be ignored for now. I'll leave this open as a reminder to fix them sometime.