Search code examples
fedoraclanggcc4systemc

Installing SystemC 2.2.0, compilation with GCC 4.6 and package for Fedora


How to install SystemC on Fedora 15?

Problems:

  • no RPM package (licensing problems)
  • does not compile with 4.6
  • even with -fpermissive (clang doesn't compile your modules)

Solution

  • There is extremely useful and well writen blog post by Chitlesh Goorah, please read it first.

    Then what reminds is how to compile SystemC library with GCC 4.6. You can add -fpermissive, but I strongly advice against it.

    Instead there are 4 lines of code that needs to be changed, here is the patch:

    --- src/sysc/datatypes/bit/sc_bit_proxies.h 2007-03-14 17:47:49.000000000 +0000
    +++ src/sysc/datatypes/bit/sc_bit_proxies.h.mod 2011-09-02 13:53:34.318379140 +0000
    @@ -713,7 +713,7 @@
    
     protected:
    
    -    mutable X& m_obj;
    +    X&         m_obj;
         int        m_hi;
         int        m_lo;
         int        m_len;
    @@ -1190,10 +1190,10 @@
    
     protected:
    
    -    mutable X&   m_left;
    -    mutable Y&   m_right;
    +            X&   m_left;
    +            Y&   m_right;
         mutable int  m_delete;
    -    mutable int& m_refs;
    +            int& m_refs;
    

    As a bonus, changes above make this header to work with Clang (tested with 3.0).