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

node-gyp configure fails #1943

Closed
gengjiawen opened this issue Oct 27, 2019 · 2 comments · Fixed by #1937
Closed

node-gyp configure fails #1943

gengjiawen opened this issue Oct 27, 2019 · 2 comments · Fixed by #1937

Comments

@gengjiawen
Copy link
Member

Reproduce:
https://github.com/nodejs/node-addon-examples/tree/master/2_function_arguments/nan

node-gyp configure -- -f cmake

Looks like has something to do with Python3, cc @cclauss

Env

  System:
    OS: Linux 4.4 Ubuntu 18.04.2 LTS (Bionic Beaver)      
    CPU: (8) x64 Intel(R) Core(TM) i7-4720HQ CPU @ 2.60GHz
    Memory: 7.52 GB / 15.89 GB
    Container: Yes
    Shell: 2.7.1 - /usr/bin/fish
  Binaries:
    Node: 13.0.1 - /usr/local/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.12.0 - /usr/local/bin/npm
  Managers:
    Apt: 1.6.10 - /usr/bin/apt
    pip3: 19.3.1 - /usr/local/bin/pip3
  Utilities:
    CMake: 3.15.3 - /usr/local/bin/cmake
    Make: 4.1 - /usr/bin/make
    GCC: 7.4.0 - /usr/bin/gcc
    Git: 2.17.1 - /usr/bin/git
    Clang: 6.0.0-1ubuntu2 - /usr/bin/clang
  Languages:
    Bash: 4.4.19 - /bin/bash
    Perl: 5.26.1 - /usr/bin/perl
    Python: 2.7.15+ - /usr/bin/python
    Python3: 3.6.8 - /usr/bin/python3
Verbose output (from npm or node-gyp):
gyp info it worked if it ends with ok   
gyp info using node-gyp@6.0.0
gyp info using node@13.0.1 | linux | x64
gyp info find Python using Python version 3.6.8 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'cmake',
gyp info spawn args   '-I',
gyp info spawn args   '/mnt/d/Developer/node-addon-examples/2_function_arguments/nan/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/share/.config/yarn/global/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/daniel/.cache/node-gyp/13.0.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/daniel/.cache/node-gyp/13.0.1',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/share/.config/yarn/global/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/daniel/.cache/node-gyp/13.0.1/<(target_arch)/node.lib',
Traceback (most recent call last):
gyp  File "/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/gyp_main.py", line 50, in <module>
     sys.exit(gyp.script_main())
info  File "/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 1296, in ProcessVariablesAndConditionsInDict      
     build_file)
spawn args  File "/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 1311, in ProcessVariablesAndConditionsInList   '--generator-output',
    ProcessVariablesAndConditionsInDict(item, phase, variables, build_file)
gyp  File "/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 1296, in ProcessVariablesAndConditionsInDict       
 info spawn args   'build',
gyp info     build_file)
spawn args  File "/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 1315, in ProcessVariablesAndConditionsInList   '-Goutput_dir=.'
gyp info spawn args    expanded = ExpandVariables(item, phase, variables, build_file)
 ]
  File "/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 914, in ExpandVariables
    sys.stderr.write(p_stderr)
TypeError: write() argument must be str, not bytes while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/share/.config/yarn/global/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.4.0-18362-Microsoft
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "configure" "--" "-f" "cmake"
gyp ERR! cwd /mnt/d/Developer/node-addon-examples/2_function_arguments/nan
gyp ERR! node -v v13.0.1
gyp ERR! node-gyp -v v6.0.0
gyp ERR! not ok
@cclauss
Copy link
Contributor

cclauss commented Oct 27, 2019

Fixed in #1937. Your review of that PR would help.

@gengjiawen
Copy link
Member Author

gengjiawen commented Oct 27, 2019

Now failed with new Error

cc @cclauss

gyp info it worked if it ends with ok   
gyp info using node-gyp@6.0.0
gyp info using node@13.0.1 | linux | x64
gyp info find Python using Python version 3.6.8 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/gyp_main.py',     
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'cmake',
gyp info spawn args   '-I',
gyp info spawn args   '/mnt/d/Developer/node-addon-examples/2_function_arguments/nan/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/share/.config/yarn/global/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/daniel/.cache/node-gyp/13.0.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/daniel/.cache/node-gyp/13.0.1',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/share/.config/yarn/global/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/daniel/.cache/node-gyp/13.0.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/mnt/d/Developer/node-addon-examples/2_function_arguments/nan',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
  File "/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py", line 1149, in GenerateOutputForConfig
    namer = CMakeNamer(target_list)
  File "/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py", line 598, in __init__
    cmake_target_base_name = CreateCMakeTargetBaseName(qualified_target)
  File "/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py", line 560, in CreateCMakeTargetBaseName
    return StringToCMakeTargetName(cmake_target_base_name)
  File "/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py", line 242, in StringToCMakeTargetName
    return a.translate(string.maketrans(' /():."', '_______'))
AttributeError: module 'string' has no attribute 'maketrans'

@gengjiawen gengjiawen changed the title node-gyp fails node-gyp configure fails Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants