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:

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

all:
 g++ $(CXXFLAGS) *.cpp $(LDFLAGS)
 ./a.out

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!

2 comments:

  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

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

    ReplyDelete