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

build fails when python3 is default python #418

Closed
donpdonp opened this issue Jan 14, 2015 · 14 comments
Closed

build fails when python3 is default python #418

donpdonp opened this issue Jan 14, 2015 · 14 comments
Labels
build Issues and PRs related to build files or the CI.

Comments

@donpdonp
Copy link

  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'
@bnoordhuis
Copy link
Member

Try make PYTHON=python2.

@myf
Copy link

myf commented Jan 14, 2015

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?

@jbergstroem
Copy link
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.

@rvagg
Copy link
Member

rvagg commented Jan 14, 2015

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 ...

@jbergstroem
Copy link
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?

@rvagg
Copy link
Member

rvagg commented Jan 15, 2015

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

@bjconlan
Copy link

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.

@Fishrock123
Copy link
Contributor

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

@bnoordhuis
Copy link
Member

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

@ChALkeR ChALkeR added the build Issues and PRs related to build files or the CI. label Sep 8, 2015
buildroot-auto-update pushed a commit to buildroot/buildroot that referenced this issue Mar 6, 2016
Remove the patches to use a python variable and instead force python2
into the PATH.

Upstream the python variable was recently removed
(see nodejs/node@c3e50ca) and due to dependencies
directly calling python there is a reluctance to change this.  Instead it
is recommended to add python2 into PATH as the nodejs build machines do
(see nodejs/node#418 and
nodejs/node#2735).

Signed-off-by: Martin Bark <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
@faddah
Copy link

faddah commented Apr 17, 2016

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.

@crccheck
Copy link

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

@jbergstroem
Copy link
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.

@faddah
Copy link

faddah commented Apr 30, 2016

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.

derosier pushed a commit to Ezurio/wb-buildroot that referenced this issue Feb 24, 2017
Remove the patches to use a python variable and instead force python2
into the PATH.

Upstream the python variable was recently removed
(see nodejs/node@c3e50ca) and due to dependencies
directly calling python there is a reluctance to change this.  Instead it
is recommended to add python2 into PATH as the nodejs build machines do
(see nodejs/node#418 and
nodejs/node#2735).

Signed-off-by: Martin Bark <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
BWhitten pushed a commit to Ezurio/wb-buildroot that referenced this issue Dec 14, 2017
Remove the patches to use a python variable and instead force python2
into the PATH.

Upstream the python variable was recently removed
(see nodejs/node@c3e50ca) and due to dependencies
directly calling python there is a reluctance to change this.  Instead it
is recommended to add python2 into PATH as the nodejs build machines do
(see nodejs/node#418 and
nodejs/node#2735).

Signed-off-by: Martin Bark <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
@sigurdurb
Copy link

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
Labels
build Issues and PRs related to build files or the CI.
Projects
None yet
Development

No branches or pull requests