Re: cannot to compile extension by meson on windows

From: Vladlen Popolitov <v(dot)popolitov(at)postgrespro(dot)ru>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: cannot to compile extension by meson on windows
Date: 2024-12-27 08:50:32
Message-ID: deadec7fdd0860a36f9d953b3a5ec3e0@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Pavel Stehule писал(а) 2024-12-01 20:52:
> Hi
>
> Did somebody test compilation of any extension on the WIN platform by
> using meson?
>
> I prepared meson.build
> https://github.com/orafce/orafce/blob/master/meson.build
>
> I tested it successfully on Linux.
>
> But it fails on Windows - a lot of compilation fails on missing
> libintl.h
>
> DOCDIR = C:/PROGRA~1/POSTGR~1/16/doc
> HTMLDIR = C:/PROGRA~1/POSTGR~1/16/doc
> INCLUDEDIR = C:/PROGRA~1/POSTGR~1/16/include
> PKGINCLUDEDIR = C:/PROGRA~1/POSTGR~1/16/include
> INCLUDEDIR-SERVER = C:/PROGRA~1/POSTGR~1/16/include/server`
>
> looks so msvc cannot work with just this configuration.
>
> I can compile orafce when I use setup described by
> https://github.com/orafce/orafce/blob/master/README.msvc
>
> Regards
>
> Pavel

Hi!

In other thread
https://www.postgresql.org/message-id/TYVPR01MB1133078C93F9FE432CA466573E40E2%40TYVPR01MB11330.jpnprd01.prod.outlook.com
Kohei Harikae makes good work to clarify meson documentation, especially
regarding additional libraries.

I suppose in your case meson did not found gettext library, libintl.h
from this library.

You can:
1) install gettext, f.e by vcpkg package manager:
vcpkg.exe install gettext:x64-windows
--x-install-root=c:\postgres\gettext

2) You could add gettext .pc file directory to PKG_CONFIG_PATH ( ;
separated list, meson uses configarations in this order
SET
PKG_CONFIG_PATH=c:\postgres\gettext\x64-windows\lib\pkgconfig;%PKG_CONFIG_PATH%
but this file is not created for this library (you can create it by
yourself, but exists other solution - in step 4)
3) make all other steps to run meson, f.e. call "C:\Program
Files\Microsoft Visual
Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64

4) run meson setup with option -Dnls=enabled - it enables national
languages and uses gettext.
And you have to add options for gettext libraries and includes
directories:
meson setup c:\builddir -Dnsl=enabled

-Dextra_include_dirs=c:\postgres\gettext\x64-windows\include,c:\otherlibs\include
-Dextra_lib_dirs=c:\postgres\gettext\x64-windows\lib,c:\otherlibs\lib
...other options...

extra_include_dirs and extra_lib_dirs are options defined by PostgreSQL.
This options are
comma separated lists of directories, if every value does not contain
comma itself (if contains, it better
to read meson get_options() documentation, it is not easy to explain
shortly meson language syntax).

meson using PKG_CONFIG_PATH detects all library and makes all work with
include and lib paths,
but if library does not have .pc file, you can define paths in options.

If you build with -Dnlas=enabled, you have to be careful with tests.
Tests in this case run
with the default system language, and some tests will fail, as they are
check log files output
and compare it with English answers.

I hope this helps you.

--
Best regards,

Vladlen Popolitov.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vladlen Popolitov 2024-12-27 09:08:12 Re: Windows meson build
Previous Message Andreas 'ads' Scherbaum 2024-12-27 08:42:00 Re: Crash: invalid DSA memory alloc request