kaworu/node-quirc

Fails on installation

TheMachineHere opened this issue · 4 comments

Error/Warnings are thrown on installation
Stack below:

$ npm install node-quirc

node-quirc@1.0.0 install /Users/zunairsyed/Documents/googleGlassPoC/node_modules/node-quirc
node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

CC(target) Release/obj.target/quirc/deps/quirc/decode.o
../deps/quirc/decode.c:877:24: warning: comparison of integers of different
signs: 'int' and 'unsigned long' [-Wsign-compare]
if (data->payload_len >= sizeof(data->payload))
~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
CC(target) Release/obj.target/quirc/deps/quirc/identify.o
CC(target) Release/obj.target/quirc/deps/quirc/quirc.o
../deps/quirc/quirc.c:91:10: warning: comparison of unsigned enum expression >=
0 is always true [-Wtautological-compare]
if (err >= 0 && err < sizeof(error_table) / sizeof(error_table[0]))
~~~ ^ ~
../deps/quirc/quirc.c:91:22: warning: comparison of constant 8 with expression
of type 'quirc_decode_error_t' is always true
[-Wtautological-constant-out-of-range-compare]
if (err >= 0 && err < sizeof(error_table) / sizeof(error_table[0]))
~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
CC(target) Release/obj.target/quirc/deps/quirc/version_db.o
../deps/quirc/version_db.c:20:8: warning: missing field 'apat' initializer
[-Wmissing-field-initializers]
{0},
^
1 warning generated.
LIBTOOL-STATIC Release/libquirc.a
CC(target) Release/obj.target/node_quirc_decode/src/node_quirc_decode.o
../src/node_quirc_decode.c:9:10: fatal error: 'png.h' file not found
#include <png.h>
^~~~~~~
1 error generated.
make: *** [Release/obj.target/node_quirc_decode/src/node_quirc_decode.o] Error 1
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:258:23)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 17.0.0
gyp ERR! command "/usr/local/Cellar/node/8.4.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/zunairsyed/Documents/googleGlassPoC/node_modules/node-quirc
gyp ERR! node -v v8.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN googleglasspoc@1.0.0 No description
npm WARN googleglasspoc@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-quirc@1.0.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-quirc@1.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zunairsyed/.npm/_logs/2017-10-17T14_07_06_012Z-debug.log

Hi @TheMachineHere,

Thank you very much for this report.

I am aware of the warnings. If they were to be fixed, they should be addressed upstream (i.e. at https://github.com/dlbeer/quirc).

About the error, it's about libpng (or at least its header files) not being found. Could you check that you have libpng and its header files installed? In any case, I think the the documentation should be completed accordingly.

@TheMachineHere also, I would recommend trying it in Linux (Ubuntu) since you'll run into more issues with OSX.

Hi there,
I've been able to build the module and execute the example with macOSX High Sierra (10.13.1) today. I believe you would need to brew install libpng. I'll reproduce the build log below, notice the fmemopen(3) warning:

% npm install node-quirc
> node-quirc@1.0.0 install /Users/alex/tmp/node_modules/node-quirc
> node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

  CC(target) Release/obj.target/quirc/deps/quirc/decode.o
../deps/quirc/decode.c:877:24: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
        if (data->payload_len >= sizeof(data->payload))
            ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
  CC(target) Release/obj.target/quirc/deps/quirc/identify.o
  CC(target) Release/obj.target/quirc/deps/quirc/quirc.o
../deps/quirc/quirc.c:91:10: warning: comparison of unsigned enum expression >= 0 is always true [-Wtautological-compare]
        if (err >= 0 && err < sizeof(error_table) / sizeof(error_table[0]))
            ~~~ ^  ~
../deps/quirc/quirc.c:91:22: warning: comparison of constant 8 with expression of type 'quirc_decode_error_t' is always true
      [-Wtautological-constant-out-of-range-compare]
        if (err >= 0 && err < sizeof(error_table) / sizeof(error_table[0]))
                        ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
  CC(target) Release/obj.target/quirc/deps/quirc/version_db.o
../deps/quirc/version_db.c:20:8: warning: missing field 'apat' initializer [-Wmissing-field-initializers]
            {0},
              ^
1 warning generated.
  LIBTOOL-STATIC Release/libquirc.a
  CC(target) Release/obj.target/node_quirc_decode/src/node_quirc_decode.o
../src/node_quirc_decode.c:220:11: warning: 'fmemopen' is only available on macOS 10.13 or newer [-Wunguarded-availability-new]
        infile = fmemopen((uint8_t *)img, img_len, "r");
                 ^~~~~~~~
/usr/include/stdio.h:449:7: note: 'fmemopen' has been explicitly marked partial here
FILE *fmemopen(void * __restrict __buf, size_t __size, const char * __restrict __mode) __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0));
      ^
../src/node_quirc_decode.c:220:11: note: enclose 'fmemopen' in a __builtin_available check to silence this warning
        infile = fmemopen((uint8_t *)img, img_len, "r");
                 ^~~~~~~~
1 warning generated.
  LIBTOOL-STATIC Release/libnode_quirc_decode.a
  CXX(target) Release/obj.target/node-quirc/src/node-quirc.o
  SOLINK_MODULE(target) Release/node-quirc.node
npm WARN saveError ENOENT: no such file or directory, open '/Users/alex/tmp/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users/alex/tmp/package.json'
npm WARN tmp No description
npm WARN tmp No repository field.
npm WARN tmp No README data
npm WARN tmp No license field.

+ node-quirc@1.0.0
added 3 packages in 3.254s

I've updated the documentation accordingly.

If someone want to support this module for macos versions without fmemopen(3), i.e. before 10.13 according to the build log, the png decoding must be refactored (see http://pulsarengine.com/2009/01/reading-png-images-from-memory/). Sadly, I lack both the resource and access to macos < 10.13 but would welcome a PR.