Re: Windows meson build - Mailing list pgsql-hackers

From Vladlen Popolitov
Subject Re: Windows meson build
Date
Msg-id 3e9b9c1934d02d7236bc880515058415@postgrespro.ru
Whole thread Raw
In response to Re: Windows meson build  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Kohei Harikae (Fujitsu) писал(а) 2025-01-06 16:57:
> Hi,

> 
> - 0001 icu
> - 0002 libxml
> - 0003 libxslt
> - 0004 lz4
> - 0005 tcl
> - 0006 zlib
> - 0007 zstd
> These libraries could not be built by setting extra_include_dirs and 
> extra_lib_dirs.
> These libraries may not have .pc file created.
> For example, if I use msc (Visual Studio) to build zLib, zlib.pc is not 
> created.
> Could you tell me which libraries can use this option?
> 
> Regards,
> Kohei Harikae
Hi!

I don't have my Windows PC near me just now, I take information from my 
memory regarding these
libraries.

I use Windows package manager vcpkg to build these libraries, and vcpkg 
uses msvc (Visual Studio).
As I remember, icu, libxml2, libxslt build by vcpkg have .pc file. 
Really pc file is easy to
create by hands the text file with
a) product name and version
b) relative (from .pc file location) path to libs
c) relative path to includes
Libraries with .pc file can be listed in environment variable 
PKG_CONFIG_PATH.

gettext does not have pc file, and lib and include location must be 
included in extra_include_dirs
and extra_lib_dirs options, that are PostgreSQL options in meson (not 
meson itself options) added
for libraries without .pc file.

Steps to build PostgreSQL under Windsows using meson and vcpkg
1) create build.cmd for all commands
2) install vcpkg to any location (except network drive, it has problems 
with it. Hard drive C: is OK)
3) install all libraries:
  vcpkg install libxml2
  etc...
4) look for all libraries lib/pkgconf library and find .pc file. All pc 
file paths add to
SET PKG_CONFIG_PATH=... in build.cmd
5) all libraries without pc file - add to -Dextra_include_dirs= and 
-Dextra_lib_dirs for meson command,
that prepares the build directory - add it to build.cmd
6) add in the beginning build.cmd this or correct path for your system
  call "C:\Program Files\Microsoft Visual 
Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
7) run build.cmd

This library configuration should work. I recommend install libraries to 
special location for every
build version to control exact location and library version. vcpkg has 
options for library version
and install directory.


-- 
Best regards,

Vladlen Popolitov.



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Small refactoring around vacuum_open_relation
Next
From: Vladlen Popolitov
Date:
Subject: Re: Exporting float_to_shortest_decimal_buf(n) with Postgres 17 on Windows