Comments (20)
Disabling LTO seems to fix it. So it looks like a bug in uwsgi, since configuring Python to build --with-lto is a valid option.
$ docker run -it --entrypoint=/bin/bash gcr.io/google-appengine/python:latest
$ virtualenv -p python3.5 /env
$ . /env/bin/activate
(env) $ LDFLAGS=-fno-lto pip install uwsgi
Successfully installed uwsgi-2.0.15
(env) $ /env/bin/uwsgi --python-version
3.5.2
from python-runtime.
This is in Python 3, FYI.
from python-runtime.
Same error on 1) Older versions of uwsgi (2.0.15, .14, .10, and .0), and 2) Older releases of the runtime image.
from python-runtime.
Possibly related to compiling the Python3.5 interpreter with link-time optimization and profile-guided optimization.
from python-runtime.
from python-runtime.
I can't think of a good fix or workaround on our end. There doesn't seem to be a way to pass LDFLAGS inside a requirements.txt, and honestly I was surprised that doing what I did worked.
The GCC command line doesn't match what I expect, so it's not clear if this is a bug in uwsgi, or setuptools, or Python (for passing the wrong ld flags).
I will look a bit more.
CC @gpshead
from python-runtime.
@duggelz I wonder if we should consider not compiling with LTO? Do the debian interpreters do so?
from python-runtime.
The problem here appears to be uwsgi. It has a very complicated build process and is much more than just an extension module.
Yes, Debian builds it's python3.5 package with LTO.
There are a couple other things its rules file does such as objcopy -p --remove-section=.gnu.lto_.*
on the static library (.a) files as well as modifying CFLAGS to have -flto -fuse-linker-plugin
and sometimes -ffat-lto-objects
.
Caveat: I'm just making quick investigation comments, I haven't dug into how any of this actually works so take my comments as side notes to ponder, I don't know which if any of this is related to the build problems.
from python-runtime.
Data points: Installation works fine with Docker's python image, and also works if I start with Debian 9, "apt-get install python3.5" and "pip3 install uwsgi". So maybe it's on our end.
$ docker run -it --entrypoint=/bin/bash python:3.5
root@4e2d887d5c03:/# pip -V
pip 9.0.1 from /usr/local/lib/python3.5/site-packages (python 3.5)
root@4e2d887d5c03:/# pip install uwsgi
Successfully installed uwsgi-2.0.15
$ docker run -it --entrypoint=/bin/bash debian:9
root@f8faf8282ad1:/# apt-get -q update && apt-get -q install python3.5 python3-pip
root@f8faf8282ad1:/# pip3 -V
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.5)
root@f8faf8282ad1:/# pip3 install uwsgi
Successfully installed uwsgi-2.0.15
from python-runtime.
should we just drop lto?
from python-runtime.
from python-runtime.
I successfully got this all to work by updating to Python 3.5.3, which changed how the lto flags are handled.
from python-runtime.
@duggelz sounds like something we should do anyway. :)
from python-runtime.
Each of Python 3.5.2, 3.5.3, 3.6.0, and 3.6.1 seem to handle '--with-lto', '--enable-optimzations', and/or 'make profile-opt' differently. I'm only about 60% sure that my 3.5.3 binary was actually using PGO and LTO, since:
- Bugs in 3.5.3's makefile cause things to be redundantly rebuilt (https://bugs.python.org/issue28643)
- Based on python/cpython#129, I might not actually have been using PGO.
- Based on a different change, I might not actually have been using LTO (for a while --enable-optimizations implied --with-lto, then it didn't).
- You can't examine an executable file after the fact and determine if it was built with PGO or LTO.
At this point, my interest is turning to making a 3.5.X that actually works with uwsgi, possibly by turning off LTO, and revisit LTO in Python 3.6.
from python-runtime.
Fedora builds without PGO and without LTO: http://pkgs.fedoraproject.org/cgit/rpms/python3.git/tree/python3.spec
Arch Linux started building with --enable-optimizations and --with-lto (but might not actually build with PGO because of the bug) at Python 3.6.0:
https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/python
from python-runtime.
Still working on the right combination of flags in #104
from python-runtime.
I can't seem to get this to compile properly for Python 3.5.3, but I do have it working for Python 3.6.1, so I'm calling that "qualified success".
from python-runtime.
I'd definitely put "have 3.6" above "uwsgi works on 3.5". Just because it gives 3.x users a "path" to use uwsgi.
from python-runtime.
Turns out my #117 was too aggressive, because uswgi requires the libpython-blah.a
from python-runtime.
This was fixed quite some time ago. We still don't use LTO, but that's a separate issue.
from python-runtime.
Related Issues (20)
- Outdated `setuptools` causing package installation issues HOT 6
- Add CODEOWNERS to this repository
- Enable LTO when compiling Python interpreters HOT 1
- CARS
- Latest build is missing `python3` and `pip3` symlinks HOT 2
- GAP Flexible environment - Python
- Removal of Wheezy and Jessie (except LTS) from mirrors]
- Include python 3.8 interpreter. HOT 11
- Official docs say this should be 3.7.2 so why is it 3.6? HOT 3
- Upgrade pip version HOT 5
- Problem installing GDAL HOT 1
- Debian 10
- Gcloud sdk shell not working HOT 3
- Release new Python 3.7 image with 3.7.7 HOT 1
- ERROR: (gcloud.app.deploy) Error Response: [9] Application startup error! Code: APP_CONTAINER_CRASHED /bin/sh: 1: exec: gunicorn: not found HOT 1
- App Engine Flex Python Cloud: Privately packaged dependencies alternative
- gcr.io/google-appengine/python3
- Is base image Ubuntu 16 or 18? HOT 3
- Cannot Install google-chrome-stable b/c Ubuntu 16
- Teffybot.py
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-runtime.