http://www.mingw.org
The advantage of MinGW is that it is between Micrsoft Visual C and Cygwin in that MinGW can link to most MSVC .lib files. It is sometimes easier to port multithreaded programs to MinGW before porting to either MSVC or Cygwin.
In December 2004, Christoph Grimm posted to
In December, 2003, we used MinGW 3.1.0
to compile the producers_consumer example.
Below is how we did it
https://www.systemc.org/mailman/archives/systemc-forum/2004/001766.html
:
Instead of cygwin, you could also use dev-cpp (mingw),
which provides a nice, graphical development environment.
We use this IDE especially for students, because it allows
them to start SystemC without having to set paths, etc.
However, you will have to use fiber threads, because there
is no unix-runtime environment in mingw, which can be
configured by some defines.
I attached some notes that document some changes I made
for compiling SystemC under DevCPP/mingw, and the project
file.
We compiled quite complex systems without problems
with this configuration.
Installing MinGW
http://www.mingw.org/download.shtml
. We downloaded
MinGW-3.1.0-1.exe
c:\mingw
Compiling SystemC with MinGW
patch
binary by rerunning Cygwin
setup.
http://www.systemc.org/tracker/index.php?func=detail&aid=83&group_id=5&atid=107
I had to strip out the Control-M characters using emacs.
patch -p 1 < c:/tmp/downloads/systemc-mingwin-patch-2
bash-2.05b$ PATH=/cygdrive/c/mingw/bin:${PATH}
bash-2.05b$ export PATH
bash-2.05b$ which gcc
/cygdrive/c/mingw/bin/gcc
bash-2.05b$ gcc -v
Reading specs from c:/mingw/bin/../lib/gcc-lib/mingw32/3.2.3/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c++,f77,objc --disable-win32-registry --disable-shared --enable-sjlj-exceptions
Thread model: win32
gcc version 3.2.3 (mingw special 20030504-1)
bash-2.05b$
make -f Makefile.MinGW
Makefile.MinGW:143: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.
I had to edit the Makefile.MinGW path add trailing \ to a bunch of lines
make -f Makefile.MinGW
again
g++ src/systemc/kernel/sc_cor_fiber.cpp
src/systemc/kernel/sc_cor_fiber.cpp: In destructor `virtual
sc_cor_fiber::~sc_cor_fiber()':
src/systemc/kernel/sc_cor_fiber.cpp:63: `GetCurrentFiber' undeclared (first use this function)
The problem is that
c:/mingw/include/winnt.h
includes decls for GetCurrentFibre
Solution: edit src/systemc/kernel/sc_cor_fiber.cpp
and add
#ifdef __MINGW32__
#include
make -f Makefile.MinGW
,
and libsystemc.a
should be created.
mkdir lib-mingw
mv *.a lib-mingw
Build Metropolis
$METRO/src/metropolis/metamodel/backends/systemc
requires getrusage()
which is not usually part of Windows.
To compile port_rusage.cpp
under MSVC, you must download
psapi.h
and psapi.lib
. To run, you probably
need psapi.dll
.
The easiest way to obtain these files is to look for them on the web
using Google.
psapi.h
and psapi.lib
should be placed in
$METRO/src/metropolis/metamodel/backends/systemc
.
psapi.dll
should be placed in your C:\Windows
directory.
--with-systemc
to include the MinGW version of SystemC. I used:
PATH=/cygdrive/c/mingw/bin:${PATH}
export PATH
cd $METRO
rm config.*; ./configure --with-systemc=c:/cxh/src/systemc-2.0.1-mingw --with-systemc-lib=lib-mingw
make LIBS=-lpsapi CXX_USERFLAGS="-mthreads -mms-bitfields -MMD"
If you do not use the proper flags, then when you try to link
the producers_consumer example, you might see:
c:/cxh/src/metro/src/metropolis/metamodel/backends/systemc/liblibrary.a(global.o)(.rdata$_ZTI15sc_signal_in_ifIN5sc_dt8sc_logicEE+0x0): In function `ZThn4_NK9sc_signalIN5sc_dt8sc_logicEE4dumpERSo':
c:/cxh/src/systemc-2.0.1-mingw/include/systemc/datatypes/bit/sc_logic.h: multiple definition of `typeinfo for sc_signal_in_if