Thursday, November 3, 2011

GCC 4.6 breaks SystemC

When upgrading to Ubuntu 11.10, SystemC programs won't work anymore.
Update your makefiles to include the -fpermissive flag, like so:

LDFLAGS= -L$(SYSTEMC)/lib-linux -lsystemc
CXXFLAGS=-Wno-deprecated -I$(SYSTEMC)/include -fpermissive

 g++ $(CXXFLAGS) *.cpp $(LDFLAGS)

You may need to recompile the SystemC library, which case the flag must be added to the configure command:

$ sudo ../configure --prefix=/usr/local/systemc CPPFLAGS=-fpermissive

By giving the syntax above, I also managed to get SystemC running in Fedora. Goodbye Ubuntu!


  1. Using linux 64 bits also gives you some problems. If you get the following error code:

    /usr/bin/ld: cannot find -lsystemc
    collect2: ld returned 1 exit status

    you need to use:
    g++ -I. -I$SYSTEMC/include -L. -L$SYSTEMC/lib-linux64 -o OUTFILE INPUT.cpp -lsystemc -lm

  2. Thanks for the tip, although I don't use linux 64 bits. Not yet, anyway.