Wednesday, May 10, 2017

Compiling SystemC-2.2.0 with newer versions of GCC

When trying to make SystemC-2.2 with newer (post 4.7?) versions of GCC, the process fails with the following error:

In file included from ../../../src/sysc/datatypes/bit/sc_bv_base.h:47:0,
                 from ../../../src/sysc/datatypes/bit/sc_lv_base.h:50,
                 from sc_signal.cpp:95:
../../../src/sysc/datatypes/bit/sc_bit_proxies.h:698:16: error: reference ‘m_obj’ cannot be declared ‘mutable’ [-fpermissive]
     mutable X& m_obj;
                ^
../../../src/sysc/datatypes/bit/sc_bit_proxies.h:1175:18: error: reference ‘m_left’ cannot be declared ‘mutable’ [-fpermissive]
     mutable X&   m_left;
                  ^
../../../src/sysc/datatypes/bit/sc_bit_proxies.h:1176:18: error: reference ‘m_right’ cannot be declared ‘mutable’ [-fpermissive]
     mutable Y&   m_right;
                  ^
../../../src/sysc/datatypes/bit/sc_bit_proxies.h:1178:18: error: reference ‘m_refs’ cannot be declared ‘mutable’ [-fpermissive]
     mutable int& m_refs;

The error is caused by the increasingly strict parser in GCC; syntax that used to be OK is now failing to compile.

To fix the issue simply set the EXTRA_CXXFLAGS environment variable to -fpermissive, then configure again with ./configure, then recompile with make.

No comments:

Post a Comment