This page provides a repository for information about building EPICS on Microsoft Windows. If there are any mistakes here, or you find any other information that ought to go on this page, please let me know. In May 2010, Carsten Winkler (BESSY) posted a set of instructions to tech-talk for building Base R3.14.11 with Visual Studio 2010 Express on Windows XP. However that information may be older than the instructions on this page below. There is a similar (older) page to this one at KEK which goes into more detail and shows some older compilers and different versions of Base. Paul Gibbons recently posted instructions on using the Microsoft Windows Debugger (WinDbg) to trace bugs in Windows IOCs.
Compilers and Build tools
EPICS can be built on Windows using the MinGW version of GNU Make, either ActiveState Perl or Strawberry Perl, and your choice of MinGW GCC, Microsoft’s Visual Studio C++ compiler (including the free Microsoft Visual Studio Community Editions). Alternatively it can be built using the Cygwin versions of GNUmake, Perl and GCC, which may be the simplest approach if you already have Cygwin, but the performance using Cygwin is not as good as with the Microsoft native runtime.
Microsoft API (win32-x86, win32-x86-mingw or windows-x64)
Download and install a C/C++ compiler:
- Microsoft Visual Studio/C++
- Strawberry Perl comes with both MinGW’s GCC and GNU Make
- MinGW provides GCC and GNU Make
- You can also use Microsoft’s commercial C++ development tools if you have them.
We no longer support using the Cygwin tools for Microsoft API builds, use versions of Perl and GNUmake that directly support the Microsoft API instead. See below for Cygwin builds.
The Microsoft Visual Studio 2015 edition must have VC++ language support configured. Mark Rivers explained that his installation was missing the vcvars64.bat and vcvarsall.bat files which configure the command shell for the appropriate compiler:
I fixed this using Control Panel/Programs and Features/Microsoft Visual Studio 2015/Change and selected Modify. I then checked the box for Programming Languages/VC++. Once I did that then many more .bat files appeared, including Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat.
For a description on how to set up batch files and desktop shortcuts to start a Windows command shell for building these architectures, see this tech-talk message.
Other Build Tools
In addition to the compiler, you will also need the following free tools:
- Perl: Either Strawberry Perl (which includes both GCC and GNU Make) or ActiveState Perl will work.
- GNU Make: The GnuWin version that we used to suggest works OK for serial builds and versions of Base up to 3.15.1, but I now recommend using my 64-bit executable of Make 4.1 which also supports make -j for parallel builds.
Note that the above versions of GNU Make will not work properly if you install them into a directory that has parentheses () in its path, and it’s possible that having spaces in the path might be a problem too. Don’t install it anywhere under your C:\Program Files (x86)\ directory. I suggest installing somewhere like C:\GnuMake for simplicity. To extract the files from the EPICS Base distribution on a Windows system, you will need a copy of WinZip, 7-zip or another equivalent program. After extracting the EPICS Base source code, look in the base/startup directory for the win32.bat file which you can edit to help you set up the necessary path and environment variables for building base. If you wish to cross-compile for a vxWorks target you will obviously need to have Wind River’s Tornado or WorkBench software installed, and to edit thebase/configure/os/CONFIG_SITE.Common.vxWorksCommon file.
Cygwin with GCC (cygwin-x86, cygwin-x86_64)
Download and run the 32-bit Cygwin Installer (you can use the 64-bit Cygwin Installer but you will have to create your own configuration files for the cygwin-x86_64 target on older versions of Base). When installing Cygwin to use with GCC, you may set the “Default Text File Type” to be either Unix or DOS depending on whether you expect to use other Windows-specific tools with this installation or not. Note: Some Cygwin versions may not successfully build some EPICS Base versions, although it may still be possible if you to configure Base to create a statically linked version. You will need to select at least the following Cygwin packages for installation (plus their atomatic dependencies):
The installer will add extra packages on which the above depend automatically. In addition to the above, the following packages are useful to have:
After the packages have been installed, use the cygwin tar program to extract the EPICS Base sourcce code. If you didn’t install the readline package edit the file configure/os/CONFIG_SITE.Common.cygwin-x86 and comment out the COMMANDLINE_LIBRARY setting. At this point the only thing you need to do to build Base is to open a Cygwin bash shell window, set EPICS_HOST_ARCH and run make in the top level directory of Base:
$ export EPICS_HOST_ARCH=cygwin-x86 $ cd epics/base $ make ...