to_string不是std的成员,所以g ++ termux

时间:2016-07-23 17:08:11

标签: android node.js g++ protocol-buffers

我需要在nodejs node-protobuf上安装,但如果我安装此数据包,我会看到错误。 在Android上使用Termux。 apt list安装:

$ apt list —installed
Listing... Done
apt/stable,now 1.2.12 aarch64 [installed]
bash/stable,now 4.3.46 aarch64 [installed]
binutils/stable,now 2.26.1 aarch64 [installed,automatic]
busybox/stable,now 1.24.2-5 aarch64 [installed]
bzip2/stable,now 1.0.6 aarch64 [installed,automatic]
c-ares/stable,now 1.11.0 aarch64 [installed,automatic]
ca-certificates/stable,now 20160429 all [installed,automatic]
command-not-found/stable,now 1.11 aarch64 [installed]
coreutils/stable,now 8.25-4 aarch64 [installed]
curl/stable,now 7.50.0 aarch64 [installed]
dash/stable,now 0.5.9 aarch64 [installed]
dpkg/stable,now 1.18.7 aarch64 [installed]
g++/stable,now 6.1.0-2 aarch64 [installed]
gcc/stable,now 6.1.0-2 aarch64 [installed,automatic]
gdb/stable,now 7.11.1 aarch64 [installed]
gdbm/stable,now 1.12 aarch64 [installed,automatic]
git/stable,now 2.9.2 aarch64 [installed]
glib/stable,now 2.48.1 aarch64 [installed,automatic]
glib-bin/stable,now 2.48.1 aarch64 [installed]
gnupg/stable,now 1.4.20-2 aarch64 [installed]
ldns/stable,now 1.6.17 aarch64 [installed,automatic]
less/stable,now 481 aarch64 [installed,automatic]
libandroid-glob/stable,now 0.3 aarch64 [installed]
libandroid-glob-dev/stable,now 0.3 aarch64 [installed]
libandroid-support/stable,now 12.9 aarch64 [installed]
libandroid-support-dev/stable,now 12.9 aarch64 [installed,automatic]
libbz2/stable,now 1.0.6 aarch64 [installed,automatic]
libcrypt/stable,now 0.2 aarch64 [installed,automatic]
libcurl/stable,now 7.50.0 aarch64 [installed,automatic]
libexpat/stable,now 2.1.1 aarch64 [installed,automatic]
libffi/stable,now 3.2.1-1 aarch64 [installed,automatic]
libgcc/stable,now 4.9 aarch64 [installed,automatic]
libgmp/stable,now 6.1.0-1 aarch64 [installed,automatic]
libgnustl/stable,now 12-4 aarch64 [installed]
libisl/stable,now 0.16.1 aarch64 [installed,automatic]
liblzma/stable,now 5.2.2 aarch64 [installed]
libmpc/stable,now 1.0.3-1 aarch64 [installed,automatic]
libmpfr/stable,now 3.1.4 aarch64 [installed,automatic]
libsqlite/stable,now 3.13.0 aarch64 [installed,automatic]
libutil/stable,now 0.2 aarch64 [installed,automatic]
libuuid/stable,now 1.0.3 aarch64 [installed,automatic]
libuv/stable,now 1.9.1 aarch64 [installed,automatic]
make/stable,now 4.2.1 aarch64 [installed]
mc/stable,now 4.8.17 aarch64 [installed]
nano/stable,now 2.6.1 aarch64 [installed]
ncurses/stable,now 6.0.20160423 aarch64 [installed]
ncurses-ui-libs/stable,now 6.0.20160423 aarch64 [installed,automatic]
ndk-stl/stable,now 12 aarch64 [installed,automatic]
ndk-sysroot/stable,now 12-2 aarch64 [installed,automatic]
nodejs/stable,now 6.3.0 aarch64 [installed]
nodejs-dev/stable,now 6.3.0 aarch64 [installed]
openssh/stable,now 7.2p2-7 aarch64 [installed]
openssl/stable,now 1.0.2h-1 aarch64 [installed,automatic]
pcre/stable,now 8.39 aarch64 [installed,automatic]
pkg-config/stable,now 0.29.1-1 aarch64 [installed]
protobuf/stable,now 2.6.1-1 aarch64 [installed]
protobuf-dev/stable,now 2.6.1-1 aarch64 [installed]
python/stable,now 3.5.2-1 aarch64 [installed]
python2/stable,now 2.7.12-1 aarch64 [installed]
readline/stable,now 6.3.8 aarch64 [installed]
tar/stable,now 1.29 aarch64 [installed]
termux-tools/stable,now 0.28 all [installed]
unrar/stable,now 5.3.2 aarch64 [installed]
unzip/stable,now 6.0-1 aarch64 [installed]
wget/stable,now 1.18 aarch64 [installed]
zip/stable,now 3.0 aarch64 [installed]

代码错误:

$ node —version
v6.3.0
$ npm —version
3.10.3
$ g++ —version
g++ (GCC) 6.1.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ npm install node-protobuf

> node-protobuf@1.3.2 install /data/data/com.termux/files/home/test/node_modules/node-protobuf
> node-gyp rebuild

make: Entering directory '/data/data/com.termux/files/home/test/node_modules/node-protobuf/build'
CXX(target) Release/obj.target/protobuf/src/init.o
CXX(target) Release/obj.target/protobuf/src/native.o
CXX(target) Release/obj.target/protobuf/src/parse.o
../src/parse.cpp: In function 'v8::Local<v8::Value> ParseField(v8::Isolate*, const google::protobuf::Message&, const google::protobuf::Reflection*, const google::protobuf::FieldDescriptor*, int, bool)':
../src/parse.cpp:58:28: error: 'to_string' is not a member of 'std'
v = Nan::New<String>(std::to_string(value).c_str()).ToLocalChecked();
^~~
../src/parse.cpp:81:28: error: 'to_string' is not a member of 'std'
v = Nan::New<String>(std::to_string(value).c_str()).ToLocalChecked();
^~~
make: *** [protobuf.target.mk:123: Release/obj.target/protobuf/src/parse.o] Error 1
make: Leaving directory '/data/data/com.termux/files/home/test/node_modules/node-protobuf/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Linux 3.10.61+
gyp ERR! command "/data/data/com.termux/files/usr/bin/node" "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /data/data/com.termux/files/home/test/node_modules/node-protobuf
gyp ERR! node -v v6.3.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/data/data/com.termux/files/home/test/package.json'
npm WARN test No description
npm WARN test No repository field.
npm WARN test No README data
npm WARN test No license field.
npm ERR! Linux 3.10.61+
npm ERR! argv "/data/data/com.termux/files/usr/bin/node" "/data/data/com.termux/files/usr/bin/npm" "install" "node-protobuf"
npm ERR! node v6.3.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! node-protobuf@1.3.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-protobuf@1.3.2 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-protobuf package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-protobuf
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls node-p...

在设备上设置root。 我如何在我的Android设备上安装这个数据包(node-protobuf)?

1 个答案:

答案 0 :(得分:0)

这是Termux继承的a bug in the Android NDK - 计划在即将到来的NDK r13更新中修复。