From patchwork Mon Dec 9 11:24:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giacomo Leidi X-Patchwork-Id: 16444 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1E5081782A; Mon, 9 Dec 2019 11:25:41 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 91B58177E5 for ; Mon, 9 Dec 2019 11:25:35 +0000 (GMT) Received: from localhost ([::1]:38704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieHAU-0003Xj-Ul for patchwork@mira.cbaines.net; Mon, 09 Dec 2019 06:25:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45586) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieHA2-0003XL-QW for guix-patches@gnu.org; Mon, 09 Dec 2019 06:25:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ieH9z-0007DU-PS for guix-patches@gnu.org; Mon, 09 Dec 2019 06:25:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:46716) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ieH9y-0007Cg-Ug for guix-patches@gnu.org; Mon, 09 Dec 2019 06:25:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ieH9y-0005Ax-MY for guix-patches@gnu.org; Mon, 09 Dec 2019 06:25:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38228] Fwd: [PATCH] gnu: boost: Build with python3 Resent-From: goodoldpaul@autistici.org Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 09 Dec 2019 11:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38228 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Marius Bakke Cc: 38228@debbugs.gnu.org Received: via spool by 38228-submit@debbugs.gnu.org id=B38228.157589067019834 (code B ref 38228); Mon, 09 Dec 2019 11:25:02 +0000 Received: (at 38228) by debbugs.gnu.org; 9 Dec 2019 11:24:30 +0000 Received: from localhost ([127.0.0.1]:52689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ieH9H-00059d-4A for submit@debbugs.gnu.org; Mon, 09 Dec 2019 06:24:30 -0500 Received: from latitanza.investici.org ([82.94.249.234]:37183) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ieH9D-00059S-W0 for 38228@debbugs.gnu.org; Mon, 09 Dec 2019 06:24:17 -0500 Received: from 1.mail-backend.investici.org (unknown [10.0.0.11]) by latitanza.investici.org (Postfix) with ESMTP id 4E3D512017D; Mon, 9 Dec 2019 11:24:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1575890653; bh=GmfHRwPgQYR2yD7neFLsgE5BuoEaUF/D0fNzpJCNKtY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XtIGZ0UXA7bc4gcge2E1m1dEfBIu7uWByIL55xa5zxYzmqZhmVshVARxOHEFxYy7M pDaqvG8Y+c+4pOGEq6JCmZRIrsi1UAQxEeqTgi8KUSOcUKNKuKcu8oSiQK2EciadHW 8c/h4M+dk/kpLku/RPcX1JY2OkFWuQjwD7G6V86E= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: goodoldpaul@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id 21278BEE32; Mon, 9 Dec 2019 11:24:12 +0000 (UTC) MIME-Version: 1.0 Date: Mon, 09 Dec 2019 11:24:12 +0000 From: goodoldpaul@autistici.org In-Reply-To: <87a78r8lgf.fsf@devup.no> References: <2894916c81c703293e028556070cd964@autistici.org> <87d0dzl7tx.fsf@devup.no> <20191111093637.GH3954@E5400> <0755dc96f75da487259457a88d8e23ff@autistici.org> <87a78r8lgf.fsf@devup.no> User-Agent: Roundcube Webmail Message-ID: <8b0f0ae38588baf77c1e43d1690f3dd4@autistici.org> X-Sender: goodoldpaul@autistici.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hello Marius, I apologize for taking so long: the end of the semester is near and my time is a little limited. On 2019-11-20 00:01, Marius Bakke wrote: > goodoldpaul@autistici.org writes: > >> Hello I'm opening another thread ( old one was >> http://issues.guix.gnu.org/issue/38128 ) to build boost in >> core-updates >> with python3. The new patch also parameterizes python versions across >> the package definition. >> >> WDYT? >> >> Bye, >> >> Giacomo >> >> -------- Original Message -------- >> Subject: Re: bug#38128: [PATCH] gnu: Add boost-with-python3 >> Date: 2019-11-12 00:06 >> From: goodoldpaul@autistici.org >> To: Efraim Flashner >> Cc: 38128@debbugs.gnu.org, mbakke@fastmail.com >> >> On 2019-11-11 09:36, Efraim Flashner wrote: >>> I'm going to re-open this one, sorry. >>> >>> Can we replace the '--with-python-version=3.7' and >>> 'libboost_python37.so' >>> with parameterized python variables so we don't have to bump it when >>> we >>> get a new python version? >>> >>> Also, I've attached a package that I've never actually built that >>> uses >>> boost built with python3 if you want something to test it out with :) >> >> I'm not sure how to send a patch for core-updates, I never did it so I >> attached it here. Please tell me if I should open another patch. > > Excellent. Here is fine. :-) > > Note that 'boost-with-python3' has already been merged to core-updates. > What we need now is 1) a patch that makes these adjustments to > 'boost-with-python3', and 2) a follow-up patch that removes > boost-with-python3 and adjusts the original 'boost' package instead. > > The latter will be applied to core-updates after the first patch gets > merged, but you can make (and test :-)) both patches on a local > checkout > of the 'master' branch. I'm attaching the two patches. As you said the one that parameterizes the python version of boost-with-python3 must be applied to master, the other one to core-updates. >> The patch builds boost with python3 and parameterizes the python >> version, as Efraim suggested. I built it successfully on core updates. >> When I tried building Epour on core-updates and saw that Guix was >> starting to build Bash 5.0 I renounced (:D) and I built it on master >> with boost-with-python3 . > > In general, working on the 'core-updates' branch requires a fairly > powerful computer (and lots of time), sorry about that! > >> Libtorrent-rasterbar seems to build fine on master but some tests fail >> to pass and they all seem to be network related but then again this is >> torrent we are talking about. I didn't investigate further but I >> attach >> the log. > > Strange. I suppose these tests are not run when using Boost + Python > 2? > In any case we don't have to worry about that just yet ;-) I gave another look at Libtorrent-rasterbar and I noticed that it depends directly on python2, so the answer to the failing tests could be that upgrading both boost and the python version ( as was done in Efraim's code that I used last time to test boost-with-python3 ) broke something that a closer look to the failing tests could figure out. Right now I tested the upgraded version without problems by building the following ( randomly selected) packages: innoextract, swig, libarea, pbbam, cgal, openimageio. If you have a better idea of what must be tested please tell me and I'll do some more tests. >> I also tried boost-with-python3 with Malmo ( >> https://github.com/microsoft/malmo ) and it seemed to compile fine >> just >> but that package has other problems such as trying to start gradle so >> I >> nerver managed to actually run it. > > Cool. Packaging 'gradle' should be a rewarding experience that makes > many people very happy, if you would like a challenge. ;-) > > >> From 91a25fb143ad0e2e20e8ddadea0c0610849adf92 Mon Sep 17 00:00:00 2001 >> From: Giacomo Leidi >> Date: Tue, 12 Nov 2019 00:24:49 +0100 >> Subject: [PATCH] gnu: boost: Build with python3. >> >> * gnu/packages/boost.scm (boost): >> [arguments]: Parameterize python version. >> [native-inputs]: Use python3. > > [...] > >> (arguments >> - `(#:tests? #f >> + `(#:modules ((guix build gnu-build-system) >> + (guix build utils) >> + (srfi srfi-1)) > > If you add (guix build python-build-system) in there ... [...] >> (replace 'configure >> (lambda* (#:key inputs outputs #:allow-other-keys) >> (let ((icu (assoc-ref inputs "icu4c")) >> + (python (assoc-ref inputs "python")) >> + (python-version >> + (take (string-split ,(package-version python) >> #\.) 2)) > > ... then you can use (python-version (python-version python)) here and > below. I did add python-build-system to #:modules, but Guix kept complaining that python-build-system was not importable until I added #:imported-modules ((guix build python-build-system) ,@%gnu-build-system-modules) Do you happen to have any idea of the differences from #:imported-modules and #:modules? And why was using only gnu-build-system possible also without adding it to #:imported-modules? Or even better: is there any kind of documentation of the arguments and keywords and return values of Guix's functions? Something like this https://flask.palletsprojects.com/en/1.1.x/api/ . I don't really like my solution mainly because now there's two lines containing 4 times the "python" word, so please if you have any further suggestions to how to get this more readable please tell me. >> + (substitute* "tools/build/src/tools/python.jam" >> + (("include/python\\$\\(version\\)") >> + "include/python$(version)m")) > > I wonder why we have to add the 'm'? Will that work with Python 2? I'm not really sure but grepping for "include/python" inside gnu/packages returns some examples where with python3 this "m" seems to be standard practice. Maybe the Python team changed their directory schema between the two releases? Anyway it won't work with python2 that (also shown by grep -nr "include/python" $GUIX_SOURCE/gnu/packages) doesn't use the "m". Thank you for your review Marius, Giacomo From be296d145dbe712e9b84bf80bcefeb8e24418662 Mon Sep 17 00:00:00 2001 From: Giacomo Leidi Date: Sun, 8 Dec 2019 21:47:51 +0100 Subject: [PATCH 1/2] gnu: boost-with-python3: Parameterize python version. * gnu/packages/boost.scm (boost-with-python3): [arguments]: Parameterize python version. --- gnu/packages/boost.scm | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/gnu/packages/boost.scm b/gnu/packages/boost.scm index 0a2a5c5c01..f436d5b688 100644 --- a/gnu/packages/boost.scm +++ b/gnu/packages/boost.scm @@ -139,13 +139,21 @@ across a broad spectrum of applications.") ("python" ,python) ("tcsh" ,tcsh))) (arguments (substitute-keyword-arguments (package-arguments boost) + ((#:imported-modules _ '()) + `((guix build python-build-system) + ,@%gnu-build-system-modules)) + ((#:modules _ '()) + '((guix build gnu-build-system) + ((guix build python-build-system) #:prefix python:) + (guix build utils))) ((#:phases phases) `(modify-phases ,phases (replace 'configure (lambda* (#:key inputs outputs #:allow-other-keys) - (let ((icu (assoc-ref inputs "icu4c")) - (python (assoc-ref inputs "python")) - (out (assoc-ref outputs "out"))) + (let* ((icu (assoc-ref inputs "icu4c")) + (python (assoc-ref inputs "python")) + (python-version (python:python-version python)) + (out (assoc-ref outputs "out"))) (substitute* '("libs/config/configure" "libs/spirit/classic/phoenix/test/runtest.sh" "tools/build/src/engine/execunix.c" @@ -167,15 +175,22 @@ across a broad spectrum of applications.") (string-append "--with-icu=" icu) (string-append "--with-python=" python "/bin/python3") (string-append "--with-python-root=" python) - "--with-python-version=3.7" + (string-append "--with-python-version=" python-version) "--with-toolset=gcc")))) (replace 'provide-libboost_python - (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out"))) + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (python (assoc-ref inputs "python")) + (python-version (python:python-version python)) + (libboost.so + (string-append "libboost_python" + (string-join + (string-split python-version #\.) "") + ".so"))) (with-directory-excursion (string-append out "/lib") - (symlink "libboost_python37.so" "libboost_python.so") + (symlink libboost.so "libboost_python.so") ;; Some packages also look for libboost_python3.so - (symlink "libboost_python37.so" "libboost_python3.so")) + (symlink libboost.so "libboost_python3.so")) #t))))))))) (define-public boost-static -- 2.24.0