SystemC under Cygwin

Last updated: 25/11/07

This page gives a brief overview on how to install SystemC 2.2 on Window's Cygwin (1.5.24).

Installing Cygwin

Hop over to cygwin's website and follow the installation procedure. I would recommend to do a full installation

Installing SystemC

SystemC's class library and event based simulator can be downloaded from the SystemC.org website. You need to create a login before you can download the files.

I used the following procedure to install it:

  1. Download systemc-2.2.0.tgz and write to a suitable location
  2. Unzip the file using tar zxvf systemc-2.2.0.tgz
  3. Navigate to the systemc-2.2.0 directory
  4. Create a subdirectory as per the INSTALL file called objdir
  5. Navigate to the objdir directory
  6. create the destination directory mkdir /usr/local/systemc-2.2
  7. Execute ../configure --prefix=/usr/local/systemc-2.2
  8. Modify the default stack size SC_DEFAULT_STACK_SIZE which you can find in <your_dir>/systemc-2.2.0/src/sysc/kernel/sc_constants.h from 0x10000 to 0x50000

Line 57: const int SC_DEFAULT_STACK_SIZE   = 0x50000;

  1. Build systemc using make pthreads
  2. Install systemc using make install
  3. Check the installation using make pthreads_check, you might get the following error:

/usr/local/systemc-2.2/include/systemc.h:175: error: `std::wctomb' has not been declared
/usr/local/systemc-2.2/include/systemc.h:177: error: `std::wcstombs' has not been declared

  1. If this is the case then open /usr/local/systemc-2.2/include/systemc.h and commend out the 2 lines as shown below:

Line 175: //    using std::wctomb;
Line 176:        using std::mbstowcs;
Line 177: //    using std::wcstombs;

  1. re-run make pthreads_check and all tests should pass

Installing SCV Library

Unfortunately I have not been able to make this work! Please let me know if you know how to do this.

The information below might kick-start those that want to have a go at it, but as I mentioned before the end result is something that does not work!

  1. Download the latest scv library from www.systemc.org
  2. untar the library

tar xvf scv-1.0p2-sysc2.2.12jun06.tgz

  1. Navigate to the scv-1.0p2-sysc2.2 directory and create a new objdir directory.

$ cd scv-1.0p2-sysc2.2
$ mkdir objdir

  1. Open the configure file in an editor and change the following lines (changed shown in teal color)

3649: case "$target_os" in
3650: solaris2.5*|solaris2.6|solaris2.7|solaris2.8|hpux11*|linux-gnu|cygwin)

  1. Follow the advice in the INSTALL text file
     2a.For gcc 3.4.x and 4.x.x. minor changes are required to the configure file:
         Line 5642:  replace "#include <strstream.h>" with "#include <sstream>"
         Line 5654:  replace "ostrstream outString(buf,STRING_SIZE);" with
                     "std::ostringstream outString;"

5642: #include <sstream>
5654: ostringstream outString; //(buf, STRING_SIZE);

5757: $CXX t1conftest.cc $scvCXXopts -o libtest.dll $scvLinkerOpts 2>&5
5793: rm test.sh t*conftest.cc libtest.dll test.exe

  1. Next from the objdir execute configure as follows:

../configure --with-systemc=/usr/local/systemc-2.2/ --prefix=/usr/local/scv --disable-compiler-check

  1. After running configure edit the conf.h file as described in the INSTALL text file
    5a.For gcc 3.4.x and 4.x.x. an edit is required to the generated config.h file:
         Line 44: comment-out line, i.e. change to "//#define _USE_HASH_MAP

44: //#define _USE_HASH_MAP

  1. Open the file ../scv-1.0p2-sysc2.2/src/scv/scv_init_seed.cpp and add the following include file

41: #include <sys/time.h>

  1. Run gmake
  2. Run gmake install

 

Using the above procedure it seems to build OK but when you try to compile any of the examples you get lots and lots of errors during linking :-(

$ g++ test.cc -I /usr/local/systemc-2.2/include/ -I /usr/local/scv/include/ -L /usr/local/systemc-2.2/lib-cygwin/ -lsystemc -L /usr/local/scv/lib-cygwin/ -lscv
In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/iomanip.h:31,
                 from test.cc:6:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiqu
ated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header f
or the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
/usr/local/scv/lib-cygwin//libscv.a(scv_introspection.o): In function `__tcf_1':
/usr/local/systemc-2.2/include/sysc/datatypes/misc/sc_value_base.h:80: undefined reference to `vtable for sc_dt::sc_value_base'
/usr/local/scv/lib-cygwin//libscv.a(scv_introspection.o): In function `__tcf_2':
/usr/local/systemc-2.2/include/sysc/datatypes/misc/sc_value_base.h:80: undefined reference to `vtable for sc_dt::sc_value_base'
/usr/local/scv/lib-cygwin//libscv.a(scv_introspection.o): In function `__tcf_3':
/usr/local/systemc-2.2/include/sysc/datatypes/misc/sc_value_base.h:80: undefined reference to `vtable for sc_dt::sc_value_base'