Глава 16. Установка из исходного кода в Windows

Для большинства пользователей рекомендуется просто загрузить дистрибутив для Windows с сайта Postgres Pro. Компиляция из исходного кода описана только для разработчиков сервера Postgres Pro или его расширений.

Существует несколько различных способов сборки Postgres Pro для Windows. Самый простой способ сборки с применением инструментов Microsoft — установить Visual Studio 2019 и использовать входящий в её состав компилятор. Также возможна сборка с помощью полной версии Microsoft Visual C++ 2005—2019. В некоторых случаях помимо компилятора требуется установить Windows SDK.

Также возможно собрать Postgres Pro с помощью средств компиляции GNU, используя среду MinGW, либо с помощью Cygwin для более старых версий Windows.

Наконец, клиентскую библиотеку (libpq) можно собрать с помощью Visual C++ 7.1 или Borland C++ для совместимости со статически компилируемыми приложениями, создаваемыми этими средствами разработки.

При компиляции с помощью MinGW или Cygwin сборка производится как обычно, см. Главу 15 и дополнительные замечания в Подразделе 15.7.5 и Подразделе 15.7.2. Чтобы получить в этих окружениях «родные» 64-битные двоичные файлы, используйте инструменты из MinGW-w64. Данные инструменты также могут быть использованы для кросс-компиляции для 32- и 64-битной Windows в других системах, например в Linux и Darwin. Cygwin не рекомендуется применять в производственной среде, его следует использовать только для запуска в старых версиях Windows, где «родная» сборка невозможна, таких как Windows 98. Официальные двоичные файлы собираются с использованием Visual Studio.

«Родные» сборки psql не поддерживают редактирование командной строки. Однако сборка в Cygwin это поддерживает, так что следует выбрать её, когда необходимо интерактивно использовать psql в Windows.

Chapter 16. Installation from Source Code on Windows

It is recommended that most users download the binary distribution for Windows, available as a graphical installer package from the Postgres Pro website. Building from source is only intended for people developing Postgres Pro or extensions.

There are several different ways of building Postgres Pro on Windows. The simplest way to build with Microsoft tools is to install Visual Studio 2019 and use the included compiler. It is also possible to build with the full Microsoft Visual C++ 2005 to 2019. In some cases that requires the installation of the Windows SDK in addition to the compiler.

It is also possible to build Postgres Pro using the GNU compiler tools provided by MinGW, or using Cygwin for older versions of Windows.

Finally, the client access library (libpq) can be built using Visual C++ 7.1 or Borland C++ for compatibility with statically linked applications built using these tools.

Building using MinGW or Cygwin uses the normal build system, see Chapter 15 and the specific notes in Section 15.7.5 and Section 15.7.2. To produce native 64 bit binaries in these environments, use the tools from MinGW-w64. These tools can also be used to cross-compile for 32 bit and 64 bit Windows targets on other hosts, such as Linux and Darwin. Cygwin is not recommended for running a production server, and it should only be used for running on older versions of Windows where the native build does not work, such as Windows 98. The official binaries are built using Visual Studio.

Native builds of psql don't support command line editing. The Cygwin build does support command line editing, so it should be used where psql is needed for interactive use on Windows.

FAQ