From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Roelandt Subject: =?UTF-8?q?=5BPATCH=5D=20gnu=3A=20Fix=20zlib=20support=20in=20Python=2E?= Date: Wed, 3 Apr 2013 23:33:29 +0200 Message-ID: <1365024809-18782-1-git-send-email-tipecaml@gmail.com> References: <87zjxgqaei.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:57890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNVUl-0004Oc-5t for bug-guix@gnu.org; Wed, 03 Apr 2013 17:45:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNVUg-0005IV-EH for bug-guix@gnu.org; Wed, 03 Apr 2013 17:45:27 -0400 Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]:38793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNVUg-0005IB-8F for bug-guix@gnu.org; Wed, 03 Apr 2013 17:45:22 -0400 Received: by mail-wi0-f175.google.com with SMTP id c10so4100753wiw.2 for ; Wed, 03 Apr 2013 14:45:20 -0700 (PDT) In-Reply-To: <87zjxgqaei.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: bug-guix@gnu.org We must adjust 'inc_dirs' and 'lib_dirs' in setup.py. --- On 04/03/2013 10:35 AM, Ludovic Courtès wrote: > Can you strace it to see which zlib gets loaded? Well, this is funny. When running "python -c "import zlib", /usr/bin/python is called: execve("/home/cyril/.guix-profile/bin/python", ["python", "-c", "import zlib"], [/* 23 vars */]) = 0 I had to use an absolute path to run the right interpreter: execve("/home/cyril/.guix-profile/bin/python", ["/home/cyril/.guix-profile/bin/py"..., "-c", "import zlib"], [/* 23 vars */]) = 0 and it fails to load zlib. Anyway, I think the zlib module was not found because setup.py only looks for the libraries/headers in a few hardcoded directories lib_dirs = self.compiler.library_dirs + [ '/lib64', '/usr/lib64', '/lib', '/usr/lib', ] inc_dirs = self.compiler.include_dirs + ['/usr/include'] Could you confirm that: 1) This patch fixes your zlib issues 2) A similar error occurs when importing other modules, such as bz2 ? I do not think there is a more elegant solution than patching setup.py. I tried running "CFLAGS=-I/path/to/zlib/include ./configure" and "CFLAGS=-I/path/to/zlib/include make" but it does not seem to make any difference. Cyril. gnu/packages/python.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 52b11e4..505dcd9 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -38,7 +38,22 @@ (base32 "11f9aw855lrmknr6c82gm1ijr3n0smc6idyp94y7774yivjnplv1")))) (build-system gnu-build-system) - (arguments `(#:tests? #f)) ; XXX: some tests fail + (arguments + `(#:tests? #f ; XXX: some tests fail + #:phases + (alist-replace + 'configure + (lambda* (#:key inputs #:allow-other-keys #:rest args) + (let ((configure (assoc-ref %standard-phases 'configure)) + (zlib (assoc-ref inputs "zlib"))) + (substitute* "setup.py" + (("'/lib64', '/usr/lib64'") + (string-append "'" zlib "/lib'"))) + (substitute* "setup.py" + (("\\['/usr/include'\\]") + (string-append "['" zlib "/include']"))) + (apply configure args))) + %standard-phases))) (inputs `(("zlib" ,zlib) ("openssl" ,openssl) -- 1.7.10.4