Hi Pierre,
I send out an email to the dev list on the 12th of January (Header order
issues) describing a similar issue we have in our CI system. I have an
updated version of the style checker that enforces that Python.h is
included first and plan to post it after lunch.
I would like to avoid including Python.h in header files unless
absolutely necessary. In general, we should try to keep dependencies
within header files as small as possible to avoid wasting time on
recompiling things.
Cheers,
Andreas
On 27/01/17 10:48, Pierre-Yves Péneau wrote:
I think I have found why this is not working. With the new refactoring
script, the header corresponding to the source file must be included
first. But, when Python.h is needed, it also must be included first to
avoid this error.
So, I think there is two workaround:
i) the refactoring script should check if Python.h is needed and if so,
include it first and then include the header file.
ii) move the Python.h inclusion in the header file. The second one is
easier as it does not need to change the refactoring script. It also
sounds better to me.
I tried the second solution and it's working. What do you think ?
On 01/26/2017 06:05 PM, Pierre-Yves Péneau wrote:
Hi all,
I am trying to build the latest gem5 version and I get the error below.
$ scons /var/tmp/gem5-current/build/X86/gem5.fast
[snip]
[ CXX] X86/python/swig/pyevent.cc -> .fo
In file included from /usr/include/python2.7/pyconfig.h:6:0,
from /usr/include/python2.7/Python.h:8,
from /var/tmp/gem5-current/build/X86/sim/init.hh:34,
from
/var/tmp/gem5-current/build/X86/python/swig/pyevent.hh:35,
from
/var/tmp/gem5-current/build/X86/python/swig/pyevent.cc:31:
/usr/include/python2.7/pyconfig-64.h:1182:0: error: "_POSIX_C_SOURCE" redefined
[-Werror]
#define _POSIX_C_SOURCE 200112L
^
In file included from
/usr/include/c++/4.8.2/x86_64-redhat-linux/bits/os_defines.h:39:0,
from
/usr/include/c++/4.8.2/x86_64-redhat-linux/bits/c++config.h:2097,
from /usr/include/c++/4.8.2/utility:68,
from /usr/include/c++/4.8.2/algorithm:60,
from /var/tmp/gem5-current/build/X86/sim/eventq.hh:41,
from
/var/tmp/gem5-current/build/X86/python/swig/pyevent.hh:34,
from
/var/tmp/gem5-current/build/X86/python/swig/pyevent.cc:31:
/usr/include/features.h:168:0: note: this is the location of the previous
definition
# define _POSIX_C_SOURCE 200809L
^
In file included from /usr/include/python2.7/pyconfig.h:6:0,
from /usr/include/python2.7/Python.h:8,
from /var/tmp/gem5-current/build/X86/sim/init.hh:34,
from
/var/tmp/gem5-current/build/X86/python/swig/pyevent.hh:35,
from
/var/tmp/gem5-current/build/X86/python/swig/pyevent.cc:31:
/usr/include/python2.7/pyconfig-64.h:1204:0: error: "_XOPEN_SOURCE" redefined
[-Werror]
#define _XOPEN_SOURCE 600
^
In file included from
/usr/include/c++/4.8.2/x86_64-redhat-linux/bits/os_defines.h:39:0,
from
/usr/include/c++/4.8.2/x86_64-redhat-linux/bits/c++config.h:2097,
from /usr/include/c++/4.8.2/utility:68,
from /usr/include/c++/4.8.2/algorithm:60,
from /var/tmp/gem5-current/build/X86/sim/eventq.hh:41,
from
/var/tmp/gem5-current/build/X86/python/swig/pyevent.hh:34,
from
/var/tmp/gem5-current/build/X86/python/swig/pyevent.cc:31:
/usr/include/features.h:170:0: note: this is the location of the previous
definition
# define _XOPEN_SOURCE 700
^
cc1plus: all warnings being treated as errors
scons: *** [/var/tmp/gem5-current/build/X86/python/swig/pyevent.fo] Error 1
scons: building terminated because of errors.
My last successful build before pulling the changes was in December. I
am using gcc-4.8.5 and python 2.7.5. It seems related to python and
variable redefinition. As far as I know, python 2.7 is supported by
gem5, only python 2.6 has been dropped few months ago. Host is CentOS
7.2. Any idea of what's going on ? Thanks.
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended recipient,
please notify the sender immediately and do not disclose the contents to any
other person, use it for any purpose, or store or copy the information in any
medium. Thank you.
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev