Building/hacking/using on MS-Windows¶
- Maintainer
Frank Fesevur <ffes@users.sourceforge.net>
This part of the documentation is written by Frank Fesevur, co-maintainer of Universal Ctags and the maintainer of the Windows port of this project. It is still very much a work in progress. Things still need to be written down, tested or even investigated. When building for Windows you should be aware that there are many compilers and build environments available. This is a summary of available options and things that have been tested so far.
Compilers¶
There are many compilers for Windows. Compilers not mentioned here may work but are not tested.
Microsoft Visual Studio¶
Obviously there is Microsoft Visual Studio 2013. Many professional developers targeting Windows use Visual Studio. Visual Studio comes in a couple of different editions. Their Express and Community editions are free to use, but a Microsoft-account is required to download the .iso and when you want to continue using it after a 30-days trial period. Other editions of Visual Studio must be purchased.
Installing Visual Studio will give you the IDE, the command line compilers and the MS-version of make named nmake.
Note that ctags cannot be built with Visual Studio older than 2013 anymore. There is C99 (or C11) coding used that generates syntax errors with VS2012 and older. This could affect compilers from other vendors as well.
GCC¶
There are three flavors of GCC for Windows:
MinGW http://www.mingw.org
MinGW-w64 http://mingw-w64.sourceforge.net
TDM-GCC http://tdm-gcc.tdragon.net
MinGW started it all, but development stalled for a while and no x64 was available. Then the MinGW-w64 fork emerged. It started as a 64-bit compiler, but soon they included both a 32-bit and a 64-bit compiler. But the name remained, a bit confusing. Another fork of MinGW is TDM-GCC. It also provides both 32-bit and 64-bit compilers. All have at least GCC 4.8. MinGW-w64 appears to be the most used flavor of MinGW at this moment. Many well known programs that originate from GNU/Linux use MinGW-w64 to compile their Windows port.
Other differences between Microsoft Windows and GNU/Linux¶
There other things where building ctags on Microsoft Windows differs from building on GNU/Linux.
Filenames on Windows file systems are case-preserving, but not case-sensitive.
Windows file systems use backslashes
"\"
as path separators, but paths with forward slashes"/"
are no problem for a Windows program to recognize, even when a full path (include drive letter) is used.The default line-ending on Windows is CRLF. A tags file generated by the Windows build of ctags will contain CRLF.
The tools used to build ctags do understand Unix-line endings without problems. There is no need to convert the line-ending of existing files in the repository.
Due to the differences between the GNU/Linux and Windows C runtime library there are some things that need to be added to ctags to make the program as powerful as it is on GNU/Linux. At this moment regex and fnmatch are borrowed from glibc. mkstemp() is taken from MinGW-w64’s runtime library. scandir() is taken from Pacemaker.
Units testing needs a decent
bash
shell, some unix-like tools (e.g.diff
,sed
) and Python 3.5 or later. It is only tested using Cygwin or MSYS2.