Building PDBExtract on Microsoft Windows

Date: 20th July 2005

This is work in progress.

Using Cygwin

The following instructions were provided to me by Vladimir Guranovic.

Prerequisites

  1. Microsoft Windows 2000 or Microsoft Windows XP
  2. Cygwin
  3. gcc 3.x and other tools

Installation procedure for Cygwin

  1. Go to http://www.cygwin.com/ and click on "Install or update now!"
  2. Cygwin Net Release Setup Program dialog box appears.
  3. Click Next.
  4. Click Install from Internet
  5. Select root directory, e.g. c:\cygwin
  6. Select installation for all users
  7. Select Default Text File Type to be "Unix" (this is because the PDB software works best with UNIX ASCII file types).
  8. Click Next.
  9. Select Direct Connection
  10. Select Download Site close to your country.
  11. The packages selection window appears. Here leave the default settings for packages and just add gcc 3.x/g++3.x compilers, "make", "flex" and "bison" from the "Devel" package. All these tools are needed for building PDB applications.
  12. Important: There is a known bug with the "cp" UNIX command in "fileutils" version 4.1-2 which will prevent the PDB software from being built. Check the version being installed - see the Know Bugs section below.
  13. Finish the installation.

PDB Applications Preparation/Utilisation

  1. Download the source code from the PDB website: http://sw-tools.pdb.org/apps/PDB_EXTRACT/index.html
  2. Open a Cygwin shell
  3. Prepare and build the source and run it in the Cygwin shell, as per the given instructions on the PDB website: http://sw-tools.pdb.org/apps/PDB_EXTRACT/README-source

Known Problems

  1. Error from cp when building PDB applications

    This is an error of the form:

    cp ./bin/connect ./../bin/.
    cp: `./bin/connect' and `./../bin/./connect' are the same file
    make[1]: *** [install] Error 1
    make[1]: Leaving directory `/vlad-test/pdb-extract-v1.5-prod/connect-v2.2'
    make: *** [compile] Error 1
    

    The problem is with the version of /usr/bin/cp.exe, and occurs when version 4.1-2 of the "fileutils" package has been installed.

    To fix the problem, go to the Cygwin installation and in Packages selection, select "Base". Under "Base", find the "fileutils" package and check the version to be installed. If version 4.1-2 is selected then change it to either an earlier version (4.1-1) or a later one. It appears that this is fixed in later versions of "fileutils".

  2. Using the Cygwin version from within CCP4i

    My cursory attempts to do this failed, presumably because it isn't possible to run the Cygwin compiled applications from outside of the Cygwin environment:

    This application has failed to start because cygwin1.dll was not
    found. Re-installing the application may fix this problem.
    

    This is indicative of a wider problem - that the Cygwin-compiled executables require the Cygwin DLLs in order to run.

Trying to make standalone executables

To do this it is essentially necessary to build executables which do not depend on the Cygwin DLLs.

I considered a number of possible approaches:

None of these were successful. Below I describe what I did, and the problems that I encountered for each.

Using -mno-cygwin

This is an option available for the Cygwin compilers, which prevents the executables being linked against the GNU libraries in Cygwin - instead they are linked against the MinGW libraries which are provided as part of the Cygwin distribution.

I used notes from http://www.delorie.com/howto/cygwin/mno-cygwin-howto.html which outline what needs to be done, as well as the problems that I encountered.

Essentially, only basic C headers and libraries are provided by default, so there are problems with C++ and Fortran applications. The PDB applications fail to built using this flag, complaining about a missing pwd.h file. It transpires that pwd.h is not part of the ANSI standard, and it doesn't appear that a MinGW version exists at present within Cygwin.

Using MinGW directly

MinGW is "Minialistic GNU for Windows" - see http://mingw.org

I got my initial download from http://nuwen.net/mingw.html and followed the instructions for setting up to work in the DOS environment. It is also possible to use MinGW under Cygwin, by adding the MinGW bin to your path ahead of Cygwin so that the MinGW tools (compilers etc) are used in preference to the Cygwin ones.

This approach has essentially the same problems as described for the -mno-cygwin option above, i.e. the required headers and libraries are not available.

Using the Microsoft Visual C++ Toolkit 2003

This was suggested by someone on ccp4-dev but failed from the outset because I was unable to install on my laptop. This approach might work if the compilers can be installed.

The installation instructions that I was given can be found at:

The home page for these compilers can be found at Microsoft Visual C++ Developer Center: