FreeTDS User Guide: A Guide to Installing, Configuring, and Running FreeTDS
Prev | Chapter 2. Build FreeTDS | Next

# OS-specific Issues

## Win32 and Win64

Building for Windows using Microsoft's compiler is supported via the `NMakefile` included in the distribution. Set up the command-line build environment per Microsoft's instructions, and run e.g.

    	$ nmake -fNmakefile -nologo apps PLATFORM=win32 CONFIGURATION=debug

The assumed availability of standard `.h` files is captured in `win32/config.h`. If you encounter difficulties related to missing include files, examine the indicated file for an include guard, and compare it to `win32/config.h`. For example, you get an error like this:

Example 2-1. Missing include file in Windows

    …
    asprintf.c
    include\tds_sysdep_private.h(239) : fatal error C1083: Cannot open include file: 'inttypes.h': No such file or directory

`src/replacements/asprintf.c` includes `include/tds_sysdep_private.h`, where you find

    238  #ifdef HAVE_INTTYPES_H
    239  #include <inttypes.h>
    240  #endif

and, sure enough, `asprintf.c` earlier includes `win32/config.h`, which says

    91  /* Define to 1 if you have the <inttypes.h> header file. */
    92  #define HAVE_INTTYPES_H 1

Which shouldn't be defined unless `inttypes.h` exists on your system.

Let's review: `config.h` has preprocessor definitions that (try to) describe the build environment to the compiler. In this example, it got one wrong, causing the compiler to look for a file that isn't present, creating the error. The solution is not to change the FreeTDS source code, but merely to comment out line 92 in `config.h`.

Perhaps you're shaking your head at such an "old school" approach. Over the years, Microsoft's proprietary project-configuration files have proved difficult to support. Every version is different, and there are a great many versions in use "in the wild" at any one time. As the project changes, it becomes impossible to maintain these kinds of files.

For Windows applications that use FreeTDS the hard-won wisdom is just use the `NMakefile`, please, thanks! If you like a visual environment and visual debugging, no problem: Microsoft's tools support "Makefile projects". The author has direct knowledge of developers for whom that arrangement works quite well.

### Other ways to build under Windows®

- Visual Studio. Project files are included in the `win32` directory. See above note for why these might be out of date.

- Dev-C++

- MingW

- gcc under cygwin.

- The Borland Builder 6.0 compiler is also reported to work, but requires some tweaking of the `#include` statements. We would apply any patches that make this work cleanly.

From the Department of Double Emulation: FreeTDS builds as a `.dll` under WINE and as a `.a` under Interix. See the mailing list archives (second half of 2003) for details.

## VMS®

FreeTDS will probably build and run on most versions of OpenVMS Alpha 7.0 and later with DEC/Compaq C 6.0 or later. Other prerequisites:

gunzip
vmstar
MMS or MMK

### Build Instructions

Decompress and unpack the source archive using gunzip and vmstar. If you are untarring on an ODS-5 disk, you should use the `/ODS2` or `-o` option to create universally VMS-friendly filenames; otherwise the build will fail to locate some files.

Set default to the top-level source directory and run the configuration script:

    	$ @[.vms]configure

This creates a `descrip.mms` in the top-level source directory which you may execute by simply running MMS (if you have the Module Management System that is part of DECset) or MMK (a freeware MMS alternative available from www.madgoat.com).

Further information can be found in the `` in the source distribution.

## OS X®

As of this writing ($Date: 2011-05-21 18:31:37 $), the regular distribution compiles on OS X.

## AIX®

AIX® can induce linker indigestion. libtool doesn't always understand that a `.a` file can be a shared library. One solution is to build only static libraries with the `--disable-shared` configure option.

Another problem seems to be that the linker isn't asked to pull in all the requisite libraries. Cf. this helpful mailing list message.

## GNU/Linux distributions that use RPMs

You may find it convenient to make an RPM from the source distribution, in which case you'll be glad to know it is easily done:

    	$ rpmbuild -ta freetds-0.63RC9.tar.gz

Prev | Home | Next
How to build: Configure and make | Up | Install FreeTDS