From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:58490) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0MPU-0006RY-Gn for guix-patches@gnu.org; Wed, 21 Aug 2019 04:56:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0MPT-0005Bd-36 for guix-patches@gnu.org; Wed, 21 Aug 2019 04:56:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54063) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i0MPT-0005BX-0C for guix-patches@gnu.org; Wed, 21 Aug 2019 04:56:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i0MPS-0006XB-Ur for guix-patches@gnu.org; Wed, 21 Aug 2019 04:56:02 -0400 Subject: [bug#36477] [PATCH v2 02/61] gnu: python: Fix cross compilation. Resent-Message-ID: From: Mathieu Othacehe Date: Wed, 21 Aug 2019 10:53:56 +0200 Message-Id: <20190821085455.18508-2-m.othacehe@gmail.com> In-Reply-To: <20190821085455.18508-1-m.othacehe@gmail.com> References: <20190821085455.18508-1-m.othacehe@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 36477@debbugs.gnu.org Cc: Mathieu Othacehe * gnu/packages/python.scm (python-2.7)[arguments]: Add a configure flag to disable a check failing when cross-compiling. This is covered here: https://lists.yoctoproject.org/pipermail/poky/2013-June/008997.html, [native-inputs]: Add self and which when cross-compiling, (python-3.7)[arguments]: Refer to native python when cross-compiling. --- gnu/packages/python.scm | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 9fec18287e..09c1f7d716 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -38,7 +38,7 @@ ;;; Copyright © 2017 Frederick M. Muriithi ;;; Copyright © 2017, 2018 Adriano Peluso ;;; Copyright © 2017 Ben Sturmfels -;;; Copyright © 2017, 2018 Mathieu Othacehe +;;; Copyright © 2017, 2018, 2019 Mathieu Othacehe ;;; Copyright © 2017 José Miguel Sánchez García ;;; Copyright © 2017 Roel Janssen ;;; Copyright © 2017, 2018 Kei Kebreau @@ -150,6 +150,13 @@ "INSTALL=install -c" "MKDIR_P=mkdir -p" + ;; 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") + '()) (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") "/lib")) ;; With no -j argument tests use all available cpus, so provide one. @@ -292,7 +299,12 @@ ("tcl" ,tcl) ("tk" ,tk))) ; for tkinter (native-inputs - `(("pkg-config" ,pkg-config))) + `(("pkg-config" ,pkg-config) + ;; When cross-compiling, a native version of Python itself is needed. + ,@(if (%current-target-system) + `(("self" ,this-package) + ("which" ,which)) + '()))) (native-search-paths (list (search-path-specification (variable "PYTHONPATH") @@ -388,13 +400,16 @@ data types.") (if (null? opt) "none" (car opt))) (for-each (lambda (file) (apply invoke - `(,(string-append out "/bin/python3") - ,@opt - "-m" "compileall" - "-f" ; force rebuild - ;; Don't build lib2to3, because it's Python 2 code. - "-x" "lib2to3/.*" - ,file))) + `(,,(if (%current-target-system) + "python3" + '(string-append out + "/bin/python3")) + ,@opt + "-m" "compileall" + "-f" ; force rebuild + ;; Don't build lib2to3, because it's Python 2 code. + "-x" "lib2to3/.*" + ,file))) (find-files out "\\.py$"))) (list '() '("-O") '("-OO"))) #t))))))) -- 2.17.1