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
> gem5-us...@gem5.org
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
> 

-- 
+-------------------------------------------------------------+
| Pierre-Yves Péneau - PhD student |  first.last at lirmm.fr  |
| LIRMM / CNRS - SYSMIC team       |    + 33 4 67 41 86 33    |
| Building 4 Office H2.2           |    http://walafc0.org    |
+-------------------------------------------------------------+

_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to