lwille / node-gphoto2

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

Build Question. #63

Closed jaredmdobson closed 10 years ago

jaredmdobson commented 10 years ago

@lwille this project looks awesome and will definitely be a life saver!!! Thank you!!

I have run into this problem when trying to build or install this node package.

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/gphoto2/src/autodetect.o
../src/autodetect.cc:3:10: fatal error: 'gphoto2/gphoto2-camera.h' file not found
#include <gphoto2/gphoto2-camera.h>

I am learning about node-gyp and have found a simple solution(hack) to get this project to build by replacing:

'link_settings': {
        'libraries': [
          '-lgphoto2',
          '-lgphoto2_port'
        ]
      },

with:

'include_dirs': [
          '/usr/local/Cellar/libgphoto2/2.5.5/include/gphoto2/',
          '/usr/local/Cellar/libgphoto2/2.5.5/lib',
        ],
     'libraries': [
        '<!@(pkg-config libgphoto2 --libs)',
        '<!@(pkg-config libgphoto2_port --libs)',
      ],

So I am wondering what can I do to improve this project and get the build to work without my hack?

Here is the output of brew list libgphoto2:

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

Thanks for your help! :-)

lwille commented 10 years ago

It's definitely related to homebrew's include paths, but I can't see what's wrong in your case. Do you also have problems building other projects that depend on homebrewed libraries?

On Fri, Oct 31, 2014 at 7:43 PM, Jared Dobson notifications@github.com wrote:

@lwille this project looks awesome and will definitely be a life saver!!! Thank you!! I have run into this problem when trying to build or install this node package.

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/gphoto2/src/autodetect.o
../src/autodetect.cc:3:10: fatal error: 'gphoto2/gphoto2-camera.h' file not found
#include <gphoto2/gphoto2-camera.h>

I am learning about node-gyp and have found a simple solution(hack) to get this project to build by replacing:

'link_settings': {
        'libraries': [
          '-lgphoto2',
          '-lgphoto2_port'
        ]
      },

with:

'include_dirs': [
          '/usr/local/Cellar/libgphoto2/2.5.5/include/gphoto2/',
        ],

So I am wondering what can I do to improve this project and get the build to work without my hack?
Here is the output of brew list libgphoto2:

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

Thanks for your help! :-)

Reply to this email directly or view it on GitHub: https://github.com/lwille/node-gphoto2/issues/63

jaredmdobson commented 10 years ago

I don't have problems building other projects that depend on home-brew libraries, but I just decided to use gphoto2 exec instead, thanks for your help. :smile: