Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Python 3 #48

Open
Jeroendevr opened this issue Feb 23, 2023 · 1 comment
Open

Update to Python 3 #48

Jeroendevr opened this issue Feb 23, 2023 · 1 comment

Comments

@Jeroendevr
Copy link

On the main page of the screeps server it states only Python 2 is supported. Meanwhile there have been some updates to node-gyp and now supports Python 3. From version 5.0.4 I believe.

I would like to add support for the newer node-gyp version. Installing node-gyp using Python 3.10.8 was succesfull.

However I am not completely familiar with the npm enviroment. So when testing the driver module this was the error message.

code 1
npm ERR! path /Users/hayer/driver/node_modules/isolated-vm
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild --release -j 4
npm ERR! CXX(target) Release/obj.target/nortti/src/external_copy_nortti.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.1
npm ERR! gyp info using node@14.21.1 | darwin | x64
npm ERR! gyp info find Python using Python version 3.10.8 found at "/Users/hayer/.pyenv/versions/3.10.8/bin/python3"
npm ERR! gyp info spawn /Users/hayer/.pyenv/versions/3.10.8/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/hayer/driver/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   '/Users/hayer/driver/node_modules/isolated-vm/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/hayer/driver/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/hayer/Library/Caches/node-gyp/14.21.1/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=/Users/hayer/Library/Caches/node-gyp/14.21.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/hayer/driver/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/hayer/Library/Caches/node-gyp/14.21.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/hayer/driver/node_modules/isolated-vm',
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', '--jobs', 4 ]
npm ERR! In file included from ../src/external_copy_nortti.cc:1:
npm ERR! In file included from ../src/external_copy.h:10:
npm ERR! ../src/isolate/util.h:28:75: error: no viable conversion from 'const v8::Local<v8::Context>' to 'v8::Isolate *'
npm ERR!         return Unmaybe(Unmaybe(options->Get(context, v8_string(key)))->ToBoolean(context))->IsTrue();
npm ERR!                                                                                  ^~~~~~~
npm ERR! /Users/hayer/Library/Caches/node-gyp/14.21.1/include/node/v8.h:2848:37: note: passing argument to parameter 'isolate' here
npm ERR!   Local<Boolean> ToBoolean(Isolate* isolate) const;
npm ERR!                                     ^
npm ERR! In file included from ../src/external_copy_nortti.cc:1:
npm ERR! In file included from ../src/external_copy.h:10:
npm ERR! ../src/isolate/util.h:28:9: error: no matching function for call to 'Unmaybe'
npm ERR!         return Unmaybe(Unmaybe(options->Get(context, v8_string(key)))->ToBoolean(context))->IsTrue();
npm ERR!                ^~~~~~~
npm ERR! ../src/isolate/util.h:10:36: note: candidate template ignored: could not match 'MaybeLocal' against 'Local'
npm ERR! template <typename T> v8::Local<T> Unmaybe(v8::MaybeLocal<T> handle);
npm ERR!                                    ^
npm ERR! ../src/isolate/util.h:11:25: note: candidate template ignored: could not match 'Maybe' against 'Local'
npm ERR! template <typename T> T Unmaybe(v8::Maybe<T> handle);
npm ERR!                         ^
npm ERR! 2 errors generated.
npm ERR! make: *** [Release/obj.target/nortti/src/external_copy_nortti.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 (/Users/hayer/driver/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
npm ERR! gyp ERR! System Darwin 22.3.0
npm ERR! gyp ERR! command "/Users/hayer/.local/share/nvm/v14.21.1/bin/node" "/Users/hayer/driver/node_modules/.bin/node-gyp" "rebuild" "--release" "-j" "4"
npm ERR! gyp ERR! cwd /Users/hayer/driver/node_modules/isolated-vm
npm ERR! gyp ERR! node -v v14.21.1
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok
@Jeroendevr
Copy link
Author

Incorporating pr #43 and updating isolated-vm to 3.0.0 the builds succeeds. But complains about runtime. Could that be related to the fact that I test this single package only and not the server as a whole?

ERROR in ./lib/runtime/runtime-driver.js
Module not found: Error: Can't resolve '@screeps/common/lib/system' in '/Users/hayer/driver/lib/runtime'
 @ ./lib/runtime/runtime-driver.js 11:17-54
 @ ./lib/runtime/mapgrid.js
 @ ./lib/runtime/runtime.js

ERROR in ./lib/runtime/runtime.js
Module not found: Error: Can't resolve '@screeps/engine/src/game/console' in '/Users/hayer/driver/lib/runtime'
 @ ./lib/runtime/runtime.js 8:24-67

ERROR in ./lib/runtime/runtime.js
Module not found: Error: Can't resolve '@screeps/engine/src/game/game' in '/Users/hayer/driver/lib/runtime'
 @ ./lib/runtime/runtime.js 7:17-57

ERROR in ./lib/runtime/runtime.js
Module not found: Error: Can't resolve '@screeps/engine/src/utils' in '/Users/hayer/driver/lib/runtime'
 @ ./lib/runtime/runtime.js 2:18-54

ERROR in ./lib/runtime/mapgrid.js
Module not found: Error: Can't resolve '@screeps/pathfinding' in '/Users/hayer/driver/lib/runtime'
 @ ./lib/runtime/mapgrid.js 1:18-49
 @ ./lib/runtime/runtime.js
Runtime snapshot created (252298 bytes)
npm ERR! code 2
npm ERR! path /Users/hayer/driver
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild -C native && webpack

This was referenced Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant