I’m having to use SystemC for a project involving simulation of Network-On-Chip applications. Turned out that it didn’t quite compile cleanly on my GNU/Linux machine:

sc_process_int.cpp: In member function
  'virtual void sc_core::sc_thread_process::prepare_for_simulation()':
sc_process_int.cpp:441: error:
  'sc_thread_cor_fn' was not declared in this scope
sc_process_int.cpp: In member function
  'virtual void sc_core::sc_cthread_process::prepare_for_simulation()':
sc_process_int.cpp:630: error:
  'sc_cthread_cor_fn' was not declared in this scope

My friend pointed me to a patch for this, which I later modified slightly. Turns out that GCC4 is a bit more stricter about friend functions than its old counterpart.

That problem solved, I went on to compiling SystemC on the Mac. My Macbook Pro has an Intel processor so it shouldn’t have been much trouble. Needless to say, configure couldn’t even detect the build type:

checking build system type...
  configure: error: cannot guess build type; you must specify one

And after specifying one explicitely:

$ ./configure --build=i386-pc-macosx
configure: error: "sorry...architecture not supported"

Not a problem. After adding a case…esac block to configure.in (setting the CXXFLAGS etc. to the the same as the case for linux), we were up and running!

In summary, here’s what you have to do after grabbing the SystemC sources (requires registration and acceptance of license):

$ tar xvzf systemc-2.1.v1.tgz
$ cd systemc-2.1.v1
$ wget http://proness.kix.in/misc/patch_systemc-2.1.v1-gcc4-osx
$ patch -p0 < patch_systemc-2.1.v1-gcc4-osx

Those of you trying to compile SystemC on GNU/Linux with GCC4 do the same; but leave out the build argument to the configure statement.