TODO: Convert to MediaWiki syntax
Prerequisites
- working MSYS build environment, see HOWTO Create an MSYS Build Environment.
Configure and make
The MSYS build process is designed to be run in separate build directory. MSYS source root is msys/rt/src (this is where ${PATH_TO_MSYS_SRC} bellow should point).
Build is done from within empty build directory in the MSYS build environment executing:
W32API_LIB=/lib/w32api
W32API_INC=/include/w32api
OPTFL="-fno-unit-at-a-time"
export CFLAGS="-O3 -g ${OPTFL}"
export LDFLAGS="-L${W32API_LIB}"
export CXXFLAGS="-O3 -g ${OPTFL}"
export CPPFLAGS="-I${W32API_INC}"
export W32API_LDFLAGS="-L${W32API_LIB}"
export W32API_CPPFLAGS="-I${W32API_INC}"
${PATH_TO_MSYS_SRC}/configure && make
Troubleshooting
- 'mingw32-gcc: command not found' or 'mingw32-g++: command not found' or : If this happens then the configure went wrong, and the files in the ./winsup/utils are trying to be built. Do the following so that configure doesn't try to use mingw32-gcc/mingw32-g++:
# 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 !
- 'configure: error: ./configure failed for cygwin': you configured in the source directory, something that you shouldn't have done. Run a 'make distclean' and read the section above about how to configure correctly.
- make just outputs :
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, enter MSYS (the window title should read "MSYS:some path")
Debugging, Tracing, etc
Building a debuggable MSYS dynamic library
When debugging it is often usefull to not optimize the binary output as optimization tends to change the debugging information. Add "-O0 -g -fnative-struct -DDEBUGGING=1 -DTRACING=1" to OPTFL variable above and rerun.
Installing debug version of library
Easiest way to test debug version of msys-1.0.dll is to copy MSYS instalation (default C:\msys\1.0) elsewhere and replace msys-1.0.dll with the one just built.
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 <nowiki>1.0.11</nowiki> 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.


Recent comments
2 years 16 weeks ago
2 years 16 weeks ago
2 years 49 weeks ago
2 years 49 weeks ago
2 years 49 weeks ago
2 years 49 weeks ago
2 years 49 weeks ago
2 years 49 weeks ago
2 years 50 weeks ago
3 years 5 weeks ago