Avoid test failure with gcc 14.
[libsigsegv.git] / INSTALL.windows
blobb41d0123592a89f33595f395625752fe103333dc
1 Installation on Microsoft Windows:
3 There are three ways to create binaries of this package for Microsoft Windows:
4 1) Native binaries, built using the mingw tool chain.
5 2) Native binaries, built using the MS Visual C/C++ tool chain.
6 3) Binaries for the Cygwin environment.
8 ===============================================================================
9 1) Native binaries, built using the mingw tool chain.
11    I recommend to use the Cygwin environment as the development environment (*)
12    and mingw only as the target (runtime, deployment) environment.
13    For this, you need to install
14      * Cygwin (from https://cygwin.com/),
15      * some packages available from the Cygwin package installer:
16          make
17      * the mingw cross-compilation tools and runtime package, available from
18        the Cygwin package installer (setup-x86_64.exe):
19        - for creating 32-bit binaries: packages
20            mingw64-i686-gcc-core,
21            mingw64-i686-headers,
22            mingw64-i686-runtime
23        - for creating 64-bit binaries: packages
24            mingw64-x86_64-gcc-core,
25            mingw64-x86_64-headers,
26            mingw64-x86_64-runtime
28    Building 32-bit binaries for mingw is achieved through the following
29    preparation, configure, and build commands:
31       PATH=/usr/local/mingw32/bin:$PATH
32       export PATH
33       ./configure --host=i686-w64-mingw32 --prefix=/usr/local/mingw32 \
34             CC=i686-w64-mingw32-gcc \
35             CPPFLAGS="-I/usr/local/mingw32/include -Wall" \
36             LDFLAGS="-L/usr/local/mingw32/lib"
37       make
38       make check
40    Building 64-bit binaries for mingw is achieved through the following
41    preparation, configure, and build commands:
43       PATH=/usr/local/mingw64/bin:$PATH
44       export PATH
45       ./configure --host=x86_64-w64-mingw32 --prefix=/usr/local/mingw64 \
46             CC=x86_64-w64-mingw32-gcc \
47             CPPFLAGS="-I/usr/local/mingw64/include -Wall" \
48             LDFLAGS="-L/usr/local/mingw64/lib"
49       make
50       make check
52    Installation:
54       make install
56    (*) Note: The MSYS2 environment as a development environment is *not*
57        supported.  This environment contains an ignoble and ignominious hack:
58        In a program invocation, the program *by default* receives different
59        arguments than the ones that the caller has passed.  See
60        <https://www.msys2.org/wiki/Porting/#filesystem-namespaces>.
61        All program invocations in this environment are therefore unreliable.
63 ===============================================================================
64 2) Native binaries, built using the MS Visual C/C++ tool chain.
66    Note that binaries created with MSVC have a distribution constraint: They
67    depend on a closed-source library ('msvcr90.dll' for MSVC 9.0,
68    'vcruntime140.dll' for MSVC 14.0, and so on) which is not normally part of
69    a Windows installation.
70    You cannot distribute 'vcruntime*.dll' with the binaries - this would be a
71    violation of the GPL and of the Microsoft EULA.
72    You can distribute the binaries without including 'vcruntime*.dll'. Users
73    who don't have this library on their system will require to pull some files
74    (api-ms-win*.dll) through the Windows Update mechanism, see
75    https://support.microsoft.com/en-us/kb/2999226 .
77    This recipe requires MS Visual C/C++ 9.0 or newer.
78    You don't need the Visual Studio IDE, just the C/C++ tool chain.
79    As of 2016, you can install the MS Visual C/C++ 14.0 tool chain from
80    http://landinghub.visualstudio.com/visual-cpp-build-tools (it's the file
81    visualcppbuildtools_full.exe).
83    This recipe requires also a Cygwin environment (with 'bash', the common POSIX
84    commands, and 'make') as a build environment. Building with 'nmake' is not
85    supported.
86    For this, you need to install
87      * Cygwin (from https://cygwin.com/),
88      * some packages available from the Cygwin package installer:
89          make
91    You also need the scripts 'ar-lib' and 'compile' from
92      https://git.savannah.gnu.org/gitweb/?p=automake.git;a=blob_plain;f=lib/ar-lib;hb=HEAD
93      https://git.savannah.gnu.org/gitweb/?p=automake.git;a=blob_plain;f=lib/compile;hb=HEAD
94    respectively.
95    They may also be included in this package, in directory 'build-aux/'.
96    Save them; the instructions below assume that you stored them in $HOME/msvc/.
97    Make them executable:
98       chmod a+x ar-lib compile
100    Start a bash (from Cygwin).
102    Make sure that the MSVC tools ("cl" etc.) are found in PATH and the
103    environment variables INCLUDE and LIB are set appropriately.
104    In a typical MSVC 9.0 installation, it can be achieved by running
105      C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat
106    In a typical MSVC 14.0 installation on Windows 10, it can be achieved
107    - for creating 32-bit binaries: through the following bash commands:
109       # Set environment variables for using MSVC 14,
110       # for creating native 32-bit Windows executables.
112       # Windows C library headers and libraries.
113       WindowsCrtIncludeDir='C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt'
114       WindowsCrtLibDir='C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\'
115       INCLUDE="${WindowsCrtIncludeDir};$INCLUDE"
116       LIB="${WindowsCrtLibDir}x86;$LIB"
118       # Windows API headers and libraries.
119       WindowsSdkIncludeDir='C:\Program Files (x86)\Windows Kits\8.1\Include\'
120       WindowsSdkLibDir='C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\'
121       INCLUDE="${WindowsSdkIncludeDir}um;${WindowsSdkIncludeDir}shared;$INCLUDE"
122       LIB="${WindowsSdkLibDir}x86;$LIB"
124       # Visual C++ tools, headers and libraries.
125       VSINSTALLDIR='C:\Program Files (x86)\Microsoft Visual Studio 14.0'
126       VCINSTALLDIR="${VSINSTALLDIR}"'\VC'
127       PATH=`cygpath -u "${VCINSTALLDIR}"`/bin:"$PATH"
128       INCLUDE="${VCINSTALLDIR}"'\include;'"${INCLUDE}"
129       LIB="${VCINSTALLDIR}"'\lib;'"${LIB}"
131       export INCLUDE LIB
133    - for creating 64-bit binaries: through the following bash commands:
135      # Set environment variables for using MSVC 14,
136      # for creating native 64-bit Windows executables.
138      # Windows C library headers and libraries.
139      WindowsCrtIncludeDir='C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt'
140      WindowsCrtLibDir='C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\'
141      INCLUDE="${WindowsCrtIncludeDir};$INCLUDE"
142      LIB="${WindowsCrtLibDir}x64;$LIB"
144      # Windows API headers and libraries.
145      WindowsSdkIncludeDir='C:\Program Files (x86)\Windows Kits\8.1\Include\'
146      WindowsSdkLibDir='C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\'
147      INCLUDE="${WindowsSdkIncludeDir}um;${WindowsSdkIncludeDir}shared;$INCLUDE"
148      LIB="${WindowsSdkLibDir}x64;$LIB"
150      # Visual C++ tools, headers and libraries.
151      VSINSTALLDIR='C:\Program Files (x86)\Microsoft Visual Studio 14.0'
152      VCINSTALLDIR="${VSINSTALLDIR}"'\VC'
153      PATH=`cygpath -u "${VCINSTALLDIR}"`/bin/amd64:"$PATH"
154      INCLUDE="${VCINSTALLDIR}"'\include;'"${INCLUDE}"
155      LIB="${VCINSTALLDIR}"'\lib\amd64;'"${LIB}"
157      export INCLUDE LIB
159    Building 32-bit binaries with MSVC is achieved through the following
160    preparation, configure, and build commands:
162       PATH=/usr/local/msvc32/bin:$PATH
163       export PATH
165       win32_target=_WIN32_WINNT_WINXP   # for MSVC 9.0
166       win32_target=_WIN32_WINNT_VISTA   # possibly for MSVC >= 10.0
167       win32_target=_WIN32_WINNT_WIN7    # possibly for MSVC >= 10.0
168       win32_target=_WIN32_WINNT_WIN8    # possibly for MSVC >= 10.0
170       ./configure --host=i686-w64-mingw32 --prefix=/usr/local/msvc32 \
171             CC="$HOME/msvc/compile cl -nologo" \
172             CFLAGS="-MD" \
173             CXX="$HOME/msvc/compile cl -nologo" \
174             CXXFLAGS="-MD" \
175             CPPFLAGS="-D_WIN32_WINNT=$win32_target -I/usr/local/msvc32/include" \
176             LDFLAGS="-L/usr/local/msvc32/lib" \
177             LD="link" \
178             NM="dumpbin -symbols" \
179             STRIP=":" \
180             AR="$HOME/msvc/ar-lib lib" \
181             RANLIB=":"
182       make
183       make check
185    Building 64-bit binaries with MSVC is achieved through the following
186    preparation, configure, and build commands:
188       PATH=/usr/local/msvc64/bin:$PATH
189       export PATH
191       win32_target=_WIN32_WINNT_WINXP   # for MSVC 9.0
192       win32_target=_WIN32_WINNT_VISTA   # possibly for MSVC >= 10.0
193       win32_target=_WIN32_WINNT_WIN7    # possibly for MSVC >= 10.0
194       win32_target=_WIN32_WINNT_WIN8    # possibly for MSVC >= 10.0
196       ./configure --host=x86_64-w64-mingw32 --prefix=/usr/local/msvc64 \
197             CC="$HOME/msvc/compile cl -nologo" \
198             CFLAGS="-MD" \
199             CXX="$HOME/msvc/compile cl -nologo" \
200             CXXFLAGS="-MD" \
201             CPPFLAGS="-D_WIN32_WINNT=$win32_target -I/usr/local/msvc64/include" \
202             LDFLAGS="-L/usr/local/msvc64/lib" \
203             LD="link" \
204             NM="dumpbin -symbols" \
205             STRIP=":" \
206             AR="$HOME/msvc/ar-lib lib" \
207             RANLIB=":"
208       make
209       make check
211    Installation:
213       make install
215 ===============================================================================
216 3) Binaries for the Cygwin environment.
218    The generic instructions in the INSTALL file apply. But here are more
219    specific ones.
221    You need to install
222      * Cygwin (from https://cygwin.com/),
223      * some packages available from the Cygwin package installer:
224          make
225      * the Cygwin [cross-]compilation tools package, available from
226        the Cygwin package installer (setup-x86_64.exe):
227        - for creating 32-bit binaries: packages
228            cygwin32-gcc-core,
229            cygwin32
230        - for creating 64-bit binaries: packages
231            gcc-core
233    Building 32-bit binaries for Cygwin must be done in a directory *outside*
234    the Cygwin /home and /usr hierarchies. It is achieved through the following
235    preparation, configure, and build commands:
237       PATH=/usr/local/cygwin32/bin:/usr/i686-pc-cygwin/sys-root/usr/bin:$PATH
238       export PATH
239       ./configure --host=i686-pc-cygwin --prefix=/usr/local/cygwin32 \
240             CC=i686-pc-cygwin-gcc \
241             CPPFLAGS="-I/usr/local/cygwin32/include -Wall" \
242             LDFLAGS="-L/usr/local/cygwin32/lib"
243       make
244       make check
246    Building 64-bit binaries for Cygwin is achieved through the following
247    preparation, configure, and build commands:
249       PATH=/usr/local/cygwin64/bin:$PATH
250       export PATH
251       ./configure --host=x86_64-pc-cygwin --prefix=/usr/local/cygwin64 \
252             CC=x86_64-pc-cygwin-gcc \
253             CPPFLAGS="-I/usr/local/cygwin64/include -Wall" \
254             LDFLAGS="-L/usr/local/cygwin64/lib"
255       make
256       make check
258    Installation:
260       make install
262 ===============================================================================