On Tue, Nov 5, 2013 at 5:56 AM, <[email protected]> wrote:
> Hi,
>
> I'm trying to install the Fibers (https://npmjs.org/package/fibers) Node
> module on OpenBSD but it seems to be failing. I contacted the author and he
> told me to check the bindings.gyp file:
>
> Anything here OpenBSD might react to?
>
> % cat .npm/fibers/1.0.1/package/binding.gyp
> {
> 'target_defaults': {
> 'default_configuration': 'Release',
> 'configurations': {
> 'Release': {
> 'cflags': [ '-O3' ],
> 'xcode_settings': {
> 'GCC_OPTIMIZATION_LEVEL': '3',
> 'GCC_GENERATE_DEBUGGING_SYMBOLS':
> 'NO',
> },
> 'msvs_settings': {
> 'VCCLCompilerTool': {
> 'Optimization': 3,
> 'FavorSizeOrSpeed': 1,
> },
> },
> }
> },
> },
> 'targets': [
> {
> 'target_name': 'fibers',
> 'sources': [
> 'src/fibers.cc',
> 'src/coroutine.cc',
> 'src/libcoro/coro.c',
> # Rebuild on header changes
> 'src/coroutine.h',
> 'src/libcoro/coro.h',
> ],
> 'cflags!': ['-ansi'],
> 'conditions': [
> ['OS == "win"',
> {'defines': ['CORO_FIBER',
> 'WINDOWS']},
> # else
> {
> 'defines': ['USE_CORO',
> 'CORO_GUARDPAGES=1'],
> 'ldflags': ['-pthread'],
> }
> ],
> ['OS == "linux" or OS == "solaris" or OS ==
> "sunos" or OS == "freebsd"', {'defines': ['CORO_UCONTEXT']}],
> ['OS == "mac"', {'defines': ['CORO_SJLJ']}],
> ['OS == "openbsd"', {'defines':
> ['CORO_ASM']}],
> ['target_arch == "arm"',
> {
> # There's been problems
> getting real fibers working on arm
> 'defines': ['CORO_PTHREAD'],
> 'defines!': ['CORO_UCONTEXT',
> 'CORO_SJLJ', 'CORO_ASM'],
> },
> ],
> ],
> },
> ],
> }
>
> Here is the build error itself:
>
> % npm install fibers
> npm http GET https://registry.npmjs.org/fibers
> npm http 304 https://registry.npmjs.org/fibers
>
>> [email protected] install /home/opendaddy/myapp/node_modules/fibers
>> node ./build.js
>
> gmake: Entering directory `/home/opendaddy/myapp/node_modules/fibers/build'
> g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSE_CORO'
> '-DCORO_GUARDPAGES=1' '-DCORO_UCONTEXT' '-DBUILDING_NODE_EXTENSION'
> -I/home/opendaddy/.node-gyp/0.8.18/src
> -I/home/opendaddy/.node-gyp/0.8.18/deps/uv/include
> -I/home/opendaddy/.node-gyp/0.8.18/deps/v8/include -I/usr/include -fPIC
> -Wall -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink
> -fno-rtti -fno-exceptions -MMD -MF
> ./Release/.deps/Release/obj.target/fibers/src/fibers.o.d.raw -c -o
> Release/obj.target/fibers/src/fibers.o ../src/fibers.cc
> In file included from ../src/coroutine.h:4,
> from ../src/fibers.cc:1:
> ../src/libcoro/coro.h:321:23: warning: ucontext.h: No such file or directory
> g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DUSE_CORO'
> '-DCORO_GUARDPAGES=1' '-DCORO_UCONTEXT' '-DBUILDING_NODE_EXTENSION'
> -I/home/opendaddy/.node-gyp/0.8.18/src
> -I/home/opendaddy/.node-gyp/0.8.18/deps/uv/include
> -I/home/opendaddy/.node-gyp/0.8.18/deps/v8/include -I/usr/include -fPIC
> -Wall -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink
> -fno-rtti -fno-exceptions -MMD -MF
> ./Release/.deps/Release/obj.target/fibers/src/coroutine.o.d.raw -c -o
> Release/obj.target/fibers/src/coroutine.o ../src/coroutine.cc
> In file included from ../src/coroutine.h:4,
> from ../src/coroutine.cc:1:
> ../src/libcoro/coro.h:321:23: warning: ucontext.h: No such file or directory
> ../src/coroutine.cc: In member function 'void
> Coroutine::transfer(Coroutine&)':
> ../src/coroutine.cc:152: error: 'swapcontext' was not declared in this scope
> gmake: *** [Release/obj.target/fibers/src/coroutine.o] Error 1
> gmake: Leaving directory `/home/opendaddy/myapp/node_modules/fibers/build'
> gyp ERR! build error
> gyp ERR! stack Error: `gmake` failed with exit code: 2
> gyp ERR! stack at ChildProcess.onExit
> (/usr/local/lib/node_modules/node-gyp/lib/build.js:257:23)
> gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:99:17)
> gyp ERR! stack at Process.ChildProcess._handle.onexit
> (child_process.js:678:10)
> gyp ERR! System OpenBSD 5.3
> gyp ERR! command "node"
> "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"
> "rebuild"
> gyp ERR! cwd /home/opendaddy/myapp/node_modules/fibers
> gyp ERR! node -v v0.8.18
> gyp ERR! node-gyp -v v0.8.2
> gyp ERR! not ok
> Build failed
> npm ERR! [email protected] install: `node ./build.js`
> npm ERR! `sh "-c" "node ./build.js"` failed with 1
> npm ERR!
> npm ERR! Failed at the [email protected] install script.
> npm ERR! This is most likely a problem with the fibers package,
> npm ERR! not with npm itself.
> npm ERR! Tell the author that this fails on your system:
> npm ERR! node ./build.js
> npm ERR! You can get their info via:
> npm ERR! npm owner ls fibers
> npm ERR! There is likely additional logging output above.
>
> npm ERR! System OpenBSD 5.3
> npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "fibers"
> npm ERR! cwd /home/opendaddy/myapp
> npm ERR! node -v v0.8.18
> npm ERR! npm -v 1.2.2
> npm ERR! code ELIFECYCLE
> npm ERR!
> npm ERR! Additional logging details can be found in:
> npm ERR! /home/opendaddy/myapp/npm-debug.log
> npm ERR! not ok code 0
>
> Thanks.
>
> O.D.
>
-- re sending to list --
The problem is because node's gyp was not taught (my bad - I fixed it
for next release)
what OpenBSD boxes are.
To fix it - simply `pkg_add gyp` (obviously you will need to have
PKG_PATH set). Once gyp
is installed the "['OS == "openbsd"', {'defines': ['CORO_ASM']}],"
line will actually be
picked up.