(Many thanks to Primrose Mbanefo for this contribution)
A word of caution: As the title suggests, I was incapable of completing the procedure. I can only hope that this document will help someone get passed the first steps and complete the procedure.
(Note from the author of Pinapa: Up to now, no one has ever been able to compile Pinapa on a windows platform. It works on Linux, there are some known solvable but unsolved portability issues with the way Pinapa uses dlopen for Solaris, and it is not known to work at all on the Windows platform.)
- Windows XP Home
- MingW package downloaded as a package of Dev-C++
- Msys
Pinapa as an installed tool
The only rule: never give any relative paths!
STEPS: All steps which were not explicitly tested but suspected to work are marked in italic. What can cause errors if not done but can easily be overlooked is <u>underlined</u>. Unfortunately every step here is important for you to at least get gcc and systemc to compile& Changes to make to files are diff ed in bold.
Get and take an anti-depressant. I was being silly when I forgot to do this
Let the example install directory be /c/work.
- Download, untar and unzip pinapa and all pinapa patches
- This step can be different depending on your setup.
- If you are not behind a firewall change the wget commands to cp in the build.sh script using find/replace in any editor.
- Just download, unzip and untar the gcc-core, gcc- g++, and systemc tarballs <u>to the same root directory. </u>E.G: /c/work. Gcc is now in /c/work/gcc-3.4.1 and systemc in /c/work/systemc2.0.1
Obsolete.
Verify that your current mingw gcc installation is 3.4.x. Just run g++ --version. If not update or you ll have a hard time convincing
pinapa you will use 3.4 once it is compiled
- Go into pinapa/make/gcc.mk.in and add in gcc-configure the configure options: --with-gnu-as --with-gnu-ld --enable-threads=win32 --disable-win32-registry --disable-werror --disable-nls
- What follows is what I did since I didn t know what was going wrong. But the above should work and give the best results.. Run
./build.sh ext-dir /c/work <u>--lazy</u>
This is going to crash during gcc compilation but at least it will create pinapa s implicitly used directories. You can now go to the gcc directory and run ./configure with above options as well as the following:
--prefix=/c/work/gcc-3.4.1/<u>target</u> --enable-languages=c,c++
--enable-checking
Make sure you have
/usr/include on your system. If not: add the necessary line to your /etc/fstab. If you don't have one, copy the /etc/fstab.example to /etc/fstab and edit the file to suit your needs. For me this was:
C:/Program Files/Dev-C++/include _space_ /usr/include and don t forget to <u>create the include directory</u> in the Msys directory.
If not gcc-make will crash with system files not found in /usr/include or something like that.
if you did step five.2, run the ./configure of gcc.
if not run
./build.sh ext-dir /c/work lazy --action preconfig
And then ./configure for pinapa. That should create the target directory used by pinapa in the gcc3.4.1 directory as well as initialise other pinapa internals.
Make sure /c/work/gcc-3.4.1/target exists. If you followed up to here it should. Copy the lib and include directories of your MingW install to the target directory of gcc compilation. The target should now have: /c/work/gcc-3.4.1/target/lib and /c/work/gcc-3.4.1/target/include.
If you can make a Makefile out of the instructions in gcc.mk.in and then run make on it, good for you. If you ask me the best bet is to modify ./build.sh and remove the make-gcc-configure and run it with the ext-dir and lazy options so that it runs its own gcc make and creates the gcc libraries for you and maybe even does more without crushing you configure options! If not your stuck with the normal make& but it should work like a dream. If you get the error stdio.h missing or any other thing like that then you missed step eight.
Don't forget to create a gcc library if you run a normal make. Look at the gcc-fulllib in gcc.mk.in to find out how to make the library and in which directory to put it. A quick-strap of .o o /c/work/gcc- 3.4.1/objs/libfullgcc.so linked later on in /c/work/gcc-3.4.1/libs seems to do the trick
Gcc has compiled? Good for you! If not take more aspirins and go over this document again and find out which steps you missed. Check the configure line for gcc and make sure the
pinapa gcc configure wasn t run after it. Check that your lib and include directories are where
pinapa says the target directory should be. And finally make sure you didn t misspell any directory names.
I don't really know if this works!!! But it is most likely the most intelligent of all the options. The thing is you need to link systemc s objects carefully, so that pinapa can load them later. This means the linking command should have a libtool mode= link somewhere in the systemc-2.0.1/objs/src/makefile. You can try changing
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
to
LINK = libtool mode= link $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
If this works, God bless you for trying. If you know why it doesn t work, please delete the above and if you can add something that does work
Time to get cracking with the systemc part. Now this should be a breeze normally since the
pinapa config and make files are good players but the systemc files themselves are not! I ve never been able to compile them on windows/gcc without having to explicitly state the casts and all what not in the systemc sources itself. All I can advise here is keep running ./build.sh ext-dir /c/work lazy action=systemc and correcting what ever errors you get in the systemc
source files until it compiles.
Seperating the men from the boys. You ve finally made it, gcc and systemc have compiled for pinapa! That was the easy part. Now it s time to play ball. With the lazy switch
pinapa knows you ve already compiled gcc and systemc so he s going to head for make. Pinapa compilation is going to crash quite a few times because a certain tree_check_failed is not found. Somethings wrong with msys includes here I guess. Didn t have the time to ask around. Hope someone else will find out. The quick fix is going to the
tree.h file in
/c/work/gcc-3.4.1/objs finding the definition and adding it either to every file in
pinapa that causes an error or to one of
pinapa s h files. Don t remember which exactly. Now things get fishy& You ll get the dlfcn.h - file not found . There is a dlfcn.h for people who don t have one :
http://www.opensource.apple.com/darwinsource/10.3.9/tcl-14/tcl/compat/dlfcn.h Remember the word of caution. I only got you to compile, gcc and systemc. This might let you compile
pinapa but I m not sure the end result is stable. Copy the given
dlfcn.h to
/c/work/gcc-3.4.1/obj/gcc where
pinapa will find it
The build file will now finally almost complete but will stop at linking if you did not find a fix for the link problem described in step eleven biss. This is how far I can take you on this journey. Like Moses, I died off somewhere near the promised land orput in other terms, I just didn t have enough aspirins to finish the race. :D Ok ladies and gentlemen, I wish you luck and I hope there ll be lot s of you doing verification and other stuff on systemc! Primrose