node.js プロジェクトの依存関係として libraw をコンパイルしようとしています。
2 つの異なる .gyp ファイルが./binding.gyp
あります。./vendor/raw.gyp
現在のバージョンの libraw とデモザイキング パックをダウンロードしました。それらはすべて次の./vendor/
フォルダにあります。
LibRaw-0.17.1
LibRaw-demosaic-pack-GPL2-0.17.1
LibRaw-demosaic-pack-GPL3-0.17.1
ここに私の2つのgypファイルがあります:
./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"
]
}
]
}
問題は、ライブラリをコンパイルしようとするnode-gyp configure build
と、次のエラーが発生することです。
/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
完全な出力は次のとおりです。
$ node-gyp configure build
gyp info it worked if it ends with ok
gyp info using node-gyp@3.0.3
gyp info using node@4.2.4 | 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
プロジェクトの URL: https://github.com/m0g/node-libraw/tree/batteries
ありがとう