I'm trying to compile libraw as a dependency for my node.js project.
I have two different .gyp files: ./binding.gyp
and ./vendor/raw.gyp
I have downloaded the current version of libraw and the demosaicing packs, all of them can be found on the ./vendor/
folder as:
LibRaw-0.17.1
LibRaw-demosaic-pack-GPL2-0.17.1
LibRaw-demosaic-pack-GPL3-0.17.1
Here are my two gyp files:
./binding.gyp
{
"includes": [ "vendor/raw.gyp" ],
"targets": [
{
"target_name": "node_libraw",
"sources": [ "node_libraw.cc" ],
"include_dirs" : [
"build/Release",
"vendor/LibRaw-0.17.1",
"<!(node -e \"require('nan')\")"
],
"libraries": [
"-lraw",
"-Wl,-rpath=./build/Release/obj.target/"
]
}
],
}
./vendor/raw.gyp
{
"targets": [
{
"default_configuration": "Release",
"target_name": "raw",
"type": "static_library",
"sources": [
"LibRaw-0.17.1/internal/dcraw_common.cpp",
"LibRaw-0.17.1/internal/dcraw_fileio.cpp",
"LibRaw-0.17.1/internal/demosaic_packs.cpp",
"LibRaw-0.17.1/src/libraw_cxx.cpp",
"LibRaw-0.17.1/src/libraw_datastream.cpp",
"LibRaw-0.17.1/src/libraw_c_api.cpp"
],
"include_dirs": [
"./LibRaw-demosaic-pack-GPL2-0.17.1",
"./LibRaw-demosaic-pack-GPL3-0.17.1",
"./LibRaw-0.17.1"
],
"libraries": [
"-ljpeg8"
],
"cflags": [
"-Wdeprecated-declarations",
"-pthread -w"
],
"cflags_cc": [
"-pthread -w",
"-fexceptions",
"-I./LibRaw-demosaic-pack-GPL2-0.17.1",
"-DLIBRAW_DEMOSAIC_PACK_GPL2",
"-I./LibRaw-demosaic-pack-GPL3-0.17.1",
"-DLIBRAW_DEMOSAIC_PACK_GPL3",
"-DUSE_JPEG8"
]
}
]
}
The problem being that, when I'm trying to compile the library with node-gyp configure build
I end up with the following error:
/usr/bin/ld: cannot find -lraw
collect2: error: ld returned 1 exit status
node_libraw.target.mk:124: recipe for target 'Release/obj.target/node_libraw.node' failed
Here is the full output:
$ node-gyp configure build
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn python2
gyp info spawn args [ '/usr/share/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/node-libraw/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/share/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/include/nodejs/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/usr/include/nodejs',
gyp info spawn args '-Dnode_gyp_dir=/usr/share/node-gyp',
gyp info spawn args '-Dnode_lib_file=node.lib',
gyp info spawn args '-Dmodule_root_dir=/node-libraw',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/node-libraw/build'
CXX(target) Release/obj.target/node_libraw/node_libraw.o
In file included from ../vendor/LibRaw-0.17.1/libraw/libraw.h:40:0,
from ../node_libraw.cc:6:
../vendor/LibRaw-0.17.1/libraw/libraw_datastream.h:96:10: warning: ‘template<class> class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
std::auto_ptr<std::streambuf> f; /* will close() automatically through dtor */
^
In file included from /usr/include/c++/5/memory:81:0,
from ../vendor/LibRaw-0.17.1/libraw/libraw_datastream.h:38,
from ../vendor/LibRaw-0.17.1/libraw/libraw.h:40,
from ../node_libraw.cc:6:
/usr/include/c++/5/bits/unique_ptr.h:49:28: note: declared here
template<typename> class auto_ptr;
^
In file included from ../vendor/LibRaw-0.17.1/libraw/libraw.h:40:0,
from ../node_libraw.cc:6:
../vendor/LibRaw-0.17.1/libraw/libraw_datastream.h:97:10: warning: ‘template<class> class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
std::auto_ptr<std::streambuf> saved_f; /* when *f is a subfile, *saved_f is the
^
In file included from /usr/include/c++/5/memory:81:0,
from ../vendor/LibRaw-0.17.1/libraw/libraw_datastream.h:38,
from ../vendor/LibRaw-0.17.1/libraw/libraw.h:40,
from ../node_libraw.cc:6:
/usr/include/c++/5/bits/unique_ptr.h:49:28: note: declared here
template<typename> class auto_ptr;
^
SOLINK_MODULE(target) Release/obj.target/node_libraw.node
/usr/bin/ld: cannot find -lraw
collect2: error: ld returned 1 exit status
node_libraw.target.mk:124: recipe for target 'Release/obj.target/node_libraw.node' failed
make: *** [Release/obj.target/node_libraw.node] Error 1
make: Leaving directory '/node-libraw/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:269:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.3.0-6-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "configure" "build"
gyp ERR! cwd /node-libraw
gyp ERR! node -v v4.2.4
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
And the url of the project: https://github.com/m0g/node-libraw/tree/batteries
Thanks