Skip to content

Conversation

@jayvdb
Copy link
Contributor

@jayvdb jayvdb commented Nov 15, 2019

This depends on #183

@indygreg
Copy link
Owner

@jayvdb could you please provide more context on why this is needed? I just want to understand why we need to do this...

@jayvdb
Copy link
Contributor Author

jayvdb commented Nov 29, 2019

@indygreg this PR is irrelevant until #183 is merged. And the problem this PR fixes is documented fairly well on that PR, but it is only a workaround until rust crate object is enhanced, but I also have been working on other workarounds instead of this, so I will mark this PR as a WIP as I think my new workarounds (not yet pushed) are better.

@jayvdb jayvdb changed the title Rename stdlib _queue init if gevent present WIP: Rename stdlib _queue init if gevent present Nov 29, 2019
This causes the .obj files to be unparsable by editbin, dumpbin,
nm, objcopy, goblin and object.

Related to indygreg#169
Built extensions in packages often have common names
like speedups, utils, _objects, cpython, etc. which
reside inside the package namespace.
The compiled extensions each have a PyInit_<module>
which needs to be renamed to PyInit_<pkg>_<module>
to avoid clashes when combined into a static binary.

Fixes indygreg#169
Python import of simplejson fails with a UnicodeDecodeError
on macOS-10.14 when its PyInit symbol is renamed.
cffi includes a near replica of the CPython 3.7's libffi on MSVC,
which needs to be discard to avoid duplicate syms.
Replace pip install --target with venvs.
As setuptools breakes out of the venv to load distutils build_ext
command, first create a copy of the Python distribution and hack
it.

This also allows venv's to be populated manually outside of
PyOxidizer's config, while retaining the ability for PyOxidizer
to pick up and include any built object files.

To facilitate that, the PyOxidizer state dir where objects are
stored is a constant in the distutils compiler modules and in
the Rust source.

Also add venv_path to PipRequirementsFile, allowing the same
venv to be incrementally populated in multiple rules,
and the venv re-used across PyOxidizer build runs.

Fixes indygreg#162
Fixes indygreg#170
Closes indygreg#194
Unsure why this is necessary; as it wasnt needed before
These libs are already in the static python3 binary so shouldnt
be linked in shared libraries used during build dependencies.
The Windows standalone distribution doesnt include venv and presents
other difficulties when running setup.py in the venv's due to
various build dependencies fail.
cffi includes a near replica of the CPython 3.7's libffi on MSVC,
which needs to be discard to avoid duplicate syms.
It isnt being used at the moment, as it doesnt align with a venv
based solution, and pip.rs doesnt yet support the setup.py rule
which is critical for working around various problems.
greenlet includes a pre-built .obj that is not re-built
during the package build, and needs to be included in the
static build process.
gevent._queue conflicts with stdlib _queue.
One of their PyInit__queue symbols needs to be renamed.
Due to missing features in the rust crate `object`, the
gevent objects can not be processed.  So the stdlib
_queuemodule object is modified instead.
Need unreleased fix for COFF.
This is not needed for gevent, as we are rewriting the stdlib
symbol, however it is a preventative measure for other
symbol clashes which might require rewriting.
Specifially needed to workaround multiple __real@
caused by using rust crate object processing
of stdlib queuemodule.obj.

It also solves conflicts like stdlib ffi.obj vs cffi libffi.
@jayvdb
Copy link
Contributor Author

jayvdb commented Dec 22, 2019

This special case has been fixed upstream in gimli-rs/object#159 , so doesnt need a workaround here. Just need to wait for the next release of object.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants