Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] GCC dos not find Python.h, clang does...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
lefta
n00b
n00b


Joined: 29 Apr 2011
Posts: 17

PostPosted: Sat Feb 22, 2014 6:28 pm    Post subject: [Solved] GCC dos not find Python.h, clang does... Reply with quote

Hi there,

Building xen-tools-4.3.2 with GCC, the configure script is unable to find Python.h. I found it in /usr/include/python2.7/Python.h, python 2.7 is the active python profile, and I can't find details in the config.log. I already tried symlinking /usr/include/python an /usr/include/Python to /usr/include/python2.7, it is not an ebuild error as I have the same problem when building by hand, and it looks for it even with USE=-python. I tried in user mode (non root), and I already tried about everything which went throught my head, but without results. The funny thing (or not so funny for me) is that when I first tried to build with clang, configure went well, but it crashed when looking for gnu/stubs-32.h.

EDIT: Just found that stubs-32.h is not on my full 64 bit system. I already switched profiles but didn't manage to rebuild my world. :oops: Maybe clang will build after that.

So building with GCC fails to configure, building with clang fails to build...
As the time go, I hate GCC and developpers which rely on GCC extensions more and more. But that is not the problem here.

I don't know what to try now, any help would be greatly appreciated.
Thank you very much.


Last edited by lefta on Tue Feb 25, 2014 7:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8600

PostPosted: Sat Feb 22, 2014 7:59 pm    Post subject: Reply with quote

Start by following the instructions that are always printed when a build fails in this manner. Show us emerge --info app-emulation/xen-tools and pastebin the configure log.
Back to top
View user's profile Send private message
lefta
n00b
n00b


Joined: 29 Apr 2011
Posts: 17

PostPosted: Tue Feb 25, 2014 3:40 pm    Post subject: Reply with quote

Sorry, here is emerge --info : http://pastebin.com/5UJ0DPJ1.
And here is config.log http://pastebin.com/qa5cxBkc :oops:

EDIT : It works better with multilib profile, but clang now fails with ".code16 not supported yet". So I will have to rely on gcc one more time;..

EDIT 2 : Did not see that there was a log in tools directory too. it fails with :
Code:
configure:6383: checking Python.h usability
configure:6383: gcc -c -march=x86-64 -O2 -fomit-frame-pointer -march=x86-64 -O2 -fomit-frame-pointer -I/usr/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing -OPT:Olimit=0 -march=x86-64 -O2 -fomit-frame-pointer -fwrapv -DNDEBUG conftest.c >&5
cc1: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
configure:6383: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "Xen Hypervisor Tools"
| #define PACKAGE_TARNAME "xen"
| #define PACKAGE_VERSION "4.3"
| #define PACKAGE_STRING "Xen Hypervisor Tools 4.3"
| #define PACKAGE_BUGREPORT "xen-devel@lists.xen.org"
| #define PACKAGE_URL "http://www.xen.org/"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| /* end confdefs.h.  */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| #  include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| #  include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| #include <Python.h>
configure:6383: result: no
configure:6383: checking Python.h presence
configure:6383: gcc -E -march=x86-64 -O2 -fomit-frame-pointer -I/usr/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing -OPT:Olimit=0 -march=x86-64 -O2 -fomit-frame-pointer -fwrapv -DNDEBUG conftest.c
cc1: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
configure:6383: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "Xen Hypervisor Tools"
| #define PACKAGE_TARNAME "xen"
| #define PACKAGE_VERSION "4.3"
| #define PACKAGE_STRING "Xen Hypervisor Tools 4.3"
| #define PACKAGE_BUGREPORT "xen-devel@lists.xen.org"
| #define PACKAGE_URL "http://www.xen.org/"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| /* end confdefs.h.  */
| #include <Python.h>
configure:6383: result: no
configure:6383: checking for Python.h
configure:6383: result: no
configure:6387: error: Unable to find Python development headers


I will investigate on my own.

EDIT 3 : After some search, -OPT:Olimit=0 seems not to be a gcc option. Would it be the cause of the problem? Clang would ignore it while gcc fails thinking it is an optimization option (-Ox)?


Last edited by lefta on Tue Feb 25, 2014 4:21 pm; edited 1 time in total
Back to top
View user's profile Send private message
Maitreya
Apprentice
Apprentice


Joined: 11 Jan 2006
Posts: 190

PostPosted: Tue Feb 25, 2014 4:19 pm    Post subject: Reply with quote

It's this :
Code:

-OPT:Olimit=0


Part that confuses GCC
Back to top
View user's profile Send private message
lefta
n00b
n00b


Joined: 29 Apr 2011
Posts: 17

PostPosted: Tue Feb 25, 2014 4:24 pm    Post subject: Reply with quote

Just edited to ask this question. I was too slow...

That is what I thought, so now, the big question is : what is passing this @&g?k§ option and how can I get rid of this?
It seems to appear like magic :
Code:
# grep -rn '\-OPT\:Olimit' .
./work/xen-4.3.2/tools/config.log:266:configure:6383: gcc -c -march=x86-64 -O2 -fomit-frame-pointer -march=x86-64 -O2 -fomit-frame-pointer -I/usr/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing -OPT:Olimit=0 -march=x86-64 -O2 -fomit-frame-pointer -fwrapv -DNDEBUG conftest.c >&5
./work/xen-4.3.2/tools/config.log:324:configure:6383: gcc -E -march=x86-64 -O2 -fomit-frame-pointer -I/usr/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing -OPT:Olimit=0 -march=x86-64 -O2 -fomit-frame-pointer -fwrapv -DNDEBUG conftest.c
./work/xen-4.3.2/tools/config.log:473:CPPFLAGS='-march=x86-64 -O2 -fomit-frame-pointer -I/usr/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing -OPT:Olimit=0 -march=x86-64 -O2 -fomit-frame-pointer -fwrapv -DNDEBUG'


EDIT : found the culprit :
Code:
# python-config --cflags
-I/usr/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing -OPT:Olimit=0 -march=x86-64 -O2 -fomit-frame-pointer -fwrapv -DNDEBUG

Now where does it take its flags? How can I edit them?

EDIT 2 : Answer here : http://www.freebsd.org/cgi/query-pr.cgi?pr=182952. For short, when building python with clang (like in my case), -OPT:Olimit is wrongly detected as a supported option. Clang ignores the flag, but if a software requires gcc, like xen-tools, the GNU compiler will fail on the flag.
I will try the patch and report back. If my test is successful, maybe could it be added to python ebuild?

EDIT 3 : Fixed. Here is a patch : http://pastebin.com/AJmgsK4J

Thanks to those who helped or even tried to help me :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum