An incomplete guide on compiling Pinapa with MingW/Msys

(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.)

The test system

Target configuration

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.

Step one

Get and take an anti-depressant. I was being silly when I forgot to do this

Step two

Let the example install directory be /c/work.

Step three

Obsolete.

Step four

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

Step five

  --prefix=/c/work/gcc-3.4.1/<u>target</u> --enable-languages=c,c++
  --enable-checking
  

Step six

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.

Step seven

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.

Step eight

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.

Step nine

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

Step ten

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.

Step eleven biss

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

Step eleven

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.

Step Twelve

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

Step Twelve biss

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
Generated by
Matthieu Moy <Matthieu.Moy@st.com>
Back to Pinapa Home Page