nodejs / node-chakracore

Node.js on ChakraCore :sparkles::turtle::rocket::sparkles:
Other
1.92k stars 342 forks source link

Build fails, "error: ‘vector’ in namespace ‘std’ does not name a template type" etc #626

Closed ghost closed 4 years ago

ghost commented 4 years ago

I tried to build node-chakracore how the README says:

apt-get install -y build-essential cmake clang libicu-dev
git clone https://github.com/nodejs/node-chakracore
cd node-chakracore
git checkout master
./configure
make

(commit hash is f0b74bf63d08b46b2fa07b62dc3e3e205a0c1e46)

But it encountered some errors image

In file included from ../src/util-inl.h:28:0,
                 from ../src/aliased_buffer.h:8,
                 from ../src/env-inl.h:27,
                 from ../src/bootstrapper.cc:2:
../src/util.h:477:55: error: ‘vector’ in namespace ‘std’ does not name a template type
                                            const std::vector<T>& vec);
                                                       ^~~~~~
../src/util.h:477:61: error: expected ‘,’ or ‘...’ before ‘<’ token
                                            const std::vector<T>& vec);
                                                             ^
In file included from ../src/aliased_buffer.h:8:0,
                 from ../src/env-inl.h:27,
                 from ../src/bootstrapper.cc:2:
../src/util-inl.h:396:48: error: ‘vector’ in namespace ‘std’ does not name a template type
                                     const std::vector<T>& vec) {
                                                ^~~~~~
../src/util-inl.h:396:54: error: expected ‘,’ or ‘...’ before ‘<’ token
                                     const std::vector<T>& vec) {
                                                      ^
../src/util-inl.h: In function ‘v8::MaybeLocal<v8::Value> node::ToV8Value(v8::Local<v8::Context>, int)’:
../src/util-inl.h:400:54: error: ‘vec’ was not declared in this scope
   v8::Local<v8::Array> arr = v8::Array::New(isolate, vec.size());
                                                      ^~~
../src/util-inl.h:400:54: note: suggested alternative: ‘getc’
   v8::Local<v8::Array> arr = v8::Array::New(isolate, vec.size());
                                                      ^~~
                                                      getc
node_lib.target.mk:332: recipe for target '/root/Desktop/node-chakracore/out/Release/obj.target/node_lib/src/bootstrapper.o' failed
make[1]: *** [/root/Desktop/node-chakracore/out/Release/obj.target/node_lib/src/bootstrapper.o] Error 1
rm de9574d848889dd7f2c1daede83104638734ed0f.intermediate
Makefile:99: recipe for target 'node' failed
make: *** [node] Error 2
joaocgreis commented 4 years ago

@ledlamp the master branch is not in good shape at the moment. If you want to build from source, the release tags should work, for the latest one replace the checkout line with

git checkout node-chakracore-v10.13.0
ghost commented 4 years ago

Ok I cloned a new copy with git clone https://github.com/nodejs/node-chakracore -b node-chakracore-v10.13.0 --depth=1 and it compiled, thanks! Unfortunately building from source didn't make it work on my CPU, but that's a separate issue.