Node: Compile error on ArchLinux - node-4.0.0-rc.5

Created on 8 Sep 2015  Â·  2Comments  Â·  Source: nodejs/node

Hello,

I wanted to try the new RC version but I can't compile it, here is the error.

➜  node-4.0.0-rc.5  python2 ./configure                                                                                                                                                                                                             ~/junkStuff/node-4.0.0-rc.5
creating  ./icu_config.gypi
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'asan': 0,
                 'gas_version': '2.25',
                 'host_arch': 'x64',
                 'icu_small': 'false',
                 'node_byteorder': 'little',
                 'node_install_npm': 'true',
                 'node_prefix': '/usr/local',
                 'node_release_urlbase': '',
                 'node_shared_http_parser': 'false',
                 'node_shared_libuv': 'false',
                 'node_shared_openssl': 'false',
                 'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_lttng': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'false',
                 'openssl_fips': '',
                 'openssl_no_asm': 0,
                 'python': '/usr/bin/python2',
                 'target_arch': 'x64',
                 'uv_parent_path': '/deps/uv/',
                 'uv_use_dtrace': 'false',
                 'v8_enable_gdbjit': 0,
                 'v8_enable_i18n_support': 0,
                 'v8_no_strict_aliasing': 1,
                 'v8_optimized_debug': 0,
                 'v8_random_seed': 0,
                 'v8_use_snapshot': 1,
                 'want_separate_host_toolset': 0}}
creating  ./config.gypi
creating  ./config.mk
  File "<string>", line 1
    import sys; print sys.byteorder
                        ^
SyntaxError: invalid syntax
gyp: Call to 'python -c "import sys; print sys.byteorder"' returned exit status 1. while loading dependencies of /home/nacholibre/junkStuff/node-4.0.0-rc.5/node.gyp while trying to load /home/nacholibre/junkStuff/node-4.0.0-rc.5/node.gyp
Error running GYP

using

$ export PYTHON=/usr/bin/python2
$ $PYTHON ./configure

doesn't work either.

The problem is that there is underlying call python -c "import sys; print sys.byteorder" which is python2 valid code, not python3, and my default python binary is python v3. Why export PYTHON=.. is not considered in node.gyp?

Here is where the call is made

./deps/v8/build/toolchain.gypi:    'v8_host_byteorder%': '<!(python -c "import sys; print sys.byteorder")',

I think the best solution is the configure program itself to search for valid python2 binary.

build

Most helpful comment

Our hands are a little tied here because although we do support $PYTHON for some of the tooling, it's gyp itself that's stuck with python2 and calls it directly as python. Our workaround for build machines with this problem goes something like this:

mkdir -p ~/bin/
ln -s $(which python2) ~/bin/python
export PATH=~/bin/:$PATH
./configure
make
etc.

All 2 comments

Our hands are a little tied here because although we do support $PYTHON for some of the tooling, it's gyp itself that's stuck with python2 and calls it directly as python. Our workaround for build machines with this problem goes something like this:

mkdir -p ~/bin/
ln -s $(which python2) ~/bin/python
export PATH=~/bin/:$PATH
./configure
make
etc.

See also #418

Was this page helpful?
0 / 5 - 0 ratings