public inbox for [email protected]  
help / color / mirror / Atom feed
RE: Windows meson build
5+ messages / 2 participants
[nested] [flat]

* RE: Windows meson build
@ 2024-12-18 02:05  Kohei Harikae (Fujitsu) <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Kohei Harikae (Fujitsu) @ 2024-12-18 02:05 UTC (permalink / raw)
  To: 'Andres Freund' <[email protected]>; +Cc: '[email protected]' <[email protected]>

Hi,

I apologize for this late reply.

As you advised, I was able to create the ".pc" file manually and set the dependencies using pkgconf.
Thank you.

However, I have read the PostgreSQL Documentation and did not realize that pkgconf is required.

17.4.3.2. PostgreSQL Features
-Dgssapi
  On many systems, the GSSAPI system (a part of the MIT Kerberos installation) is not installed in a location that is searched by default (e.g., /usr/include, /usr/lib). 
  In those cases, PostgreSQL will query pkg-config to detect the required compiler and linker options. 
-Dlibxml
  To use a libxml2 installation that is in an unusual location, you can set pkg-config-related environment variables (see its documentation).

Only a few options have a pkg-config description.
It would be easier to understand pkg-config in the "17.4.3. meson setup Options" section.
Below is my proposal for the document description.
How do you think about this?

17.4.3. meson setup Options
PostgreSQL will query pkg-config to detect the required compiler and linker options.
To use module installed in an unusual location for each feature (e.g. -Dgssapi, -Dlibxml), set pkg-config-related environment variables (see its documentation).

Regards,
Kohei Harikae

-----Original Message-----
From: Andres Freund <[email protected]> 
Sent: Thursday, November 7, 2024 4:05 AM
To: Harikae, Kohei/張替 浩平 <[email protected]>
Cc: '[email protected]' <[email protected]>
Subject: Re: Windows meson build

Hi,

On 2024-11-05 06:32:51 +0000, Kohei Harikae (Fujitsu) wrote:
> I do not use pkgconf in my Windows environment.
> In my Windows environment, I could not build the following OSS with meson.
> - 0001 icu
> - 0002 libxml
> - 0003 libxslt
> - 0004 lz4
> - 0005 tcl
> - 0006 zlib
> - 0007 zstd
> 
> [1]thread, I created a patch like the one in the attached file, and now I can build.
> Would you like to be able to build OSS with Windows meson without using pkgconf?

You can use pkgconf or cmake for the dependencies.  I don't want to add "raw"
dependency handling for every dependency, they each build in too many variants for that to be a sensible investment of time.


Greetings,

Andres Freund






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Windows meson build
@ 2024-12-25 10:28  Vladlen Popolitov <[email protected]>
  parent: Kohei Harikae (Fujitsu) <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Vladlen Popolitov @ 2024-12-25 10:28 UTC (permalink / raw)
  To: Kohei Harikae (Fujitsu) <[email protected]>; +Cc: 'Andres Freund' <[email protected]>; '[email protected]' <[email protected]>

Kohei Harikae (Fujitsu) писал(а) 2024-12-18 05:05:
Hi!
> Hi,
> 
> I apologize for this late reply.
> 
> As you advised, I was able to create the ".pc" file manually and set 
> the dependencies using pkgconf.
> Thank you.
> 
> However, I have read the PostgreSQL Documentation and did not realize 
> that pkgconf is required.
> 
> 17.4.3.2. PostgreSQL Features
> -Dgssapi
>   On many systems, the GSSAPI system (a part of the MIT Kerberos 
> installation) is not installed in a location that is searched by 
> default (e.g., /usr/include, /usr/lib).
>   In those cases, PostgreSQL will query pkg-config to detect the 
> required compiler and linker options.
> -Dlibxml
>   To use a libxml2 installation that is in an unusual location, you can 
> set pkg-config-related environment variables (see its documentation).
> 
> Only a few options have a pkg-config description.
> It would be easier to understand pkg-config in the "17.4.3. meson setup 
> Options" section.
> Below is my proposal for the document description.
> How do you think about this?
> 
> 17.4.3. meson setup Options
> PostgreSQL will query pkg-config to detect the required compiler and 
> linker options.
> To use module installed in an unusual location for each feature (e.g. 
> -Dgssapi, -Dlibxml), set pkg-config-related environment variables (see 
> its documentation).

Meson has more straighforward solution. It uses environment variable 
PKG_CONFIG_PATH, that can store the list of directories with all .pc 
files. Meson uses this list and in this specific order to build project. 
As wrote in meson documentation (in the source of open source project):
# Instead of relying on pkg-config or pkgconf to provide -L flags in a
# specific order, we reorder library paths ourselves, according to th
# order specified in PKG_CONFIG_PATH. See:
# https://github.com/mesonbuild/meson/issues/4271
#
It would be more clear information in PostgreSQL documentation, that all 
directories with pc files are listed in one variable.

By the way, if you need to add , f.e. libxml library to postgreSQL 
build, you can
1) build and install it using , f.e. vcpkg:
  vcpkg install libxml2:windows-x64 --x-install-root=c:\pbuild\libxml2
2) add path to pc directory to PKG_CONFIG_PATH
  SET 
PKG_CONFIG_PATH=c:\pbuild\libxml2\winsows-x64\lib\pkgconfig;%PKG_CONFIG_PATH%
3) make steps with build
  meson setup c:\builddir\... --prefix=c:\postgresdir\...

It is just one install and one manipulation with environment variable. 
No indeterminate behaviour with other variables used by specific 
packages and a libraries order.

> 
> Regards,
> Kohei Harikae
> 
> -----Original Message-----
> From: Andres Freund <[email protected]>
> Sent: Thursday, November 7, 2024 4:05 AM
> To: Harikae, Kohei/張替 浩平 <[email protected]>
> Cc: '[email protected]' 
> <[email protected]>
> Subject: Re: Windows meson build
> 
> Hi,
> 
> On 2024-11-05 06:32:51 +0000, Kohei Harikae (Fujitsu) wrote:
>> I do not use pkgconf in my Windows environment.
>> In my Windows environment, I could not build the following OSS with 
>> meson.
>> - 0001 icu
>> - 0002 libxml
>> - 0003 libxslt
>> - 0004 lz4
>> - 0005 tcl
>> - 0006 zlib
>> - 0007 zstd
>> 
>> [1]thread, I created a patch like the one in the attached file, and 
>> now I can build.
>> Would you like to be able to build OSS with Windows meson without 
>> using pkgconf?
> 
> You can use pkgconf or cmake for the dependencies.  I don't want to add 
> "raw"
> dependency handling for every dependency, they each build in too many 
> variants for that to be a sensible investment of time.
> 
> 
> Greetings,
> 
> Andres Freund

-- 
Best regards,

Vladlen Popolitov.






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* RE: Windows meson build
@ 2024-12-27 01:31  Kohei Harikae (Fujitsu) <[email protected]>
  parent: Vladlen Popolitov <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Kohei Harikae (Fujitsu) @ 2024-12-27 01:31 UTC (permalink / raw)
  To: 'Vladlen Popolitov' <[email protected]>; +Cc: 'Andres Freund' <[email protected]>; '[email protected]' <[email protected]>

Hi,

Thank you for your advice.
I added a sample setting PKG_CONFIG_PATH based on your advice.

How do you think about this?

Regards,
Kohei Harikae

-----Original Message-----
From: Vladlen Popolitov <[email protected]> 
Sent: Wednesday, December 25, 2024 7:28 PM
To: Harikae, Kohei/張替 浩平 <[email protected]>
Cc: 'Andres Freund' <[email protected]>; '[email protected]' <[email protected]>
Subject: Re: Windows meson build

Kohei Harikae (Fujitsu) писал(а) 2024-12-18 05:05:
Hi!
> Hi,
> 
> I apologize for this late reply.
> 
> As you advised, I was able to create the ".pc" file manually and set 
> the dependencies using pkgconf.
> Thank you.
> 
> However, I have read the PostgreSQL Documentation and did not realize 
> that pkgconf is required.
> 
> 17.4.3.2. PostgreSQL Features
> -Dgssapi
>   On many systems, the GSSAPI system (a part of the MIT Kerberos
> installation) is not installed in a location that is searched by 
> default (e.g., /usr/include, /usr/lib).
>   In those cases, PostgreSQL will query pkg-config to detect the 
> required compiler and linker options.
> -Dlibxml
>   To use a libxml2 installation that is in an unusual location, you 
> can set pkg-config-related environment variables (see its documentation).
> 
> Only a few options have a pkg-config description.
> It would be easier to understand pkg-config in the "17.4.3. meson 
> setup Options" section.
> Below is my proposal for the document description.
> How do you think about this?
> 
> 17.4.3. meson setup Options
> PostgreSQL will query pkg-config to detect the required compiler and 
> linker options.
> To use module installed in an unusual location for each feature (e.g. 
> -Dgssapi, -Dlibxml), set pkg-config-related environment variables (see 
> its documentation).

Meson has more straighforward solution. It uses environment variable PKG_CONFIG_PATH, that can store the list of directories with all .pc files. Meson uses this list and in this specific order to build project. 
As wrote in meson documentation (in the source of open source project):
# Instead of relying on pkg-config or pkgconf to provide -L flags in a # specific order, we reorder library paths ourselves, according to th # order specified in PKG_CONFIG_PATH. See:
# https://github.com/mesonbuild/meson/issues/4271
#
It would be more clear information in PostgreSQL documentation, that all directories with pc files are listed in one variable.

By the way, if you need to add , f.e. libxml library to postgreSQL build, you can
1) build and install it using , f.e. vcpkg:
  vcpkg install libxml2:windows-x64 --x-install-root=c:\pbuild\libxml2
2) add path to pc directory to PKG_CONFIG_PATH
  SET
PKG_CONFIG_PATH=c:\pbuild\libxml2\winsows-x64\lib\pkgconfig;%PKG_CONFIG_PATH%
3) make steps with build
  meson setup c:\builddir\... --prefix=c:\postgresdir\...

It is just one install and one manipulation with environment variable. 
No indeterminate behaviour with other variables used by specific packages and a libraries order.

> 
> Regards,
> Kohei Harikae
> 
> -----Original Message-----
> From: Andres Freund <[email protected]>
> Sent: Thursday, November 7, 2024 4:05 AM
> To: Harikae, Kohei/張替 浩平 <[email protected]>
> Cc: '[email protected]' 
> <[email protected]>
> Subject: Re: Windows meson build
> 
> Hi,
> 
> On 2024-11-05 06:32:51 +0000, Kohei Harikae (Fujitsu) wrote:
>> I do not use pkgconf in my Windows environment.
>> In my Windows environment, I could not build the following OSS with 
>> meson.
>> - 0001 icu
>> - 0002 libxml
>> - 0003 libxslt
>> - 0004 lz4
>> - 0005 tcl
>> - 0006 zlib
>> - 0007 zstd
>> 
>> [1]thread, I created a patch like the one in the attached file, and 
>> now I can build.
>> Would you like to be able to build OSS with Windows meson without 
>> using pkgconf?
> 
> You can use pkgconf or cmake for the dependencies.  I don't want to 
> add "raw"
> dependency handling for every dependency, they each build in too many 
> variants for that to be a sensible investment of time.
> 
> 
> Greetings,
> 
> Andres Freund

--
Best regards,

Vladlen Popolitov.


Attachments:

  [application/octet-stream] installation-meson.patch (2.8K, 2-installation-meson.patch)
  download | inline diff:
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index ebdb5b3bc2d..c583c256858 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -2463,12 +2463,7 @@ ninja install
       <listitem>
        <para>
         Build with support for GSSAPI authentication. MIT Kerberos is required
-        to be installed for GSSAPI.  On many systems, the GSSAPI system (a part
-        of the MIT Kerberos installation) is not installed in a location
-        that is searched by default (e.g., <filename>/usr/include</filename>,
-        <filename>/usr/lib</filename>).  In
-        those cases, PostgreSQL will query <command>pkg-config</command> to
-        detect the required compiler and linker options.  Defaults to auto.
+        to be installed for GSSAPI.  Defaults to auto.
         <filename>meson configure</filename> will check for the required
         header files and libraries to make sure that your GSSAPI installation
         is sufficient before proceeding.
@@ -2589,12 +2584,6 @@ ninja install
         Build with libxml2, enabling SQL/XML support.  Defaults to
         auto. Libxml2 version 2.6.23 or later is required for this feature.
        </para>
-
-       <para>
-        To use a libxml2 installation that is in an unusual location, you
-        can set <command>pkg-config</command>-related environment
-        variables (see its documentation).
-       </para>
       </listitem>
      </varlistentry>
 
@@ -3174,6 +3163,43 @@ ninja install
    &targets-meson;
   </sect2>
 
+  <sect2 id="use-unusual-location-libraries-meson">
+   <title>Steps to use libraries installed in an unusual location</title>
+
+   <para>
+    PostgreSQL will query pkg-config to detect the required compiler and linker options.
+    To use modules installed in an unusual location, set pkg-config-related
+    environment variables (see its documentation). For example, if you want to add
+    the library to the PostgreSQL build, add the directory where the .pc file resides
+    to PKG_CONFIG_PATH.
+
+    Sample procedures to include libraries for PostgreSQL build are as follows:
+   </para>
+   
+    <procedure>
+    <step id="sample-build-library">
+     <title>Building and Installation library</title>
+     <para>
+      Check the path where the .pc file (e.g.libxml-2.0.pc) is created.
+     </para>
+    </step>
+    <step id="sample-add-PKG_CONFIG_PATH">
+     <title>Add path to .pc directory to PKG_CONFIG_PATH</title>
+     <para>
+     </para>
+    </step>
+    <step id="sample-build-meson">
+     <title>Building and Installation PostgreSQL with Meson</title>
+     <para>
+<screen>
+<userinput>meson setup build</userinput>
+</screen>
+     </para>
+    </step>
+    </procedure>
+   
+  </sect2>
+
  </sect1>
 
  <sect1 id="install-post">


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Windows meson build
@ 2024-12-27 06:57  Vladlen Popolitov <[email protected]>
  parent: Kohei Harikae (Fujitsu) <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Vladlen Popolitov @ 2024-12-27 06:57 UTC (permalink / raw)
  To: Kohei Harikae (Fujitsu) <[email protected]>; +Cc: 'Andres Freund' <[email protected]>; '[email protected]' <[email protected]>

Kohei Harikae (Fujitsu) писал(а) 2024-12-27 04:31:
> Hi,
> 
> Thank you for your advice.
> I added a sample setting PKG_CONFIG_PATH based on your advice.
> 
> How do you think about this?
> 
> Regards,
> Kohei Harikae
> 

Hi,
 From my point of view it looks good. Actual information is added,
excessive information is removed.
I think in the phrase:
"add the directory where the .pc file resides to PKG_CONFIG_PATH."
better to add wording, that PKG_CONFIG_PATH is the list of directories 
separated
by PATH separator ( ; in Windows, : in POSIX). Otherwise the reader has 
to
search additional information about this variable in meson 
documentation.

-- 
Best regards,

Vladlen Popolitov.






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Windows meson build
@ 2024-12-27 09:08  Vladlen Popolitov <[email protected]>
  parent: Vladlen Popolitov <[email protected]>
  0 siblings, 0 replies; 5+ messages in thread

From: Vladlen Popolitov @ 2024-12-27 09:08 UTC (permalink / raw)
  To: Kohei Harikae (Fujitsu) <[email protected]>; +Cc: 'Andres Freund' <[email protected]>; '[email protected]' <[email protected]>

Vladlen Popolitov писал(а) 2024-12-27 09:57:
> Kohei Harikae (Fujitsu) писал(а) 2024-12-27 04:31:
>> Hi,
>> 
>> Thank you for your advice.
>> I added a sample setting PKG_CONFIG_PATH based on your advice.
>> 
>> How do you think about this?
>> 
>> Regards,
>> Kohei Harikae
>> 
> 
> Hi,
> From my point of view it looks good. Actual information is added,
> excessive information is removed.
> I think in the phrase:
> "add the directory where the .pc file resides to PKG_CONFIG_PATH."
> better to add wording, that PKG_CONFIG_PATH is the list of directories 
> separated
> by PATH separator ( ; in Windows, : in POSIX). Otherwise the reader has 
> to
> search additional information about this variable in meson 
> documentation.

Hi

I think, it is better to add the other options how to configure external
libraries, if they do not have .pc file:
add meson options defined by PostgreSQL for its configuration (gettext 
library example)
  
-Dextra_include_dirs=c:\postgres\gettext\x64-windows\include,c:\otherlibs\include
  -Dextra_lib_dirs=c:\postgres\gettext\x64-windows\lib,c:\otherlibs\lib

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.



-- 
Best regards,

Vladlen Popolitov.






^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2024-12-27 09:08 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-12-18 02:05 RE: Windows meson build Kohei Harikae (Fujitsu) <[email protected]>
2024-12-25 10:28 ` Vladlen Popolitov <[email protected]>
2024-12-27 01:31   ` Kohei Harikae (Fujitsu) <[email protected]>
2024-12-27 06:57     ` Vladlen Popolitov <[email protected]>
2024-12-27 09:08       ` Vladlen Popolitov <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox