1

我使用 Mac OSX 10.8.2。我已经通过 Homebrew 安装了 Boost 1.52.0 brew install boost,.

#include <node.h>
#include <v8.h>
#include <boost/geometry.hpp>

using namespace v8;

Handle<Value> Method(const Arguments& args) {
    HandleScope scope;

    return scope.Close(String::New("ok"));
}

void init(Handle<Object> target) {
    target->Set(String::NewSymbol("method"), FunctionTemplate::New(Method)->GetFunction());
}
NODE_MODULE(method, init);

尝试通过 构建这个简单的 NodeJS 插件时node-gyp build,出现以下错误:

gyp info it worked if it ends with ok
gyp info using node-gyp@0.8.3
gyp info using node@0.8.18 | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/method/method.o
In file included from ../method.cc:3:
In file included from /usr/local/include/boost/geometry.hpp:17:
In file included from /usr/local/include/boost/geometry/geometry.hpp:75:
In file included from /usr/local/include/boost/geometry/multi/multi.hpp:74:
In file included from /usr/local/include/boost/geometry/multi/io/wkt/wkt.hpp:17:
In file included from /usr/local/include/boost/geometry/multi/io/wkt/read.hpp:23:
/usr/local/include/boost/geometry/io/wkt/read.hpp:123:38: error: use of undeclared identifier 'blc'
            throw read_wkt_exception(blc.what(), it, end, wkt);
                                     ^
/usr/local/include/boost/geometry/io/wkt/read.hpp:127:38: error: use of undeclared identifier 'e'
            throw read_wkt_exception(e.what(), it, end, wkt);
                                     ^
2 errors generated.
make: *** [Release/obj.target/method/method.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/node-gyp/lib/build.js:255:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack     at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Darwin 12.2.1
gyp ERR! command "node" "/usr/local/bin/node-gyp" "build"
gyp ERR! cwd /Users/alexandre/Projets/test
gyp ERR! node -v v0.8.18
gyp ERR! node-gyp -v v0.8.3
gyp ERR! not ok 

错误来源:

        catch(boost::bad_lexical_cast const& blc)
        {
            throw read_wkt_exception(blc.what(), it, end, wkt);
        }
        catch(std::exception const& e)
        {
            throw read_wkt_exception(e.what(), it, end, wkt);
        }

...这与错误相矛盾。我的设置有什么问题?

4

0 回答 0