[Python-Dev] Re: [Python-Help] Unable to bootstrap Python 3 install

2022-06-16 Thread Victor Stinner
On Thu, Jun 16, 2022 at 4:29 PM Xavier de Gaye  wrote:
> A Google search on "andoid x86_64" gives about 10,900,000 results, showing 
> that cross-compiling is quite common for the case where the build system and 
> the host system have the same PLATFORM_TRIPLET as when building android 
> x86_64 on an x86_64. So the argument that this problem is not worth fixing 
> because no one has to cross-compile in this environment, IMHO this argument 
> is not valid.

You misunderstood me. I didn't say that the issue must not be fixed. I
only tried to explain why it was not fixed yet.


> Yes this issue does explain how to reproduce the problem. It even shows the 
> backtrace printed when attempting to cross-build Android x86_64 on a linux 
> x86_64.
> To reproduce the issue, just cross-build python for android x86_64 following 
> the well documented process by the Android team.
> It is not clear how this backtrace can be missed when reading the issue !

Is there a way to reproduce the issue without Android? Like building
Python on x86-64 for musl on a system using glibc?


> There is also a patch provided in this issue that is straightforward and that 
> does not involve any change on distutils, only the Makefile and configure.

That's interesting, since distutils is scheduled from removal in Python 3.12.

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/B74YHEAKQZF2XZEOH6SKZRHXQGU4A5OD/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: [Python-Help] Unable to bootstrap Python 3 install

2022-06-16 Thread Xavier de Gaye
A Google search on "andoid x86_64" gives about 10,900,000 results, showing
that cross-compiling is quite common for the case where the build system
and the host system have the same PLATFORM_TRIPLET as when building android
x86_64 on an x86_64. So the argument that this problem is not worth fixing
because no one has to cross-compile in this environment, IMHO this argument
is not valid.

Victor Stinner wrote:
> https://github.com/python/cpython/issues/66913 doesn't explain how to
reproduce the issue, it only gives some info about what doesn't work.
> I don't know how to reproduce the issue.

Yes this issue does explain how to reproduce the problem. It even shows the
backtrace printed when attempting to cross-build Android x86_64 on a linux
x86_64.
To reproduce the issue, just cross-build python for android x86_64
following the well documented process by the Android team.
It is not clear how this backtrace can be missed when reading the issue !

There is also a patch provided in this issue that is straightforward and
that does not involve any change on distutils, only the Makefile and
configure.

Dave wrote:
> Xavier de Gaye reworked the build system, apparently fixing the problem
with this pull request in Dec. 2019:
https://github.com/python/cpython/pull/17420

PR 17420 is about cross-compiling third-party extension modules. If your
problem is just cross-compiling Python you should stick to a solution that
only fixes the problem described in the first paragraph of my first comment
in https://github.com/python/cpython/issues/66913

Best regards.
Xavier de Gaye

On Wed, Jun 15, 2022 at 5:49 PM Gregory P. Smith  wrote:

> -cc:help (bcc)
>
> FWIW the thing to do to move this forward is to open a new PR. Patches
> attached to an email are lost like tears in the rain.
>
> What you describe of cross compilation where host and target triples
> appear the same but use different libraries is a valid cross compilation
> case. But doesn't surprise me that there are bugs given most people never
> have such a setup. Even in an "every build should be a cross build" world
> (which we sadly don't have) it being broken may not show up.
>
> -gps
>
> On Wed, Jun 15, 2022 at 8:28 AM Victor Stinner 
> wrote:
>
>> Hi,
>>
>> While this problem is causing you a lot of troubles, I never had to
>> cross compile Python, and I guess that it's the case for most people.
>> Changing the Python build system and distutils is stressful since it
>> can break Python for the majority of users, rather than leaving the
>> minority of users with an old bug. So far, nobody was brave enough to
>> "break" the system for cross compilation.
>>
>> Moreover, as far as I know, cross compiling Python works for the
>> common case: different platform triplet. Only the corner case of the
>> same triple is causing troubles.
>>
>> https://github.com/python/cpython/issues/66913 doesn't explain how to
>> reproduce the issue, it only gives some info about what doesn't work.
>> I don't know how to reproduce the issue. Please comment the issue.
>>
>> To cross compile Python, I found these documentations:
>>
>> *
>> https://docs.python.org/dev/using/configure.html#cross-compiling-options
>> * WASM: https://github.com/python/cpython/blob/main/Tools/wasm/README.md
>>
>> Currently, setup.py checks for:
>>
>> CROSS_COMPILING = ("_PYTHON_HOST_PLATFORM" in os.environ)
>>
>> Victor
>>
>>
>> On Tue, Jun 14, 2022 at 1:49 AM Dave Blanchard  wrote:
>> > Here's what's happening. This is a very old problem reported ages ago
>> which has never been fixed. If I set the target arch to i686 (on an x86_64
>> build system) Python will cross-compile and bootstrap just fine. But if the
>> host and build triple are the same, then the problem will occur. Python
>> seems to be ASSuming that if the build and host triple match (in this case,
>> both being 'x86_64-linux-gnu') therefore the host and build libraries are
>> binary-compatible--which is NOT actually the case when one is
>> cross-compiling to a different libc, for example. Actually it's kind of
>> brain dead how this is implemented.
>> >
>> > Some prior discussions/years-old bug reports:
>> >
>> > https://bugs.python.org/issue39399
>> > https://bugs.python.org/issue22724
>> > https://bugs.gentoo.org/705970
>> >
>> > In those links, various hacks are attempted with various degrees of
>> success, but then Xavier de Gaye reworked the build system, apparently
>> fixing the problem with this pull request in Dec. 2019:
>> >
>> > https://github.com/python/cpython/pull/17420
>> >
>> > Unfortunately he became annoyed in the comments, seemingly mostly due
>> to the lack of interest from Python to actually do anything about this
>> problem, and cancelled his pull request. His fix was never implemented, and
>> Python cross-compiling remains broken to this day.
>> >
>> > I downloaded his patches, made a minor fix or two, and merged them all
>> together into the one patch attached to this email. When applied to both my
>> build system and target 

[Python-Dev] Re: [Python-Help] Unable to bootstrap Python 3 install

2022-06-16 Thread Christian Heimes

On 16/06/2022 16.29, Xavier de Gaye wrote:

Victor Stinner wrote:
 > https://github.com/python/cpython/issues/66913 
 doesn't explain how to 
reproduce the issue, it only gives some info about what doesn't work.

 > I don't know how to reproduce the issue.

Yes this issue does explain how to reproduce the problem. It even shows 
the backtrace printed when attempting to cross-build Android x86_64 on a 
linux x86_64.
To reproduce the issue, just cross-build python for android x86_64 
following the well documented process by the Android team.

It is not clear how this backtrace can be missed when reading the issue !

There is also a patch provided in this issue that is straightforward and 
that does not involve any change on distutils, only the Makefile and 
configure.


What Victor means that we would like to have clear instructions how to 
reproduce the problem ourselves. Could you please provide step by step 
instructions how I could set up a build environment on a X86_64 PC with 
a standard Linux distro (Fedora, Debian/Ubuntu)?


What packages have to be installed? Do I have to download any extra 
packages? How do I have to set up my build environment? Which commands 
do I have to execute? Is there a container image available that comes 
with everything pre-installed?


You mentioned well-documented process by the Android team. Could you 
please provide links to the relevant documents?


Christian
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/WNEFUJZH32LSNBX75QBLP6X6XZQVAHNK/
Code of Conduct: http://python.org/psf/codeofconduct/