forked from etc/pineapple-src
65 lines
2.8 KiB
Text
Executable file
65 lines
2.8 KiB
Text
Executable file
# Building
|
|
|
|
For Windows systems, LibreSSL supports the mingw-w64 toolchain, which can use
|
|
GCC or Clang as the compiler. Contrary to its name, mingw-w64 supports both
|
|
32-bit and 64-bit build environments. If your project already uses mingw-w64,
|
|
then LibreSSL should integrate very nicely. Old versions of the mingw-w64
|
|
toolchain, such as the one packaged with Ubuntu 12.04, may have trouble
|
|
building LibreSSL. Please try it with a recent toolchain if you encounter
|
|
troubles. Cygwin provides an easy method of installing the latest mingw-w64
|
|
cross compilers on Windows.
|
|
|
|
To configure and build LibreSSL for a 32-bit system, use the following
|
|
build steps:
|
|
|
|
CC=i686-w64-mingw32-gcc CPPFLAGS=-D__MINGW_USE_VC2005_COMPAT \
|
|
./configure --host=i686-w64-mingw32
|
|
make
|
|
make check
|
|
|
|
For 64-bit builds, use these instead:
|
|
|
|
CC=x86_64-w64-mingw32-gcc ./configure --host=x86_64-w64-mingw32
|
|
make
|
|
make check
|
|
|
|
# Why the -D__MINGW_USE_VC2005_COMPAT flag on 32-bit systems?
|
|
|
|
An ABI change introduced with Microsoft Visual C++ 2005 (also known as
|
|
Visual C++ 8.0) switched time_t from 32-bit to 64-bit. It is important to
|
|
build LibreSSL with 64-bit time_t whenever possible, because 32-bit time_t
|
|
is unable to represent times past 2038 (this is commonly known as the
|
|
Y2K38 problem).
|
|
|
|
If LibreSSL is built with 32-bit time_t, when verifying a certificate whose
|
|
expiry date is set past 19 January 2038, it will be unable to tell if the
|
|
certificate has expired or not, and thus take the safe stance and reject it.
|
|
|
|
In order to avoid this, you need to build LibreSSL (and everything that links
|
|
with it) with the -D__MINGW_USE_VC2005_COMPAT flag. This tells mingw-w64 to
|
|
use the new ABI.
|
|
|
|
64-bit systems always have a 64-bit time_t and are not affected by this
|
|
problem.
|
|
|
|
# Using Libressl with Visual Studio
|
|
|
|
A script for generating ready-to-use .DLL and static .LIB files is included in
|
|
the source repository at
|
|
https://github.com/libressl-portable/portable/blob/master/dist-win.sh
|
|
|
|
This script uses mingw-w64 to build LibreSSL and then uses Visual Studio tools
|
|
to generate compatible library import files ready-to-use with Visual
|
|
Studio projects. Static and dynamic libraries are included. The script uses
|
|
cv2pdb to generate Visual Studio and windbg compatible debug files. cv2pdb is a
|
|
tool developed for the D language and can be found here:
|
|
https://github.com/rainers/cv2pdb
|
|
|
|
Pre-built Windows binaries are available with LibreSSL releases if you do not
|
|
have a mingw-w64 build environment. Mingw-w64 code is largely, but not 100%,
|
|
compatible with code built from Visual Studio. Notably, FILE * pointers cannot
|
|
be shared between code built for Mingw-w64 and Visual Studio.
|
|
|
|
As of LibreSSL 2.2.2, Visual Studio Native builds can be produced using CMake.
|
|
This produces ABI-compatible libraries for linking with native code generated
|
|
by Visual Studio.
|