lwille / node-gphoto2

A Node.js wrapper for libgphoto2
MIT License
298 stars 91 forks source link

Mac OS X issues during install #83

Closed javsmo closed 8 years ago

javsmo commented 8 years ago

I just installed node-gphoto2 on a Raspberry Pi without any problem and it works fine. I'd like to install it on my Mac (OS X 10.11.5) to develop something locally before putting on the Raspberry Pi, but I'm facing a lot of problems.

I installed everything using Homebrew and I think I have all dependencies installed.

$ node -v
v6.2.0

$ npm -v
3.8.9

$ gphoto2 -v
gphoto2 2.5.10

Copyright (c) 2000-2016 Lutz Mueller and others

gphoto2 comes with NO WARRANTY, to the extent permitted by law. You may
redistribute copies of gphoto2 under the terms of the GNU General Public
License. For more information about these matters, see the files named COPYING.

This version of gphoto2 is using the following software versions and options:
gphoto2         2.5.10         clang, popt(m), no exif, no cdk, no aa, jpeg, readline
libgphoto2      2.5.10         all camlibs, clang, ltdl, no EXIF
libgphoto2_port 0.12.0         clang, ltdl, USB, serial without locking

$ cc -v
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ pkg-config --version
0.29.1

$ brew list libgphoto2
/usr/local/Cellar/libgphoto2/2.5.10/bin/gphoto2-config
/usr/local/Cellar/libgphoto2/2.5.10/bin/gphoto2-port-config
/usr/local/Cellar/libgphoto2/2.5.10/include/gphoto2/ (18 files)
/usr/local/Cellar/libgphoto2/2.5.10/lib/libgphoto2.6.dylib
/usr/local/Cellar/libgphoto2/2.5.10/lib/libgphoto2_port.12.dylib
/usr/local/Cellar/libgphoto2/2.5.10/lib/libgphoto2/ (65 files)
/usr/local/Cellar/libgphoto2/2.5.10/lib/libgphoto2_port/ (7 files)
/usr/local/Cellar/libgphoto2/2.5.10/lib/pkgconfig/ (2 files)
/usr/local/Cellar/libgphoto2/2.5.10/lib/udev/check-ptp-camera
/usr/local/Cellar/libgphoto2/2.5.10/lib/ (2 other files)
/usr/local/Cellar/libgphoto2/2.5.10/share/doc/ (54 files)
/usr/local/Cellar/libgphoto2/2.5.10/share/libgphoto2/ (6 files)
/usr/local/Cellar/libgphoto2/2.5.10/share/libgphoto2_port/0.12.0/vcamera/README.txt
/usr/local/Cellar/libgphoto2/2.5.10/share/man/ (2 files)

At first the install was failing to find the libgphoto2 and I used a workaround from another issue posted here to solve this issue using he line below:

$sudo ln -s /usr/local /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/local

After this step, it was able to find the libgphoto2, but it gives me a lot of compilation errors and stop.

Here are the errors it gives me now.

$ npm install gphoto2

> gphoto2@0.1.7 preinstall /Users/javsmo/node_modules/.staging/gphoto2-136f54b2
> ((which pkg-config && pkg-config libgphoto2) || (which dpkg && dpkg -s libgphoto2-2-dev) || (which brew && brew list libgphoto2) || (echo 'ERROR: libgphoto2 seems not to be installed.' 1>&2; exit 1)) && node-gyp rebuild

/usr/local/bin/pkg-config
  CXX(target) Release/obj.target/gphoto2/src/autodetect.o
In file included from ../src/autodetect.cc:6:
In file included from ../src/binding.h:17:
In file included from ../src/cvv8/v8-convert.hpp:101:
In file included from ../src/cvv8/convert.hpp:4:
In file included from ../src/cvv8/detail/convert_core.hpp:30:
../src/cvv8/detail/signature_core.hpp:194:38: error: no member named 'Arguments' in namespace 'v8'
                    && (0==Index<v8::Arguments const &,SigT>::Value))
                                 ~~~~^
../src/cvv8/detail/signature_core.hpp:268:36: error: expected ')'
struct Signature<RV (v8::Arguments const &)>
                                   ^
../src/cvv8/detail/signature_core.hpp:268:21: note: to match this '('
struct Signature<RV (v8::Arguments const &)>
                    ^
../src/cvv8/detail/signature_core.hpp:268:26: error: no member named 'Arguments' in namespace 'v8'
struct Signature<RV (v8::Arguments const &)>
                     ~~~~^
../src/cvv8/detail/signature_core.hpp:278:23: error: expected expression
struct Signature<RV (*)(v8::Arguments const &)> : Signature<RV (v8::Arguments const &)>
                      ^
../src/cvv8/detail/signature_core.hpp:278:29: error: no member named 'Arguments' in namespace 'v8'
struct Signature<RV (*)(v8::Arguments const &)> : Signature<RV (v8::Arguments const &)>
                        ~~~~^
../src/cvv8/detail/signature_core.hpp:282:25: error: expected unqualified-id
struct Signature<RV (T::*)(v8::Arguments const &)> : Signature<RV (v8::Arguments const &)>
                        ^
../src/cvv8/detail/signature_core.hpp:282:26: error: expected expression
struct Signature<RV (T::*)(v8::Arguments const &)> : Signature<RV (v8::Arguments const &)>
                         ^
../src/cvv8/detail/signature_core.hpp:282:32: error: no member named 'Arguments' in namespace 'v8'
struct Signature<RV (T::*)(v8::Arguments const &)> : Signature<RV (v8::Arguments const &)>
                           ~~~~^
../src/cvv8/detail/signature_core.hpp:290:25: error: expected unqualified-id
struct Signature<RV (T::*)(v8::Arguments const &) const> : Signature<RV (v8::Arguments const &)>
                        ^
../src/cvv8/detail/signature_core.hpp:290:26: error: expected expression
struct Signature<RV (T::*)(v8::Arguments const &) const> : Signature<RV (v8::Arguments const &)>
                         ^
../src/cvv8/detail/signature_core.hpp:290:32: error: no member named 'Arguments' in namespace 'v8'
struct Signature<RV (T::*)(v8::Arguments const &) const> : Signature<RV (v8::Arguments const &)>
                           ~~~~^
In file included from ../src/autodetect.cc:6:
In file included from ../src/binding.h:17:
In file included from ../src/cvv8/v8-convert.hpp:101:
In file included from ../src/cvv8/convert.hpp:4:
../src/cvv8/detail/convert_core.hpp:294:66: error: too few arguments to function call, expected 2, have 1
                return v8::Integer::New( static_cast<int32_t>(v) );
                       ~~~~~~~~~~~~~~~~                          ^
/Users/javsmo/.node-gyp/6.2.0/include/node/v8.h:2547:3: note: 'New' declared here
  static Local<Integer> New(Isolate* isolate, int32_t value);
  ^
In file included from ../src/autodetect.cc:6:
In file included from ../src/binding.h:17:
In file included from ../src/cvv8/v8-convert.hpp:101:
In file included from ../src/cvv8/convert.hpp:4:
../src/cvv8/detail/convert_core.hpp:306:79: error: too few arguments to function call, expected 2, have 1
                return v8::Integer::NewFromUnsigned( static_cast<uint32_t>(v) );
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~                           ^
/Users/javsmo/.node-gyp/6.2.0/include/node/v8.h:2548:3: note: 'NewFromUnsigned' declared here
  static Local<Integer> NewFromUnsigned(Isolate* isolate, uint32_t value);
  ^
In file included from ../src/autodetect.cc:6:
In file included from ../src/binding.h:17:
In file included from ../src/cvv8/v8-convert.hpp:101:
In file included from ../src/cvv8/convert.hpp:4:
../src/cvv8/detail/convert_core.hpp:335:64: error: too few arguments to function call, expected 2, have 1
                return v8::Number::New( static_cast<double>(v) );
                       ~~~~~~~~~~~~~~~                         ^
/Users/javsmo/.node-gyp/6.2.0/include/node/v8.h:2534:3: note: 'New' declared here
  static Local<Number> New(Isolate* isolate, double value);
  ^
In file included from ../src/autodetect.cc:6:
In file included from ../src/binding.h:17:
In file included from ../src/cvv8/v8-convert.hpp:101:
In file included from ../src/cvv8/convert.hpp:4:
../src/cvv8/detail/convert_core.hpp:352:39: error: too few arguments to function call, expected 2, have 1
            return v8::Number::New( v );
                   ~~~~~~~~~~~~~~~    ^
/Users/javsmo/.node-gyp/6.2.0/include/node/v8.h:2534:3: note: 'New' declared here
  static Local<Number> New(Isolate* isolate, double value);
  ^
In file included from ../src/autodetect.cc:6:
In file included from ../src/binding.h:17:
In file included from ../src/cvv8/v8-convert.hpp:101:
In file included from ../src/cvv8/convert.hpp:4:
../src/cvv8/detail/convert_core.hpp:361:40: error: too few arguments to function call, expected 2, have 1
            return v8::Boolean::New( v );
                   ~~~~~~~~~~~~~~~~    ^
/Users/javsmo/.node-gyp/6.2.0/include/node/v8.h:7796:1: note: 'New' declared here
Local<Boolean> Boolean::New(Isolate* isolate, bool value) {
^
In file included from ../src/autodetect.cc:6:
In file included from ../src/binding.h:17:
In file included from ../src/cvv8/v8-convert.hpp:101:
In file included from ../src/cvv8/convert.hpp:4:
../src/cvv8/detail/convert_core.hpp:376:12: error: redefinition of 'NativeToJS<Local<type-parameter-0-0> >'
    struct NativeToJS< ::v8::Local<T> >
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/cvv8/detail/convert_core.hpp:366:12: note: previous definition is here
    struct NativeToJS< ::v8::Handle<T> >
           ^
../src/cvv8/detail/convert_core.hpp:396:30: error: no member named 'InvocationCallback' in namespace 'v8'
    struct NativeToJS< ::v8::InvocationCallback >
                       ~~~~~~^
../src/cvv8/detail/convert_core.hpp:412:32: error: no member named 'New' in 'v8::String'
            return cstr ? v8::String::New( cstr, static_cast<int>( v.size() ) ) : v8::String::New("",0);
                          ~~~~~~~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/gphoto2/src/autodetect.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:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Darwin 15.5.0
gyp ERR! command "/usr/local/Cellar/node/6.2.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/javsmo/node_modules/.staging/gphoto2-136f54b2
gyp ERR! node -v v6.2.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 
/Users/javsmo
├── express@4.13.4 
└── superagent@2.0.0-alpha.3 

npm WARN enoent ENOENT: no such file or directory, open '/Users/javsmo/package.json'
npm WARN javsmo No description
npm WARN javsmo No repository field.
npm WARN javsmo No README data
npm WARN javsmo No license field.
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/Cellar/node/6.2.0/bin/node" "/usr/local/bin/npm" "install" "gphoto2"
npm ERR! node v6.2.0
npm ERR! npm  v3.8.9
npm ERR! code ELIFECYCLE

npm ERR! gphoto2@0.1.7 preinstall: `((which pkg-config && pkg-config libgphoto2) || (which dpkg && dpkg -s libgphoto2-2-dev) || (which brew && brew list libgphoto2) || (echo 'ERROR: libgphoto2 seems not to be installed.' 1>&2; exit 1)) && node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the gphoto2@0.1.7 preinstall script '((which pkg-config && pkg-config libgphoto2) || (which dpkg && dpkg -s libgphoto2-2-dev) || (which brew && brew list libgphoto2) || (echo 'ERROR: libgphoto2 seems not to be installed.' 1>&2; exit 1)) && node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the gphoto2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ((which pkg-config && pkg-config libgphoto2) || (which dpkg && dpkg -s libgphoto2-2-dev) || (which brew && brew list libgphoto2) || (echo 'ERROR: libgphoto2 seems not to be installed.' 1>&2; exit 1)) && node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs gphoto2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls gphoto2
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/javsmo/npm-debug.log

Is there anything I could do to fix the install on my Mac? I wouldn't like to develop using a VM or the Raspberry Pi.

Sija commented 8 years ago

Last working version of node is 0.10.xnvm install 0.10

javsmo commented 8 years ago

Thanks for this information. I wasn't aware of this version limitation. In the Raspberry Pi, I don't know why, but the installed version is 0.10.29. That's why it worked there.

Now I was able to install on my mac, but the example from the readme gives a malloc error right after printing the camera model console.log('Found', camera.model);:

Found Canon EOS 1200D node(35426,0x7000003b9000) malloc: * error for object 0x10070b5c0: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug

I don't see this problem on the Raspberry Pi.

javsmo commented 8 years ago

After removing all other node and npm versions, and reinstalling the 0.10 directly from homebrew, I was able to make the example work.

Here's what finally worked.

npm uninstall gphoto2
brew uninstall node
brew tap homebrew/versions
brew search node
brew install homebrew/versions/node010
npm install gphoto2