From owner-freebsd-ports-bugs@FreeBSD.ORG Sun May 20 08:50:02 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5D75A1065674 for ; Sun, 20 May 2012 08:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 321CF8FC0C for ; Sun, 20 May 2012 08:50:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q4K8o10Q029026 for ; Sun, 20 May 2012 08:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q4K8o1ad029025; Sun, 20 May 2012 08:50:01 GMT (envelope-from gnats) Resent-Date: Sun, 20 May 2012 08:50:01 GMT Resent-Message-Id: <201205200850.q4K8o1ad029025@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Marcus von Appen Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A15681065674; Sun, 20 May 2012 08:41:39 +0000 (UTC) (envelope-from mail@sysfault.org) Received: from smtprelay04.ispgateway.de (smtprelay04.ispgateway.de [80.67.31.38]) by mx1.freebsd.org (Postfix) with ESMTP id 328B78FC0C; Sun, 20 May 2012 08:41:39 +0000 (UTC) Received: from [89.182.42.104] (helo=medusa.sysfault.org) by smtprelay04.ispgateway.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1SW1hj-0004hE-RA; Sun, 20 May 2012 10:41:32 +0200 Received: from [127.0.0.1] (helo=medusa.sysfault.org) by medusa.sysfault.org with esmtp (Exim 4.77 (FreeBSD)) (envelope-from ) id 1SW1jJ-0009Uf-VK; Sun, 20 May 2012 10:43:10 +0200 Received: (from marcus@localhost) by medusa.sysfault.org (8.14.5/8.14.5/Submit) id q4K8h9Xb036496; Sun, 20 May 2012 10:43:09 +0200 (CEST) (envelope-from marcus) Message-Id: <201205200843.q4K8h9Xb036496@medusa.sysfault.org> Date: Sun, 20 May 2012 10:43:09 +0200 (CEST) From: Marcus von Appen To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: kde@FreeBSD.org, python@FreeBSD.org Subject: ports/168159: cmake python detection gets confused if multiple python versions are installed X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Marcus von Appen List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 May 2012 08:50:02 -0000 >Number: 168159 >Category: ports >Synopsis: cmake python detection gets confused if multiple python versions are installed >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun May 20 08:50:01 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Marcus von Appen >Release: FreeBSD 9.0-STABLE amd64 >Organization: >Environment: System: FreeBSD medusa.sysfault.org 9.0-STABLE FreeBSD 9.0-STABLE #0: Mon May 14 15:08:44 CEST 2012 root@medusa.sysfault.org:/usr/obj/usr/src/sys/MEDUSA amd64 >Description: If multiple Python versions are installed, cmake's find_host_package(PythonInterp) and find_host_package(PythonLibs) statements may return different Python versions, causing cmake to try to detect and link against the wrong Python default version >How-To-Repeat: Install lang/python27, lang/python31, lang/python Try to configure and build graphics/py-opencv: [...] root@medusa:/usr/ports/graphics/py-opencv # make configure ===> License BSD accepted by the user ===> Extracting for py27-opencv-2.3.1_3 => SHA256 Checksum OK for OpenCV-2.3.1a.tar.bz2. ===> Patching for py27-opencv-2.3.1_3 ===> Applying extra patch /usr/ports/graphics/py-opencv/../opencv/files/extra-patch-opencv-python ===> Applying FreeBSD patches for py27-opencv-2.3.1_3 ===> py27-opencv-2.3.1_3 depends on file: /usr/local/lib/python2.7/site-packages/numpy/core/numeric.py - found ===> py27-opencv-2.3.1_3 depends on file: /usr/local/bin/python2.7 - found ===> py27-opencv-2.3.1_3 depends on executable: pkg-config - found ===> py27-opencv-2.3.1_3 depends on file: /usr/local/bin/cmake - found ===> py27-opencv-2.3.1_3 depends on shared library: opencv_legacy.2 - found ===> Configuring for py27-opencv-2.3.1_3 [...] -- Looking for pthread.h - found -- Found PythonInterp: /usr/local/bin/python (found version "2.7.3") -- Found PythonLibs: /usr/local/lib/libpython3.1.so (found version "3.1.5") -- Use NumPy headers from: /usr/local/lib/python2.7/site-packages/numpy/core/include -- Found Sphinx 1.1.2: /usr/local/bin/sphinx-build -- Parsing 'cvconfig.h.cmake' >Fix: I'm not entirely sure, if that should be fixed in the related cmake files /usr/local/share/cmake/Modules/FindPythonInterp.cmake /usr/local/share/cmake/Modules/FindPythonLibs.cmake by adjusting the search/find order or go into the relevant Mk files. Below is a patch for bsd.python.mk, which explicitly sets the Python version to be used in bsd.python.mk, based on the detected PYTHON_VER. Index: Mk/bsd.python.mk =================================================================== RCS file: /home/pcvs/ports/Mk/bsd.python.mk,v retrieving revision 1.143 diff -u -r1.143 bsd.python.mk --- Mk/bsd.python.mk 11 Apr 2012 12:52:16 -0000 1.143 +++ Mk/bsd.python.mk 20 May 2012 08:31:02 -0000 @@ -674,6 +674,11 @@ .endif # defined(USE_TWISTED) +.if defined(USE_CMAKE) +CMAKE_ARGS+= -DPythonLibs_FIND_VERSION:STRING="${PYTHON_VER}" \ + -DPythonInterp_FIND_VERSIN:STRING="${PYTHON_VER}" +.endif + # XXX Hm, should I export some of the variables above to *_ENV? .endif # !defined(_POSTMKINCLUDED) && !defined(Python_Pre_Include) >Release-Note: >Audit-Trail: >Unformatted: