Minimalist GNU for Windows

Build MSYS

Prerequisites:

  1. The MSYS binary release from the Current package or alternatively the Snapshot package.
  2. The msysDTK binary release from the Current package.
  3. The msysDVLPR binary release from the Snapshot package.
  4. The wincon.h file from a recent version of the w32api package.

Installation:

The MSYS release and the msysDTK release are packaged into a Windows style installer. Execute the binaries and make sure to use the same directory for the installation of both packages. You will need to untar the msysDVLPR package in the /usr directory. Then replace the /usr/include/wincon.h file with a newer version. Here are the steps:

  1. Execute the MSYS installation package.
  2. Execute the msysDTK installation package.
  3. Then, type:
$ cd /usr
$ tar -zxvf msysDVLPR-1.0.0-alpha-1.tar.gz
$ cp /mingw/include/wincon.h /usr/include/

Alternative Installation:

With version 1.0.11 of MSYS and greater you may now put the MinGW binaries in /usr/bin. If you do this then when you install msysDVLPR you will need to:

$ mkdir /msys
$ cd /msys
$ tar -zxvf msysDVLPR-1.0.0-alpha-1.tar.gz
$ cp /mingw/include/wincon.h /msys/include/
$ SPECFILE=/msys/bin/../lib/gcc-lib/i686-pc-msys/2.95.3-1/specs
$ mv ${SPECFILE} ${SPECFILE}.orig
$ sed 's|/usr|/msys|g' < ${SPECFILE}.orig > ${SPECFILE}

Modify your ~/.profile similar to:

if [ $MSYSTEM == MINGW32 ]; then
  export PATH=".:/usr/local/bin:/bin:$PATH"
else
  export PATH=".:/msys/bin:/usr/local/bin:/bin:$PATH"
fi

Configure and make:

You must first be in the MsysBuildEnvironment; execute msysdvlpr to enter it. The MSYS build process is designed so that you cannot build in the source directory. So, you need to create a separate build directory. I use the msys/rt directory of the source as the parent for my build directory.

$ MSYS_PREFIX=/usr (or /msys, if you used the Alternative Installation)
$ cd msys/rt
$ mkdir bld
$ cd bld
$ ../src/configure --prefix=$MSYS_PREFIX (make sure you use the MsysBuildEnvironment!)
$ make

Troubleshooting:

# make distclean
# $ cat <<_ACEOF >/bin/mingw32-gcc
#> #! /bin/sh
#> echo "command not available"
#> _ACEOF

Rerun configure and make

The other solution is to install MinGW (which contains mingw32-gcc and mingw32-g++). It is preferable to install it in your /mingw directory. Please remember not to install MinGW and MSYS in the same directory !

# make: Entering directory `/src/msys/rt/build/etc'
# make: Nothing to be done for `all'.
# make: Leaving directory `/src/msys/rt/build/etc'

You're probably under MINGW and not MSYS. Type 'msysdvlpr' to enter MSYS. (The caption of the window should read "MSYS:some path")

Debugging, Tracing, etc.

Building a debuggable MSYS dll. When debugging I like to not optimize the binary output as optimization tends to change the debugging information. So I set a variable like so: ``ccflags='-O0 -g -fnative-struct -DDEBUGGING=1 -DTRACING=1''. This will allow the debugging data to relate directly to the line of source being executed.
  1. ccflags='-O0 -g -fnative-struct -DDEBUGGING=1 -DTRACING=1
  2. make clean
  3. make CFLAGS="$ccflags" CXXFLAGS="$ccflags"
Installing the dll full of debugging information. One of the great things about MSYS is that you can have more than one version of the dll running at the same time. For the list below let's assume you have MSYS installed in C:\msys\1.0:
  1. cd /c/msys
  2. cp -a 1.0 debug
  3. cp <top_build_dir>/i686-pc-msys/winsup/cygwin/new-msys-1.0.dll debug/bin/msys-1.0.dll
  4. copy the desktop shortcut and modify the properties to point to the debug/msys.bat
Regression testing Unfortunately I haven't kept up with the dejagnu testing that was already present in Cygwin. One of the reasons is that I'm not setup to execute dejagnu. I do have separate regression tests I use to check the pathing code. I need to add these to the CVS source so that others may use them.
Tracing When you build MSYS a program is created in the <top_build_dir>/i686-pc-msys/winsup/utils directory named strace.exe. Copy this program to the /bin directory, assuming you're debugging the CVS version of MSYS or a 1.0.11 or later release. You can then use strace to see the debugging output from the program. There is a lot of debugging information so be sure to specify an output file. Start the debug session like so, ``strace -o /tmp/strace.out foo. You can use your production version of MSYS to ``tail -f /tmp/strace.out | less to watch the output. You may also use sysinternals dbgview to see the debug output.
Stack walking If you stack dump you will need to determine where in the code you've actually aborted. One of the methods I use is to create an output file of using objdump with the -S and -s switches. I then use gvim to view and find the addresses within the stack frame.

Best of luck and happy hacking. Of importance; don't be shy about adding your tidbits of help. Others will appreciate the knowledge.

PHP Warning

lib/XmlElement.php:43 Warning[2]: get_class() expects parameter 1 to be object, string given (...repeated 9 times)

lib/XmlElement.php (In template 'navbar' < 'top' < 'body' < 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given:

lib/XmlElement.php (In template 'navbar' < 'top' < 'body' < 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given:

lib/XmlElement.php (In template 'browse' < 'body' < 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given

lib/XmlElement.php (In template 'browse' < 'body' < 'html'):43 Warning[2]: get_class() expects parameter 1 to be object, string given

Valid XHTML 1.0! Valid CSS!
Page Execution took real: 0.075, user: 0.050, sys: 0.010 seconds , Memory: 2512240

lib/XmlElement.php (In template 'browse-footer'):43 Warning[2]: get_class() expects parameter 1 to be object, string given

lib/XmlElement.php (In template 'actionbar' < 'browse-footer'):43 Warning[2]: get_class() expects parameter 1 to be object, string given: