Menu

DevelopmentEnvironment

Christoph Schwarz

How to set up the development environment

Current development environment consists of:

  • Eclipse Juno
  • MinGW 20120426 (gcc 4.6.2)
  • TDM-GCC 4.6.1
  • Windows SDK for Windows 7 and .NET Framework 4

Required

Valgrind for Windows uses the MinGW build environment. You need to download and install MinGW and the Microsoft Debugging Tools for Windows.

  1. MinGW -- download the latest Automated MinGW installer
    • Install:
    • MinGW Compiler Suite / C Compiler (gcc 4.6.2)
    • MSYS Basic System
    • MinGW Developer Toolkit
    • add environment variable MINGW_ROOT pointing to the directory where you installed MinGW
    • add %MINGW_ROOT%\bin;%MINGW_ROOT%\msys\1.0\bin to the PATH
  2. Debugging Tools for Windows and MSVC from the Windows SDK for Windows 7 and .NET Framework 4 -- choose either:
    • Net Installer
    • ISO Image
    • Install at least: Windows Native Code Development and Common Utilities / Debugging Tools for Windows
    • add environment variable DBGTOOLS_ROOT pointing to the directory where you installed the debugging tools (e.g. C:\Program Files\Debugging Tools for Windows (x64))
    • add environment variable WINSDK_ROOT pointing to the directory where you installed the Windows SDK (e.g. C:\Program Files\Microsoft SDKs\Windows\v7.1)
    • add environment variable VC_ROOT pointing to the directory where you installed the Visual C++ compilers (e.g. C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC)
    • create directory %MINGW_ROOT%\msys\1.0\opt\windbg
    • add debugging tools path in 8.3 format as /opt/windbg in MinGW's fstab file %MINGW_ROOT%\msys\1.0\etc\fstab
    • entry in fstab might look like this: C:\PROGRA~1\DEBUGG~1 /opt/windbg
    • recommended: add environment variable _NT_SYMBOL_PATH=SRV*%TEMP%\SymbolCache*\http://msdl.microsoft.com/download/symbols

Optional

If you want to build Valgrind for 64 bit Windows, download and install a 64 bit tool chain, either:

  1. (recommended) TDM-GCC -- download tdm64-gcc-4.6.1 installer from SourceForge, e.g. tdm64-gcc-4.6.1.exe (gcc 4.6.1)
    • unpack to a directory of your choice, e.g. C:\MinGW64
    • add environment variable MINGW64_ROOT pointing to that directory
    • add %MINGW64_ROOT%\bin to the PATH, before %MINGW_ROOT%\bin
    • with this tool chain you can create both 32 and 64 bit binaries, so you can build Valgrind in those two bitnesses from the same configuration

or

  1. (obsolete) MinGW64 -- download latest 64 bit tool chain from Automated Builds, e.g. mingw-w64-bin_i686-mingw_20110827.zip (gcc 4.7.0)
    • unpack to a directory of your choice, e.g. C:\MinGW64
    • add environment variable MINGW64_ROOT pointing to that directory
    • add %MINGW64_ROOT%\bin to the PATH
    • with this tool chain you can only create 64 bit binaries, so you can either build 32 bit or 64 bit Valgrind (but not both), from the same configuration

The project comes with a Eclipse CDT project definition, so you can use the Eclipse IDE if you like. To do so:

  1. optional: create environment variable VG4WIN_MAKEOPTS containing additional options to make. If you have a multi-core machine you probably want to enable parallel builds, e.g. VG4WIN_MAKEOPTS=-j4
  2. Install Eclipse IDE for C/C++ developers (the version stated above)
  3. Start Eclipse, open "Help / Install new Software"
  4. Select: "Work with : <Eclipse Version="" Name="">"
  5. Install: "Collaboration / Subversive SVN Team Provider (Incubation)" (Eclipse restarts)
  6. Open Perspective "SVN Repository Exploring"
  7. Pop up appears asking for installation of an SVN Connector. Install latest 1.3.x SVNKit (1.3.7) (Eclipse restarts)
  8. Uncheck "Project / Build Automatically"
  9. Open Perspective "SVN Repository Exploring"
  10. Add "New" / "Repository Location..." svn://svn.code.sf.net/p/valgrind4win/code (or if you are a developer with write access: svn+ssh://svn.code.sf.net/p/valgrind4win/code)
  11. Check out "trunk"
  12. Switch to "C/C++" perspective
  13. Select desired configuration under "Project" / "Build Configurations" / "Set Active"
    • only 32 bit: "build32-all"
    • only 64 bit: "build64-all"
    • 32 and 64 bit: "build32+64-all" (TDM-GCC required)
  14. Select "Project" / "Build Project"
    • Eclipse will build Valgrind for Windows by running ./autogen.sh, ./configure and make

How to build and run Valgrind for Windows from a command prompt

  1. Check out the source code
  2. Open a Windows command prompt (cmd.exe)
  3. cd to the source code directory
  4. run: sh ./autogen.sh
  5. configure either for the 32 bit or 64 bit version
    • only 32 bit: run: sh ./configure
    • only 64 bit: run: sh ./configure --host x86_64-w64-mingw32 --enable-only64bit
    • 32 and 64 bit: run: sh ./configure --host x86_64-w64-mingw32 (TDM-GCC required)
  6. build the source by running: make
  7. build tests by running: make check
  8. run valgrind using: set VALGRIND_LIB=.in_place and then: coregrind\valgrind.exe

Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.