screeps / driver

ISC License
26 stars 36 forks source link

Missing STD <limits> Headers for GCC 11+ #47

Open jbethke opened 2 years ago

jbethke commented 2 years ago

The Problem

It appears that with GCC11 some headers with libstdc must be explicitly included. Namely, <limits>

Reference: Porting to GCC11 - Header Dependency Changes

Versions Replicated On

Steps to Replicate

npm init
npm i screeps

Resulting Output

npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated jquery.terminal@0.11.23: Scroll issue in Chrome fixed in version 1.0.5
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm ERR! code 1
npm ERR! path /mnt/kube-storage/Screeps/node_modules/@screeps/driver
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild -C native && webpack
npm ERR! make: Entering directory '/mnt/kube-storage/Screeps/node_modules/@screeps/driver/native/build'
npm ERR!   CXX(target) Release/obj.target/native/src/main.o
npm ERR! make: Leaving directory '/mnt/kube-storage/Screeps/node_modules/@screeps/driver/native/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.13.0 | linux | x64
npm ERR! gyp info chdir native
npm ERR! (node:3226283) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn /usr/bin/python2
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/mnt/kube-storage/Screeps/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/mnt/kube-storage/Screeps/node_modules/@screeps/driver/native/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/mnt/kube-storage/Screeps/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/root/.node-gyp/16.13.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/16.13.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/mnt/kube-storage/Screeps/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.node-gyp/16.13.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/mnt/kube-storage/Screeps/node_modules/@screeps/driver/native',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/main.cc:5:
npm ERR! ../src/pf.h:16:28: error: ‘numeric_limits’ is not a member of ‘std’
npm ERR!    16 |         static_assert(std::numeric_limits<pos_index_t>::max() > 2500 * k_max_rooms, "pos_index_t is too small");
npm ERR!       |                            ^~~~~~~~~~~~~~
npm ERR! ../src/pf.h:16:54: error: expected primary-expression before ‘>’ token
npm ERR!    16 |         static_assert(std::numeric_limits<pos_index_t>::max() > 2500 * k_max_rooms, "pos_index_t is too small");
npm ERR!       |                                                      ^
npm ERR! ../src/pf.h:16:57: error: ‘::max’ has not been declared; did you mean ‘std::max’?
npm ERR!    16 |         static_assert(std::numeric_limits<pos_index_t>::max() > 2500 * k_max_rooms, "pos_index_t is too small");
npm ERR!       |                                                         ^~~
npm ERR!       |                                                         std::max
npm ERR! In file included from /usr/include/c++/11/algorithm:62,
npm ERR!                  from ../../../../nan/nan.h:61,
npm ERR!                  from ../src/main.cc:2:
npm ERR! /usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
npm ERR!  3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
npm ERR!       |     ^~~
npm ERR! In file included from ../src/main.cc:5:
npm ERR! ../src/pf.h: In member function ‘void screeps::open_closed_t<capacity>::clear()’:
npm ERR! ../src/pf.h:186:42: error: ‘numeric_limits’ is not a member of ‘std’
npm ERR!   186 |                                 if (std::numeric_limits<marker_t>::max() - 2 <= marker) {
npm ERR!       |                                          ^~~~~~~~~~~~~~
npm ERR! ../src/pf.h:186:65: error: expected primary-expression before ‘>’ token
npm ERR!   186 |                                 if (std::numeric_limits<marker_t>::max() - 2 <= marker) {
npm ERR!       |                                                                 ^
npm ERR! ../src/pf.h:186:68: error: ‘::max’ has not been declared; did you mean ‘std::max’?

npm ERR!   186 |                                 if (std::numeric_limits<marker_t>::max() - 2 <= marker) {
npm ERR!       |                                                                    ^~~
npm ERR!       |                                                                    std::max
npm ERR! In file included from /usr/include/c++/11/algorithm:62,
npm ERR!                  from ../../../../nan/nan.h:61,
npm ERR!                  from ../src/main.cc:2:
npm ERR! /usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
npm ERR!  3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
npm ERR!       |     ^~~
npm ERR! In file included from ../src/main.cc:5:
npm ERR! ../src/pf.h: At global scope:
npm ERR! ../src/pf.h:342:65: error: ‘numeric_limits’ is not a member of ‘std’
npm ERR!   342 |                         static constexpr cost_t obstacle = std::numeric_limits<cost_t>::max();
npm ERR!       |                                                                 ^~~~~~~~~~~~~~
npm ERR! ../src/pf.h:342:86: error: expected primary-expression before ‘>’ token
npm ERR!   342 |                         static constexpr cost_t obstacle = std::numeric_limits<cost_t>::max();
npm ERR!       |                                                                                      ^
npm ERR! ../src/pf.h:342:89: error: ‘::max’ has not been declared; did you mean ‘std::max’?
npm ERR!   342 |                         static constexpr cost_t obstacle = std::numeric_limits<cost_t>::max();
npm ERR!       |                                                                                         ^~~
npm ERR!       |                                                                                         std::max
npm ERR! In file included from /usr/include/c++/11/algorithm:62,
npm ERR!                  from ../../../../nan/nan.h:61,
npm ERR!                  from ../src/main.cc:2:
npm ERR! /usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
npm ERR!  3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
npm ERR!       |     ^~~
npm ERR! In file included from ../../../../nan/nan.h:58,
npm ERR!                  from ../src/main.cc:2:
npm ERR! /root/.node-gyp/16.13.0/include/node/node.h:821:7: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
npm ERR!   821 |       (node::addon_register_func) (regfunc),                          \
npm ERR!       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /root/.node-gyp/16.13.0/include/node/node.h:855:3: note: in expansion of macro ‘NODE_MODULE_X’
npm ERR!   855 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
npm ERR!       |   ^~~~~~~~~~~~~
npm ERR! ../src/main.cc:63:1: note: in expansion of macro ‘NODE_MODULE’
npm ERR!    63 | NODE_MODULE(native, init);
npm ERR!       | ^~~~~~~~~~~
npm ERR! make: *** [native.target.mk:209: Release/obj.target/native/src/main.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/mnt/kube-storage/Screeps/node_modules/node-gyp/lib/build.js:262:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Linux 5.15.6-200.fc35.x86_64
npm ERR! gyp ERR! command "/usr/bin/node" "/mnt/kube-storage/Screeps/node_modules/.bin/node-gyp" "rebuild" "-C" "native"
npm ERR! gyp ERR! cwd /mnt/kube-storage/Screeps/node_modules/@screeps/driver/native
npm ERR! gyp ERR! node -v v16.13.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-01-19T01_56_46_657Z-debug.log
KrykiZZ commented 2 years ago

Hi. I stuck with the same problem. Did you fixed that and how?