Bug 174525 - [PATCH] print/lilypond: build failed - configure can't find python
Summary: [PATCH] print/lilypond: build failed - configure can't find python
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Pietro Cerutti
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-17 20:00 UTC by Vladimir Timofeev
Modified: 2013-08-01 14:50 UTC (History)
1 user (show)

See Also:


Attachments
lilypond-2.16.1.patch (542 bytes, patch)
2012-12-17 20:00 UTC, Vladimir Timofeev
no flags Details | Diff
config.log (116.81 KB, application/octet-stream)
2012-12-18 19:53 UTC, Vladimir Timofeev
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Timofeev 2012-12-17 20:00:00 UTC
Configure fails with this message:
...
checking for python-config... python-config
checking Python.h usability... no
checking Python.h presence... no
checking for Python.h... no
...
WARNING: Please consider installing optional programs:  dblatex rsync

ERROR: Please install required programs:  Python.h (python-devel, python-dev or libpython-dev package)

This patch should fix it by provide correct path to python include dir to configure script.

Port maintainer (gahr@FreeBSD.org) is cc'd.

Generated with FreeBSD Port Tools 0.99_6 (mode: change, diff: ports)
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-12-17 20:00:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gahr

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Pietro Cerutti freebsd_committer freebsd_triage 2012-12-18 11:15:34 UTC
It looks like you don't have python-config in path. I'm surprise your
configure script is able to locate the python interpreter, which happens
at a previous phase.

Do you have a non-standard python installation, or a non-standard PATH?

Please attach your config.log.

-- 
Pietro Cerutti
The FreeBSD Project
gahr@FreeBSD.org

PGP Public Key:
http://gahr.ch/pgp
Comment 3 Vladimir Timofeev 2012-12-18 19:53:58 UTC
On Tue, Dec 18, 2012 at 3:15 PM, Pietro Cerutti <gahr@freebsd.org> wrote:
> It looks like you don't have python-config in path. I'm surprise your
> configure script is able to locate the python interpreter, which happens
> at a previous phase.
Yes, I see that configure has logic to detect python with
python-config, but not expert in autotools
to deeply investigate fail.
I have only standard python installation from ports:
root# pkg info | grep python
py27-telepathy-python-0.15.19_1 Python bindings for the Telepathy framework
py27-xdg-0.19                  A python library to access
freedesktop.org standards
python-2.7,2                   The "meta-port" for the default version
of Python interpreter
python27-2.7.3_3               An interpreted object-oriented
programming language

And indeed python-config in path:
root# python-config --prefix
/usr/local
root# python-config --includes
-I/usr/local/include/python2.7 -I/usr/local/include/python2.7
root# python-config --libs
-pthread -lutil -lm -lpython2.7

>
> Do you have a non-standard python installation, or a non-standard PATH?
No, it is standard python from ports.
PATH for user root also default.
root# env | grep PATH
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin

>
> Please attach your config.log.
Attached...

Another addition:
I have in /etc/make.conf:
CPUTYPE ?= native

.if !defined(CC) || ${CC} == "cc"
CC=clang
.endif
.if !defined(CXX) || ${CXX} == "c++"
CXX=clang++
.endif
.if !defined(CPP) || ${CPP} == "cpp"
CPP=clang-cpp
.endif
# Don't die on warnings
NO_WERROR=
WERROR=

But for ports thats not compile by clang, use portconf, and port
lilypond has this definition in /usr/local/etc/ports.conf
print/lilypond: CC=cc | CPP=cpp | CXX=c++

>
> --
> Pietro Cerutti
> The FreeBSD Project
> gahr@FreeBSD.org
>
> PGP Public Key:
> http://gahr.ch/pgp



-- 
Vladimir Timofeev <vovkasm@gmail.com>
Comment 4 Pietro Cerutti freebsd_committer freebsd_triage 2012-12-18 21:25:09 UTC
Thanks for your feedback, configure errors are often misleading, this
is what's interesting from your config.log:

configure:9257: checking for python-config                                                                                                   
configure:9273: found /usr/local/bin/python-config                                                                                           
configure:9284: result: python-config                                                                                                        
configure:9336: checking Python.h usability                                                                                                  
configure:9353: g++ -c -O2 -pipe -march=native -fno-strict-aliasing  -O2
-finline-functions -g -pipe -I/usr/local/include/python2.7          
+-I/usr/local/include/python2.7 -fno-strict-aliasing -OPT:Olimit=0 -O2
-pipe -march=native -fno-strict-aliasing -DNDEBUG -O2 -pipe           
+-march=native -fno-strict-aliasing  conftest.cpp >&5                                                                                        
cc1plus: error: invalid option argument '-OPT:Olimit=0'

We've got to figure out where that -OPT:Olimit=0 in your compiler
invokation comes from. I'll get to it tomorrow.

Does it look familiar to you?

-- 
Pietro Cerutti
The FreeBSD Project
gahr@FreeBSD.org

PGP Public Key:
http://gahr.ch/pgp
Comment 5 Vladimir Timofeev 2012-12-18 21:50:19 UTC
On Wed, Dec 19, 2012 at 1:25 AM, Pietro Cerutti <gahr@freebsd.org> wrote:
> Thanks for your feedback, configure errors are often misleading, this
> is what's interesting from your config.log:
>
> configure:9257: checking for python-config
> configure:9273: found /usr/local/bin/python-config
> configure:9284: result: python-config
> configure:9336: checking Python.h usability
> configure:9353: g++ -c -O2 -pipe -march=native -fno-strict-aliasing  -O2
> -finline-functions -g -pipe -I/usr/local/include/python2.7
> +-I/usr/local/include/python2.7 -fno-strict-aliasing -OPT:Olimit=0 -O2
> -pipe -march=native -fno-strict-aliasing -DNDEBUG -O2 -pipe
> +-march=native -fno-strict-aliasing  conftest.cpp >&5
> cc1plus: error: invalid option argument '-OPT:Olimit=0'
>
> We've got to figure out where that -OPT:Olimit=0 in your compiler
> invokation comes from. I'll get to it tomorrow.
>
> Does it look familiar to you?
No, this is the frist time I see.
But, stop... I know where it is.
# python-config --cflags
-I/usr/local/include/python2.7 -I/usr/local/include/python2.7
-fno-strict-aliasing -OPT:Olimit=0 -O2 -pipe -march=native
-fno-strict-aliasing -DNDEBUG -O2 -pipe -march=native
-fno-strict-aliasing

1. Google find some results for this...
* http://bugs.python.org/issue1162001 - short: python build system add
"-OPT:Olimit=0" to cflags if compiler do not generate error on this
option

2. I try with simple test.c: int main() { return 0; }
$ clang -OPT:Olimit=0 test.c && echo "OK"
error: invalid integral value 'PT:Olimit=0' in '-OPT:Olimit=0'
error: invalid integral value 'PT:Olimit=0' in '-OPT:Olimit=0'
$ clang -I/usr/local/include/python2.7 -I/usr/local/include/python2.7
-fno-strict-aliasing -OPT:Olimit=0 -O2 -pipe -march=native
-fno-strict-aliasing -DNDEBUG -O2 -pipe -march=native
-fno-strict-aliasing test.c && echo "OK"
OK <-- !!!
$ gcc -OPT:Olimit=0 test.c && echo "OK"
cc1: error: invalid option argument '-OPT:Olimit=0'
$ gcc -I/usr/local/include/python2.7 -I/usr/local/include/python2.7
-fno-strict-aliasing -OPT:Olimit=0 -O2 -pipe -march=native
-fno-strict-aliasing -DNDEBUG -O2 -pipe -march=native
-fno-strict-aliasing test.c && echo "OK"
cc1: error: invalid option argument '-OPT:Olimit=0'
$ gcc46 -OPT:Olimit=0 test.c && echo "OK"
cc1: error: argument to '-O' should be a non-negative integer
$ gcc46 -I/usr/local/include/python2.7 -I/usr/local/include/python2.7
-fno-strict-aliasing -OPT:Olimit=0 -O2 -pipe -march=native
-fno-strict-aliasing -DNDEBUG -O2 -pipe -march=native
-fno-strict-aliasing test.c && echo "OK"
cc1: error: argument to '-O' should be a non-negative integer

So, I build python with clang, and this (bug in clang), expose
(incorrect? algorithm to detecting CFLAGS in python) incorrect cflags
returned by python-config... that leads to incorrect detection of
python presence by lilypond...
I understand all that, but what we can do now? Report bug to python?
Report to clang authors?

>
> --
> Pietro Cerutti
> The FreeBSD Project
> gahr@FreeBSD.org
>
> PGP Public Key:
> http://gahr.ch/pgp



-- 
Vladimir Timofeev <vovkasm@gmail.com>
Comment 6 Vladimir Timofeev 2012-12-18 22:11:59 UTC
> So, I build python with clang, and this (bug in clang), expose
> (incorrect? algorithm to detecting CFLAGS in python) incorrect cflags
> returned by python-config... that leads to incorrect detection of
> python presence by lilypond...
> I understand all that, but what we can do now? Report bug to python?
> Report to clang authors?

I am just create bug in python tracker: http://bugs.python.org/issue16721

>
>>
>> --
>> Pietro Cerutti
>> The FreeBSD Project
>> gahr@FreeBSD.org
>>
>> PGP Public Key:
>> http://gahr.ch/pgp
>
>
>
> --
> Vladimir Timofeev <vovkasm@gmail.com>



-- 
Vladimir Timofeev <vovkasm@gmail.com>
Comment 7 dfilter service freebsd_committer freebsd_triage 2013-01-14 17:57:00 UTC
Author: mva
Date: Mon Jan 14 17:56:47 2013
New Revision: 310398
URL: http://svnweb.freebsd.org/changeset/ports/310398

Log:
  - Fix the -OPT:Olimit=X detection for clang, which could pollute the
    output of python27-config --cflags
  
  PR:		ports/172859 ports/161494 ports/174525
  Submitted by:	Oleg Nauman <oleg.nauman@gmail.com>

Added:
  head/lang/python27/files/patch-configure   (contents, props changed)
Modified:
  head/lang/python27/Makefile

Modified: head/lang/python27/Makefile
==============================================================================
--- head/lang/python27/Makefile	Mon Jan 14 17:55:58 2013	(r310397)
+++ head/lang/python27/Makefile	Mon Jan 14 17:56:47 2013	(r310398)
@@ -3,7 +3,7 @@
 
 PORTNAME=	python27
 PORTVERSION=	2.7.3
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	lang python ipv6
 MASTER_SITES=	${PYTHON_MASTER_SITES}
 MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}

Added: head/lang/python27/files/patch-configure
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/python27/files/patch-configure	Mon Jan 14 17:56:47 2013	(r310398)
@@ -0,0 +1,13 @@
+--- configure.orig	2013-01-14 13:38:53.000000000 +0000
++++ configure	2013-01-14 13:39:14.000000000 +0000
+@@ -5642,8 +5642,8 @@
+ 	BASECFLAGS="$BASECFLAGS $ac_arch_flags"
+ fi
+ 
+-# disable check for icc since it seems to pass, but generates a warning
+-if test "$CC" = icc
++# disable check for icc and clang since it seems to pass, but generates a warning
++if test "$CC" = icc -o "$CC" = clang
+ then
+   ac_cv_opt_olimit_ok=no
+ fi
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 8 Marcus von Appen freebsd_committer freebsd_triage 2013-01-14 17:59:22 UTC
State Changed
From-To: open->feedback

A fix to lang/python27 has been committed. Please check, if this solves 
the issue for you. Thanks!
Comment 9 Vladimir Timofeev 2013-01-14 20:20:25 UTC
Thanks! After r310398 and python upgrade lilypond builds as expected!

--
Vladimir Timofeev <vovkasm@gmail.com>
Comment 10 Pietro Cerutti freebsd_committer freebsd_triage 2013-01-14 21:38:09 UTC
State Changed
From-To: feedback->closed

r310398 fixes this issue. Thanks mav!
Comment 11 alexander.shikoff 2013-08-01 14:44:42 UTC
Patch does not work properly for 10-CURRENT because of /usr/bin/clang
and /usr/bin/cc are the same. It should be modified:

--- configure.orig      2013-01-14 13:38:53.000000000 +0000
+++ configure   2013-01-14 13:39:14.000000000 +0000
@@ -5642,8 +5642,8 @@
        BASECFLAGS="$BASECFLAGS $ac_arch_flags"
 fi

-# disable check for icc since it seems to pass, but generates a warning
-if test "$CC" = icc
+# disable check for icc and clang since it seems to pass, but
generates a warning
+if test "$CC" = icc -o "$CC" = clang -o "$CC" = cc
 then
   ac_cv_opt_olimit_ok=no
 fi


But it seems that it is only workaround for more serious issue with clang:
http://www.freebsd.org/cgi/query-pr.cgi?pr=180985