[bug#77947] gnu: python@3.11: Support cross-compilation.

Message ID 10b09cdcf00e74faada1e948a350d488c7d790a2.1745184684.git.ludo@gnu.org
State New
Headers
Series [bug#77947] gnu: python@3.11: Support cross-compilation. |

Commit Message

Ludovic Courtès April 20, 2025, 9:33 p.m. UTC
  * gnu/packages/python.scm (python-3.11)[arguments]: Pass
‘--with-build-python’ when cross-compiling.

Change-Id: Ibb210cc599ff06c5da7e73f706488488c84f5cba
---
 gnu/packages/python.scm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Hello Python team,

This fixes cross-compilation of python@3.11, adding the ‘--with-build-python’
flag, which apparently wasn’t needed for 3.10.

I found this while attempting to build a childhurd as part of my system
config.

Thoughts?

Ludo’.


base-commit: ba53ff9cc403c7f0388e2dc932cb46e665e81be7
  

Comments

Sharlatan Hellseher April 21, 2025, 2:46 p.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512


Hi Ludovic,

I have no strong opinion here, patch looks clear and reasonable if it
fixes cross-compilation.

There is other one 77957, fixing tests on GNU/Hurd which we may consider
to merge together to prevent double re-build the world event ;-) which I
guess we can't escape.

- --
Oleg
-----BEGIN PGP SIGNATURE-----

iQJKBAEBCgA0FiEEmEeB3micIcJkGAhndtcnv/Ys0rUFAmgGWjMWHHNoYXJsYXRh
bnVzQGdtYWlsLmNvbQAKCRB21ye/9izStRLZD/4u1avEDwl2ZTU2uVVRR//NDEQK
NkUfhL+wXLswmXnzvYyna1EFO9hnPhKJi6ZOdmCYBmlwuISCREZWYXVN2w35jG2V
RNvbp1SuPse9XDnvjZSJXIs4/6dDC9QnDmt9FQjHQSLfnQjeXWtsWNUQtXpHtxYh
tvE9AZ/VSWWmeaeYBY1GH5I7FIbkKqfgdX8OlziCmXf33/0fXGH1VIx8gT48kbQp
v1sZ8v0+P8BMTxta15Vl65HNPNrQtHuB/pmFviuW9Q3nY4SC8tuPQk+w5nSwp0mk
TzClogOSCtRhzK66yRduYS5VxDYPuw7EStzoNUp127lOTJHk8XBFgdv9t5nYsgB6
kDY3MfwjlPVaCL2kHvVmIDlRywPzMAi9wCsVJ0QnBZDn7Ij7XvOXmuUayyCTsNxZ
+9ebMJB9a2GWZW3UdpSNAxMvbYRuHel97lIENTiskk8aoJfQ50x3hq6h7XkNKxi3
1Fygba8rQ4+o3scdvR8wLk0Wzo4HrB64UDh/qfjfeF7P0LpUU612G3cnVc5UraH7
AAw12/qIbrCBqiIKzDB7pWZYqQ56QvP/HLh2IxAkOCzthirv35e4Q2MLPlh0fSky
sv4YWu8RJj07O2JUGbkeLzLDucEinWZO71RY+mJGZj+r+l00oXGnwzSrRaA5romf
NSSq/aFilEFqZiTxpw==
=cIEk
-----END PGP SIGNATURE-----
  
ashish.is--- via Guix-patches" via April 21, 2025, 3:12 p.m. UTC | #2
Hello,

Apr 21, 2025, 14:46 by sharlatanus@gmail.com:

>
> Hi Ludovic,
>
> I have no strong opinion here, patch looks clear and reasonable if it
> fixes cross-compilation.
>
> There is other one 77957, fixing tests on GNU/Hurd which we may consider
> to merge together to prevent double re-build the world event ;-) which I
> guess we can't escape.
>
>
From what I can see both should not cause rebuilds for the regular python.
The cross compilation fix is behind a ,@(if (%current-target-system) ...) and my test skips are only for ,@(if (system-hurd?) ...) so only the python on hurd and a cross compiled python should change (which currently dont build)

I checked that the x86-linux python is the same before sending my patch.
  
Ludovic Courtès April 21, 2025, 10:16 p.m. UTC | #3
Hi,

yelninei@tutamail.com writes:

> Apr 21, 2025, 14:46 by sharlatanus@gmail.com:
>
>>
>> Hi Ludovic,
>>
>> I have no strong opinion here, patch looks clear and reasonable if it
>> fixes cross-compilation.
>>
>> There is other one 77957, fixing tests on GNU/Hurd which we may consider
>> to merge together to prevent double re-build the world event ;-) which I
>> guess we can't escape.
>>
>>
> From what I can see both should not cause rebuilds for the regular python.
> The cross compilation fix is behind a ,@(if (%current-target-system)
> ...) and my test skips are only for ,@(if (system-hurd?) ...) so only
> the python on hurd and a cross compiled python should change (which
> currently dont build)
>
> I checked that the x86-linux python is the same before sending my patch.

Yes, it’s all fine.  Pushed both!

  5f1ee7ba73 gnu: python@3.11: Skip more tests on GNU/Hurd.
  49d9dca64f gnu: python@3.11: Support cross-compilation.

Thanks,
Ludo’.
  

Patch

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index ebc9712294..0f2b0891aa 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -1,6 +1,6 @@ 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2021, 2023 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013-2018, 2021, 2023, 2025 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2014, 2017, 2019 Eric Bavier <bavier@member.fsf.org>
@@ -728,9 +728,12 @@  (define-public python-3.11
               ;; Disable runtime check failing if cross-compiling, see:
               ;; https://lists.yoctoproject.org/pipermail/poky/2013-June/008997.html
               #$@(if (%current-target-system)
-                     '("ac_cv_buggy_getaddrinfo=no"
-                       "ac_cv_file__dev_ptmx=no"
-                       "ac_cv_file__dev_ptc=no")
+                     #~("ac_cv_buggy_getaddrinfo=no"
+                        "ac_cv_file__dev_ptmx=no"
+                        "ac_cv_file__dev_ptc=no"
+                        (string-append "--with-build-python="
+                                       #+(this-package-native-input "python")
+                                       "/bin/python3"))
                      '())
               ;; -fno-semantic-interposition reinstates some
               ;; optimizations by gcc leading to around 15% speedup.