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

Recent Emscripten versions no longer work on Netlify builders #12896

Open
bmeurer opened this issue Nov 27, 2020 · 14 comments
Open

Recent Emscripten versions no longer work on Netlify builders #12896

bmeurer opened this issue Nov 27, 2020 · 14 comments
Labels

Comments

@bmeurer
Copy link
Contributor

bmeurer commented Nov 27, 2020

Looks like we broke compatibility with Python 2.7 (as provided by Netlify builders):

5:41:27 PM: emcc -g4 --source-map-base https://emscripten-dbg-stories.netlify.app/ -o dist/crbug-837572.html ./crbug-837572.c
5:41:27 PM: Traceback (most recent call last):
5:41:27 PM:   File "/tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten/emcc.py", line 40, in <module>
5:41:27 PM:     import emscripten
5:41:27 PM:   File "/tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten/emscripten.py", line 463
5:41:27 PM:     args.append(f'--separate-data-segments={memfile}')
5:41:27 PM:                                                     ^
5:41:27 PM: SyntaxError: invalid syntax
@sbc100
Copy link
Collaborator

sbc100 commented Nov 28, 2020

We dropped support for python 2 back in the 2.0.0 release: #11836. Is it possible that error you are seeing is from a machine running python 3 but < 3.6? We did more recently start python f-strings which is that first time we broke compat with python < 3.6.

The plan to move to python3 has been long time in the making: #7198.

If we had good reason we could consider lowering the bar from python 3.6 to python 3.5? Or we could embed the whole of python in the same way we do on mac and windows. The assumption had been that modern linux users all have access to recent python3 version, but maybe that was a bad assumption?

I'm not familiar with Netlify, do you have any control there over the linux distro used?

@bmeurer
Copy link
Contributor Author

bmeurer commented Nov 29, 2020

You don't have any control over the build environment on Netlify as far I as I know. I think supporting Netlify deployment is a pretty strong argument FWIW :-)

Here's the full log from Netlify building https://github.com/bmeurer/emscripten-dbg-stories:

5:39:09 PM: Build ready to start
5:39:11 PM: build-image version: 09c2cdcdf242cf2f57c9ee0fcad9d298fad9ad41
5:39:11 PM: build-image tag: v3.5.0
5:39:11 PM: buildbot version: 8df8a50b1177b0b57364d20e0ea150448924cebf
5:39:11 PM: Fetching cached dependencies
5:39:11 PM: Starting to download cache of 72.7MB
5:39:12 PM: Finished downloading cache in 1.568050975s
5:39:12 PM: Starting to extract cache
5:39:15 PM: Finished extracting cache in 2.446177432s
5:39:15 PM: Finished fetching cache in 4.044785582s
5:39:15 PM: Starting to prepare the repo for build
5:39:15 PM: Preparing Git Reference refs/heads/main
5:39:17 PM: Starting build script
5:39:17 PM: Installing dependencies
5:39:17 PM: Python version set to 2.7
5:39:18 PM: Started restoring cached node version
5:39:21 PM: Finished restoring cached node version
5:39:22 PM: v12.18.0 is already installed.
5:39:23 PM: Now using node v12.18.0 (npm v6.14.4)
5:39:23 PM: Started restoring cached build plugins
5:39:23 PM: Finished restoring cached build plugins
5:39:23 PM: Attempting ruby version 2.7.1, read from environment
5:39:24 PM: Using ruby version 2.7.1
5:39:25 PM: Using PHP version 5.6
5:39:25 PM: Started restoring cached go cache
5:39:25 PM: Finished restoring cached go cache
5:39:25 PM: go version go1.14.4 linux/amd64
5:39:25 PM: go version go1.14.4 linux/amd64
5:39:25 PM: Installing missing commands
5:39:25 PM: Verify run directory
5:39:27 PM: ​
5:39:27 PM: ────────────────────────────────────────────────────────────────
5:39:27 PM:   Netlify Build                                                 
5:39:27 PM: ────────────────────────────────────────────────────────────────
5:39:27 PM: ​
5:39:27 PM: ❯ Version
5:39:27 PM:   @netlify/build 5.3.3
5:39:27 PM: ​
5:39:27 PM: ❯ Flags
5:39:27 PM:   deployId: 5fbfda2d39010800072b6dca
5:39:27 PM:   mode: buildbot
5:39:27 PM: ​
5:39:27 PM: ❯ Current directory
5:39:27 PM:   /opt/build/repo
5:39:27 PM: ​
5:39:27 PM: ❯ Config file
5:39:27 PM:   No config file was defined: using default values.
5:39:27 PM: ​
5:39:27 PM: ❯ Context
5:39:27 PM:   production
5:39:27 PM: ​
5:39:27 PM: ────────────────────────────────────────────────────────────────
5:39:27 PM:   1. Build command from Netlify app                             
5:39:27 PM: ────────────────────────────────────────────────────────────────
5:39:27 PM: ​
5:39:27 PM: $ ./build.sh
5:39:27 PM: Cloning into 'emsdk'...
5:39:28 PM: Installing SDK 'sdk-releases-upstream-d8e430f9a9b6e87502f826c39e7684852f59624f-64bit'..
5:39:28 PM: Installing tool 'node-12.18.1-64bit'..
5:39:28 PM: Downloading: /tmp/tmp.YlmbiKiP0x/emsdk/zips/node-v12.18.1-linux-x64.tar.xz from https://storage.googleapis.com/webassembly/emscripten-releases-builds/deps/node-v12.18.1-linux-x64.tar.xz, 14695604 Bytes
5:39:28 PM:  [----------------------------------------------------------------------------]
5:39:30 PM: Unpacking '/tmp/tmp.YlmbiKiP0x/emsdk/zips/node-v12.18.1-linux-x64.tar.xz' to '/tmp/tmp.YlmbiKiP0x/emsdk/node/12.18.1_64bit'
5:39:30 PM: Done installing tool 'node-12.18.1-64bit'.
5:39:30 PM: Installing tool 'releases-upstream-d8e430f9a9b6e87502f826c39e7684852f59624f-64bit'..
5:39:30 PM: Downloading: /tmp/tmp.YlmbiKiP0x/emsdk/zips/d8e430f9a9b6e87502f826c39e7684852f59624f-wasm-binaries.tbz2 from https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/d8e430f9a9b6e87502f826c39e7684852f59624f/wasm-binaries.tbz2, 280846232 Bytes
5:39:35 PM:  [----------------------------------------------------------------------------]
5:41:26 PM: Unpacking '/tmp/tmp.YlmbiKiP0x/emsdk/zips/d8e430f9a9b6e87502f826c39e7684852f59624f-wasm-binaries.tbz2' to '/tmp/tmp.YlmbiKiP0x/emsdk/upstream'
5:41:26 PM: Done installing tool 'releases-upstream-d8e430f9a9b6e87502f826c39e7684852f59624f-64bit'.
5:41:26 PM: Running post-install step: npm ci ...
5:41:26 PM: Running post-install step: npm install google-closure-compiler-linux
5:41:26 PM: Done running: npm ci
5:41:26 PM: Done installing SDK 'sdk-releases-upstream-d8e430f9a9b6e87502f826c39e7684852f59624f-64bit'.
5:41:26 PM: Setting the following tools as active:
5:41:26 PM:    node-12.18.1-64bit
5:41:26 PM:    releases-upstream-d8e430f9a9b6e87502f826c39e7684852f59624f-64bit
5:41:26 PM: Next steps:
5:41:26 PM: - To conveniently access emsdk tools from the command line,
5:41:26 PM:   consider adding the following directories to your PATH:
5:41:26 PM:     /tmp/tmp.YlmbiKiP0x/emsdk
5:41:26 PM:     /tmp/tmp.YlmbiKiP0x/emsdk/node/12.18.1_64bit/bin
5:41:26 PM:     /tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten
5:41:26 PM: - This can be done for the current shell by running:
5:41:26 PM:     source "/tmp/tmp.YlmbiKiP0x/emsdk/emsdk_env.sh"
5:41:26 PM: - Configure emsdk in your bash profile by running:
5:41:26 PM:     echo 'source "/tmp/tmp.YlmbiKiP0x/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile
5:41:26 PM: Adding directories to PATH:
5:41:26 PM: PATH += /tmp/tmp.YlmbiKiP0x/emsdk
5:41:26 PM: PATH += /tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten
5:41:26 PM: PATH += /tmp/tmp.YlmbiKiP0x/emsdk/node/12.18.1_64bit/bin
5:41:26 PM: Setting environment variables:
5:41:26 PM: PATH = /tmp/tmp.YlmbiKiP0x/emsdk:/tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten:/tmp/tmp.YlmbiKiP0x/emsdk/node/12.18.1_64bit/bin:/opt/build/repo/node_modules/.bin:/opt/build/node_modules/.bin:/opt/node_modules/.bin:/node_modules/.bin:/opt/buildhome/.nvm/versions/node/v12.18.0/bin:/opt/buildhome/.gimme/versions/go1.14.4.linux.amd64/bin:/opt/buildhome/.rvm/gems/ruby-2.7.1/bin:/opt/buildhome/.rvm/gems/ruby-2.7.1@global/bin:/opt/buildhome/.rvm/rubies/ruby-2.7.1/bin:/opt/buildhome/.rvm/bin:/opt/buildhome/python2.7/bin:/opt/buildhome/.linuxbrew/bin:/opt/buildhome/.swiftenv/bin:/opt/buildhome/.swiftenv/shims:/opt/buildhome/.php:/opt/buildhome/.binrc/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/buildhome/.cask/bin:/opt/buildhome/.gimme/bin:/opt/buildhome/.dotnet/tools:/opt/buildhome/.dotnet
5:41:26 PM: EMSDK = /tmp/tmp.YlmbiKiP0x/emsdk
5:41:26 PM: EM_CONFIG = /tmp/tmp.YlmbiKiP0x/emsdk/.emscripten
5:41:26 PM: EM_CACHE = /tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten/cache
5:41:26 PM: EMSDK_NODE = /tmp/tmp.YlmbiKiP0x/emsdk/node/12.18.1_64bit/bin/node
5:41:27 PM: mkdir -p dist
5:41:27 PM: cp crbug-837572.c dist/crbug-837572.c
5:41:27 PM: emcc -g4 --source-map-base https://emscripten-dbg-stories.netlify.app/ -o dist/crbug-837572.html ./crbug-837572.c
5:41:27 PM: Traceback (most recent call last):
5:41:27 PM:   File "/tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten/emcc.py", line 40, in <module>
5:41:27 PM:     import emscripten
5:41:27 PM:   File "/tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten/emscripten.py", line 463
5:41:27 PM:     args.append(f'--separate-data-segments={memfile}')
5:41:27 PM:                                                     ^
5:41:27 PM: SyntaxError: invalid syntax
5:41:27 PM: Makefile:62: recipe for target 'dist/crbug-837572.html' failed
5:41:27 PM: make: *** [dist/crbug-837572.html] Error 1
5:41:27 PM: ​
5:41:27 PM: ────────────────────────────────────────────────────────────────
5:41:27 PM:   "build.command" failed                                        
5:41:27 PM: ────────────────────────────────────────────────────────────────
5:41:27 PM: ​
5:41:27 PM:   Error message
5:41:27 PM:   Command failed with exit code 2: ./build.sh
5:41:27 PM: ​
5:41:27 PM:   Error location
5:41:27 PM:   In Build command from Netlify app:
5:41:27 PM:   ./build.sh
5:41:27 PM: ​
5:41:27 PM:   Resolved config
5:41:27 PM:   build:
5:41:27 PM:     command: ./build.sh
5:41:27 PM:     commandOrigin: ui
5:41:27 PM:     environment:
5:41:27 PM:       - SOURCE_MAP_BASE
5:41:27 PM:     publish: /opt/build/repo/dist
5:41:27 PM: Caching artifacts
5:41:27 PM: Started saving build plugins
5:41:27 PM: Finished saving build plugins
5:41:27 PM: Started saving pip cache
5:41:27 PM: Finished saving pip cache
5:41:27 PM: Started saving emacs cask dependencies
5:41:27 PM: Finished saving emacs cask dependencies
5:41:27 PM: Started saving maven dependencies
5:41:27 PM: Finished saving maven dependencies
5:41:27 PM: Started saving boot dependencies
5:41:27 PM: Finished saving boot dependencies
5:41:27 PM: Started saving go dependencies
5:41:27 PM: Finished saving go dependencies
5:41:27 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:41:27 PM: Failing build: Failed to build site
5:41:27 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
5:41:27 PM: Finished processing build request in 2m16.49155166s

@sbc100
Copy link
Collaborator

sbc100 commented Nov 29, 2020

You don't have any control over the build environment on Netlify as far I as I know. I think supporting Netlify deployment is a pretty strong argument FWIW :-)

I don't know anything about Netlify but I find it really hard to believe that any kind of CI/CD system today wouldn't support python3. I mean its kind of unthinkable isn't it, given that python2 is long past end of life and unsupported upstream?

I don't mind investing in other solutions such as bundling our own python3 linux binary if we really have to.. but we should at be really sure that we have investigated all possible options with Netlify first. Unfortunately I know nothing about Netlify so I don't feel very qualified to do that part but I'm happy to try if you would like. If possible could you investigate further with them (possibly reach out to them) before re-escalating here if all else fails?

Here's the full log from Netlify building https://github.com/bmeurer/emscripten-dbg-stories:

5:39:09 PM: Build ready to start
5:39:11 PM: build-image version: 09c2cdcdf242cf2f57c9ee0fcad9d298fad9ad41
5:39:11 PM: build-image tag: v3.5.0
5:39:11 PM: buildbot version: 8df8a50b1177b0b57364d20e0ea150448924cebf
5:39:11 PM: Fetching cached dependencies
5:39:11 PM: Starting to download cache of 72.7MB
5:39:12 PM: Finished downloading cache in 1.568050975s
5:39:12 PM: Starting to extract cache
5:39:15 PM: Finished extracting cache in 2.446177432s
5:39:15 PM: Finished fetching cache in 4.044785582s
5:39:15 PM: Starting to prepare the repo for build
5:39:15 PM: Preparing Git Reference refs/heads/main
5:39:17 PM: Starting build script
5:39:17 PM: Installing dependencies
5:39:17 PM: Python version set to 2.7
5:39:18 PM: Started restoring cached node version
5:39:21 PM: Finished restoring cached node version
5:39:22 PM: v12.18.0 is already installed.
5:39:23 PM: Now using node v12.18.0 (npm v6.14.4)
5:39:23 PM: Started restoring cached build plugins
5:39:23 PM: Finished restoring cached build plugins
5:39:23 PM: Attempting ruby version 2.7.1, read from environment
5:39:24 PM: Using ruby version 2.7.1
5:39:25 PM: Using PHP version 5.6
5:39:25 PM: Started restoring cached go cache
5:39:25 PM: Finished restoring cached go cache
5:39:25 PM: go version go1.14.4 linux/amd64
5:39:25 PM: go version go1.14.4 linux/amd64
5:39:25 PM: Installing missing commands
5:39:25 PM: Verify run directory
5:39:27 PM: ​
5:39:27 PM: ────────────────────────────────────────────────────────────────
5:39:27 PM:   Netlify Build                                                 
5:39:27 PM: ────────────────────────────────────────────────────────────────
5:39:27 PM: ​
5:39:27 PM: ❯ Version
5:39:27 PM:   @netlify/build 5.3.3
5:39:27 PM: ​
5:39:27 PM: ❯ Flags
5:39:27 PM:   deployId: 5fbfda2d39010800072b6dca
5:39:27 PM:   mode: buildbot
5:39:27 PM: ​
5:39:27 PM: ❯ Current directory
5:39:27 PM:   /opt/build/repo
5:39:27 PM: ​
5:39:27 PM: ❯ Config file
5:39:27 PM:   No config file was defined: using default values.
5:39:27 PM: ​
5:39:27 PM: ❯ Context
5:39:27 PM:   production
5:39:27 PM: ​
5:39:27 PM: ────────────────────────────────────────────────────────────────
5:39:27 PM:   1. Build command from Netlify app                             
5:39:27 PM: ────────────────────────────────────────────────────────────────
5:39:27 PM: ​
5:39:27 PM: $ ./build.sh
5:39:27 PM: Cloning into 'emsdk'...
5:39:28 PM: Installing SDK 'sdk-releases-upstream-d8e430f9a9b6e87502f826c39e7684852f59624f-64bit'..
5:39:28 PM: Installing tool 'node-12.18.1-64bit'..
5:39:28 PM: Downloading: /tmp/tmp.YlmbiKiP0x/emsdk/zips/node-v12.18.1-linux-x64.tar.xz from https://storage.googleapis.com/webassembly/emscripten-releases-builds/deps/node-v12.18.1-linux-x64.tar.xz, 14695604 Bytes
5:39:28 PM:  [----------------------------------------------------------------------------]
5:39:30 PM: Unpacking '/tmp/tmp.YlmbiKiP0x/emsdk/zips/node-v12.18.1-linux-x64.tar.xz' to '/tmp/tmp.YlmbiKiP0x/emsdk/node/12.18.1_64bit'
5:39:30 PM: Done installing tool 'node-12.18.1-64bit'.
5:39:30 PM: Installing tool 'releases-upstream-d8e430f9a9b6e87502f826c39e7684852f59624f-64bit'..
5:39:30 PM: Downloading: /tmp/tmp.YlmbiKiP0x/emsdk/zips/d8e430f9a9b6e87502f826c39e7684852f59624f-wasm-binaries.tbz2 from https://storage.googleapis.com/webassembly/emscripten-releases-builds/linux/d8e430f9a9b6e87502f826c39e7684852f59624f/wasm-binaries.tbz2, 280846232 Bytes
5:39:35 PM:  [----------------------------------------------------------------------------]
5:41:26 PM: Unpacking '/tmp/tmp.YlmbiKiP0x/emsdk/zips/d8e430f9a9b6e87502f826c39e7684852f59624f-wasm-binaries.tbz2' to '/tmp/tmp.YlmbiKiP0x/emsdk/upstream'
5:41:26 PM: Done installing tool 'releases-upstream-d8e430f9a9b6e87502f826c39e7684852f59624f-64bit'.
5:41:26 PM: Running post-install step: npm ci ...
5:41:26 PM: Running post-install step: npm install google-closure-compiler-linux
5:41:26 PM: Done running: npm ci
5:41:26 PM: Done installing SDK 'sdk-releases-upstream-d8e430f9a9b6e87502f826c39e7684852f59624f-64bit'.
5:41:26 PM: Setting the following tools as active:
5:41:26 PM:    node-12.18.1-64bit
5:41:26 PM:    releases-upstream-d8e430f9a9b6e87502f826c39e7684852f59624f-64bit
5:41:26 PM: Next steps:
5:41:26 PM: - To conveniently access emsdk tools from the command line,
5:41:26 PM:   consider adding the following directories to your PATH:
5:41:26 PM:     /tmp/tmp.YlmbiKiP0x/emsdk
5:41:26 PM:     /tmp/tmp.YlmbiKiP0x/emsdk/node/12.18.1_64bit/bin
5:41:26 PM:     /tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten
5:41:26 PM: - This can be done for the current shell by running:
5:41:26 PM:     source "/tmp/tmp.YlmbiKiP0x/emsdk/emsdk_env.sh"
5:41:26 PM: - Configure emsdk in your bash profile by running:
5:41:26 PM:     echo 'source "/tmp/tmp.YlmbiKiP0x/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile
5:41:26 PM: Adding directories to PATH:
5:41:26 PM: PATH += /tmp/tmp.YlmbiKiP0x/emsdk
5:41:26 PM: PATH += /tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten
5:41:26 PM: PATH += /tmp/tmp.YlmbiKiP0x/emsdk/node/12.18.1_64bit/bin
5:41:26 PM: Setting environment variables:
5:41:26 PM: PATH = /tmp/tmp.YlmbiKiP0x/emsdk:/tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten:/tmp/tmp.YlmbiKiP0x/emsdk/node/12.18.1_64bit/bin:/opt/build/repo/node_modules/.bin:/opt/build/node_modules/.bin:/opt/node_modules/.bin:/node_modules/.bin:/opt/buildhome/.nvm/versions/node/v12.18.0/bin:/opt/buildhome/.gimme/versions/go1.14.4.linux.amd64/bin:/opt/buildhome/.rvm/gems/ruby-2.7.1/bin:/opt/buildhome/.rvm/gems/ruby-2.7.1@global/bin:/opt/buildhome/.rvm/rubies/ruby-2.7.1/bin:/opt/buildhome/.rvm/bin:/opt/buildhome/python2.7/bin:/opt/buildhome/.linuxbrew/bin:/opt/buildhome/.swiftenv/bin:/opt/buildhome/.swiftenv/shims:/opt/buildhome/.php:/opt/buildhome/.binrc/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/buildhome/.cask/bin:/opt/buildhome/.gimme/bin:/opt/buildhome/.dotnet/tools:/opt/buildhome/.dotnet
5:41:26 PM: EMSDK = /tmp/tmp.YlmbiKiP0x/emsdk
5:41:26 PM: EM_CONFIG = /tmp/tmp.YlmbiKiP0x/emsdk/.emscripten
5:41:26 PM: EM_CACHE = /tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten/cache
5:41:26 PM: EMSDK_NODE = /tmp/tmp.YlmbiKiP0x/emsdk/node/12.18.1_64bit/bin/node
5:41:27 PM: mkdir -p dist
5:41:27 PM: cp crbug-837572.c dist/crbug-837572.c
5:41:27 PM: emcc -g4 --source-map-base https://emscripten-dbg-stories.netlify.app/ -o dist/crbug-837572.html ./crbug-837572.c
5:41:27 PM: Traceback (most recent call last):
5:41:27 PM:   File "/tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten/emcc.py", line 40, in <module>
5:41:27 PM:     import emscripten
5:41:27 PM:   File "/tmp/tmp.YlmbiKiP0x/emsdk/upstream/emscripten/emscripten.py", line 463
5:41:27 PM:     args.append(f'--separate-data-segments={memfile}')
5:41:27 PM:                                                     ^
5:41:27 PM: SyntaxError: invalid syntax
5:41:27 PM: Makefile:62: recipe for target 'dist/crbug-837572.html' failed
5:41:27 PM: make: *** [dist/crbug-837572.html] Error 1
5:41:27 PM: ​
5:41:27 PM: ────────────────────────────────────────────────────────────────
5:41:27 PM:   "build.command" failed                                        
5:41:27 PM: ────────────────────────────────────────────────────────────────
5:41:27 PM: ​
5:41:27 PM:   Error message
5:41:27 PM:   Command failed with exit code 2: ./build.sh
5:41:27 PM: ​
5:41:27 PM:   Error location
5:41:27 PM:   In Build command from Netlify app:
5:41:27 PM:   ./build.sh
5:41:27 PM: ​
5:41:27 PM:   Resolved config
5:41:27 PM:   build:
5:41:27 PM:     command: ./build.sh
5:41:27 PM:     commandOrigin: ui
5:41:27 PM:     environment:
5:41:27 PM:       - SOURCE_MAP_BASE
5:41:27 PM:     publish: /opt/build/repo/dist
5:41:27 PM: Caching artifacts
5:41:27 PM: Started saving build plugins
5:41:27 PM: Finished saving build plugins
5:41:27 PM: Started saving pip cache
5:41:27 PM: Finished saving pip cache
5:41:27 PM: Started saving emacs cask dependencies
5:41:27 PM: Finished saving emacs cask dependencies
5:41:27 PM: Started saving maven dependencies
5:41:27 PM: Finished saving maven dependencies
5:41:27 PM: Started saving boot dependencies
5:41:27 PM: Finished saving boot dependencies
5:41:27 PM: Started saving go dependencies
5:41:27 PM: Finished saving go dependencies
5:41:27 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:41:27 PM: Failing build: Failed to build site
5:41:27 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
5:41:27 PM: Finished processing build request in 2m16.49155166s

@sbc100
Copy link
Collaborator

sbc100 commented Nov 29, 2020

From the looks the docs it certainly look like it should be possible to specify which version you want: https://docs.netlify.com/configure-builds/manage-dependencies/#python

@bmeurer
Copy link
Contributor Author

bmeurer commented Nov 30, 2020

Ah, setting PYTHON_VERSION environment variable does indeed fix it. I think it's worth investing in a smooth default experience for Emscripten users here (in particular since Netlify is pretty popular), though, i.e. can we check the python version in emcc early on and raise a meaningful error message if it's not supported? And maybe we could make some adjustments such that Emscripten will just work on Netlify without any settings / tweaks on the user side?

@curiousdannii
Copy link
Contributor

Every other platform expects you to choose the right OS distribution, software versions, etc. Though raising an error at the beginning if the Python version isn't high enough would be a good change.

@sbc100
Copy link
Collaborator

sbc100 commented Nov 30, 2020

Every other platform expects you to choose the right OS distribution, software versions, etc. Though raising an error at the beginning if the Python version isn't high enough would be a good change.

We do report and error nicely at the beginning, but because f-strings are syntax error we don't get a chance in this case:

print('error: emscripten requires python 3.6 or above', file=sys.stderr)

To make this check more useful it would need to be done in the calling process... before we actually run python. We could do that if we decide its worth the effort but we have had very few reports so far about the python transition causing problems.

If its OK with you, we can close this bug and re-open to try to add better reporting if we get more reports of folks who run into trouble.

While the error we see here is not very clear.. its also not completely in-actionable, and it only effects linux users (not mac or windows) who tend to more savvy (hence the fact the we don't bundle a python for them but expect them to install it themselves):

     s.append(f'--separate-data-segments={memfile}')

SyntaxError: invalid syntax

@bmeurer
Copy link
Contributor Author

bmeurer commented Nov 30, 2020

Your call. But I'd like to call out that this doesn't just affect linux users, but generally folks deploying to Netlify, and I assume that the majority of those are probably actually mac users. :-)

@kripken
Copy link
Member

kripken commented Dec 1, 2020

Perhaps we should add an FAQ entry for this, at least?

Btw, I get a different error trying to run in python2, I don't even get to the f-string which is in emscripten.py,

$ python2 emcc.py
  File "emcc.py", line 857
    print('emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) %s' % shared.EMSCRIPTEN_VERSION, file=sys.stderr)
                                                                                                                       ^
SyntaxError: invalid syntax

So if we want to mention this in the docs somewhere, we may want to mention both errors.

@sbc100
Copy link
Collaborator

sbc100 commented Dec 1, 2020

I think @kripken you are seeing the error one gets with python2. I suspect that the original bug was reported on a machine running python 3.5 (which support the print function but not the f-strings). Even though netlify is reporting Python version set to 2.7 I think there must be python 3.5 install on the host machine too and emcc is finding that.

@sbc100
Copy link
Collaborator

sbc100 commented Dec 1, 2020

One problem with the obvious solution of adding python --version check to the emcc shell launcher is that it adds one more process invocation to every emcc call.

Another possible solution: Add another tiny python script that is valid python2 which checks the version before importing the real emcc.py. But we would need to do this for every single entry point so it also a little tricky.

@curiousdannii
Copy link
Contributor

If emcc.py was kept to a lower Python syntax requirement (3.0?) then you could catch a SyntaxError when you import the other modules. But just because f-strings aren't used in emcc.py currently doesn't mean that they won't be really useful in the future.

@sbc100
Copy link
Collaborator

sbc100 commented Dec 1, 2020

But emcc.py is huge so we would not want to restrict that file. I was thinking a smaller launcher that had lower requirement.

Also, we have at least 10 different python entry points so ideally any solution would work for all entry points.

kripken added a commit that referenced this issue Dec 3, 2020
Context: #12896

Also some minor drive-by fixes that I noticed.
@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants