Skip to content

build fails when python3 is default python #418

Description

@donpdonp
  1. python configure script crashes on python3
/tmp/iojs-v1.0.0 $ python -V
Python 3.3.3
/tmp/iojs-v1.0.0 $ ./configure --help
  File "./configure", line 332
    '''
      ^
SyntaxError: invalid syntax
  1. getting around deps: update openssl to 1.0.1j #1 with "$python2 configure", the final step crashes which also looks to be python3 related.
make[1]: Entering directory `/tmp/iojs-v1.0.0/out'
  LD_LIBRARY_PATH=/tmp/iojs-v1.0.0/out/Release/lib.host:/tmp/iojs-v1.0.0/out/Release/lib.target
:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/tools/gyp; mkdir -p /tmp/iojs-v1.0.0/o
ut/Release/obj/gen; python ../../tools/js2c.py "/tmp/iojs-v1.0.0/out/Release/obj/gen/libraries.
cc" CORE ../../src/runtime.js ../../src/v8natives.js ../../src/symbol.js ../../src/array.js ../
../src/string.js ../../src/uri.js ../../src/third_party/fdlibm/fdlibm.js ../../src/math.js ../.
./src/apinatives.js ../../src/date.js ../../src/regexp.js ../../src/arraybuffer.js ../../src/ty
pedarray.js ../../src/generator.js ../../src/object-observe.js ../../src/collection.js ../../sr
c/weak-collection.js ../../src/collection-iterator.js ../../src/promise.js ../../src/messages.j
s ../../src/json.js ../../src/array-iterator.js ../../src/string-iterator.js ../../src/debug-de
bugger.js ../../src/mirror-debugger.js ../../src/liveedit-debugger.js ../../src/macros.py
Traceback (most recent call last):
  File "../../tools/js2c.py", line 534, in <module>
    main()
  File "../../tools/js2c.py", line 530, in main
    JS2C(args[2:], args[0], args[1], options.raw, options.startup_blob)
  File "../../tools/js2c.py", line 499, in JS2C
    sources = PrepareSources(source)
  File "../../tools/js2c.py", line 370, in PrepareSources
    assert len(macro_files) in [0, 1]
TypeError: object of type 'filter' has no len()
make[1]: *** [/tmp/iojs-v1.0.0/out/Release/obj/gen/libraries.cc] Error 1
make[1]: Leaving directory `/tmp/iojs-v1.0.0/out'

Activity

  1. bnoordhuis commented on Jan 14, 2015

    @bnoordhuis
    Member

    Try make PYTHON=python2.

  2. myf commented on Jan 14, 2015

    @myf

    this make PYTHON=python2 would fix the ./configure but it will still break the make

    there are hardcoded python in v8 that does not honor this $PYTHON environment variable.

    the ArchLinux AUR package basically swapped the header of all the .py files in this fashion:

    prepare() {
      cd "${srcdir}/${pkgname}"
    
      find -type f -exec sed \
        -e 's_^#!/usr/bin/env python$_&2_' \
        -e 's_^\(#!/usr/bin/python2\).[45]$_\1_' \
        -e 's_^#!/usr/bin/python$_&2_' \
        -e "s_'python'_'python2'_" -i {} \;
      find test/ -type f -exec sed 's_python _python2 _' -i {} \;
    }
    

    Wonder if there's easier way to do this?

  3. jbergstroem commented on Jan 14, 2015

    @jbergstroem
    Member

    Something similar would have to be done on for instance FreeBSD. This has been brought up previously in the nodejs issue trackers where the conclusion was that maintaining a symlink for the user (python -> python27) was the simplest solution. I'm not super happy with that either and would like some simple detection.

    I don't think python3 will be supported until gyp is out of the picture. The effort for supporting python3 would be a pretty trivial task from there.

  4. rvagg commented on Jan 14, 2015

    @rvagg
    Member

    on a couple of the build machines we take the easy path and symlink python2 to ~/bin/python and run make with PATH=~/bin/:${PATH} make ...

  5. jbergstroem commented on Jan 15, 2015

    @jbergstroem
    Member

    Another way could be changing configure from a python shebang to a shell shebang, do some simple checks for which python binary we'd like to use, then pass the rest of the configure to $PYTHON -c. It requires some minor rewriting of configure (__filename__ for instance), but it'd work. Thoughts?

  6. rvagg commented on Jan 15, 2015

    @rvagg
    Member

    the problem is deeper, python is hardwired into a bunch of v8 build components

  7. bjconlan commented on Jan 17, 2015

    @bjconlan

    Yeah, I thought 2.7.x series was a requirement (as it is for gyp/node-gyp) I wouldn't be surprised if this is closed (wontfix) by an authority.

  8. Fishrock123 commented on Feb 3, 2015

    @Fishrock123
    Contributor

    Is this a v8 issue and not fixable from our end?

  9. bnoordhuis commented on Feb 3, 2015

    @bnoordhuis
    Member

    Yes, both a V8 and a gyp issue. Not much we can do about that. Closing, sorry.

  10. added
    buildIssues and PRs related to Node.js builds or CI infrastructure.
    on Sep 8, 2015
  11. faddah commented on Apr 17, 2016

    @faddah

    just want to +1 this also and hope it can be re-opened, as referred to by @jbergstroem when he closed my similar issue in #6249. python 3.x has been out for a while and all make scripts (configure, make and sudo make install) should support both python 2.7 & python 3.x (and yes, i realize part of the problem is V8 has too much old python 2.x code hardwired into it, as stated in this thread above). i have been told there are patches in the works with node-gyp to support python 3.x, and i just want to re-iterate here that this should perhaps be re-opened and node.js devs should be working with V8 devs to make sure both have an upward path for later version of python.

  12. crccheck commented on Apr 27, 2016

    @crccheck

    It should be noted that the current Ubuntu LTS 16.04 is Python 3 only. I took a quick glance at the Python scripts invoked and I don't see a reason why they couldn't be written in a way that works for Python 2 and 3

  13. jbergstroem commented on Apr 27, 2016

    @jbergstroem
    Member

    @crccheck I bet there's way to install python2. As you can see above, we rely on gyp accepting python3 support before starting to converge our own toolset. We're not against supporting Python 3 – rather for – but its out of our hands at the moment. If you insist on leaning or adding valuable time, I would suggest helping to get python 3 support in gyp land; reckon there'll be feedback from upstream that needs addressing.

  14. faddah commented on Apr 30, 2016

    @faddah

    as stated above, the problem lies that there are sections in node-gyp and the V8 engine that depend on python2 still, and until all those are solved, we're stuck. they have said they are working on it, but keep in mind, it means coordinating with the Google V8 team re-writing their stuff also for python2 or 3, depending on what a system has.

    best,

    — faddah
    portland, oregon, u.s.a.

  15. sigurdurb commented on Nov 13, 2018

    @sigurdurb

    Another workaround is setting up a virtual environment for python2. This worked for me with conda:
    conda create -n python2 python=2.7
    conda activate python2
    npm install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildIssues and PRs related to Node.js builds or CI infrastructure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions