Thread: Building Postgres 17.0 with meson
I’m trying to build Postgres 17.0 and have about learning meson as I go.
The build setup command I have so far is:
meson setup build --prefix=%prefix% --buildtype=release -Dssl=auto -Dzlib=auto -Dicu=auto
but I believe that cmd expects ssl, zlib, and icu to be installed in default locations.
How do I specify to meson that I want it to use the versions of those 3 software packages that I have built
e.g. the openssl I want it to use is located in D:\Postgres-Builds\OpenSSL\OpenSSL-Install\OpenSSL-3.1.6-wx6
and similar locations for icu and zlib?
Thanks, Mark
I’m trying to build Postgres 17.0 and have about learning meson as I go.
The build setup command I have so far is:
meson setup build --prefix=%prefix% --buildtype=release -Dssl=auto -Dzlib=auto -Dicu=auto
but I believe that cmd expects ssl, zlib, and icu to be installed in default locations.
How do I specify to meson that I want it to use the versions of those 3 software packages that I have built
e.g. the openssl I want it to use is located in D:\Postgres-Builds\OpenSSL\OpenSSL-Install\OpenSSL-3.1.6-wx6
and similar locations for icu and zlib?
Thanks, Mark
e.g. meson setup build --prefix=%prefix% --buildtype=release -Dextra_lib_dirs=D:\Postgres-Builds\OpenSSL\OpenSSL-Install\OpenSSL-3.1.6-wx6
https://www.postgresql.org/docs/current/install-meson.html#CONFIGURE-EXTRA-LIB-DIRS-MESON
ZOHO
Srinath is in India I believe and not available currently. Does anybody have any idea why meson
is not finding the paths I’m specifying with the -Dextra_lib_dirs and -Dextra_include_dirs? See below.
Thanks, Mark
From: Mark Hill
Sent: Wednesday, November 6, 2024 10:33 AM
To: 'Srinath Reddy Sadipiralla' <srinath.reddy@zohocorp.com>
Subject: RE: Building Postgres 17.0 with meson
Hi Srinath,
Thanks for the tip.
I tried:
meson setup build --prefix=%prefix% --buildtype=release -Dextra_lib_dirs=%openssl_directory%,%zlib_directory%,%icu4c_directory% -Dextra_include_dirs=%openssl_directory%,%zlib_directory%,%icu4c_directory%
using both the -Dextra_lib_dirs and -Dextra_include_dirs and it’s still not finding openssl, icu, or zlib.
In the External libraries information toward the end of the output, it says:
External libraries
icu : NO
openssl : NO
zlib : NO
I removed the other libraries in the output for brevity.
I’ve checked my variables and they’re correct and those libraries are there.
Am I missing an option to meson setup build?
Thanks, Mark
From: Srinath Reddy Sadipiralla <srinath.reddy@zohocorp.com>
Sent: Wednesday, November 6, 2024 12:34 AM
To: Mark Hill <Mark.Hill@sas.com>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Building Postgres 17.0 with meson
EXTERNAL
---- On Wed, 06 Nov 2024 09:59:37 +0530 Mark Hill <Mark.Hill@sas.com> wrote ---
I’m trying to build Postgres 17.0 and have about learning meson as I go.
The build setup command I have so far is:
meson setup build --prefix=%prefix% --buildtype=release -Dssl=auto -Dzlib=auto -Dicu=auto
but I believe that cmd expects ssl, zlib, and icu to be installed in default locations.
How do I specify to meson that I want it to use the versions of those 3 software packages that I have built
e.g. the openssl I want it to use is located in D:\Postgres-Builds\OpenSSL\OpenSSL-Install\OpenSSL-3.1.6-wx6
and similar locations for icu and zlib?
Thanks, Mark
Specify the lib's paths in "-Dextra_lib_dirs" during meson setup
e.g. meson setup build --prefix=%prefix% --buildtype=release -Dextra_lib_dirs=D:\Postgres-Builds\OpenSSL\OpenSSL-Install\OpenSSL-3.1.6-wx6
https://www.postgresql.org/docs/current/install-meson.html#CONFIGURE-EXTRA-LIB-DIRS-MESON
Regards,
Srinath Reddy Sadipiralla
Member Technical Staff
ZOHO
On Wed, Nov 6, 2024 at 2:59 PM Mark Hill <Mark.Hill@sas.com> wrote: > Srinath is in India I believe and not available currently. Does anybody have any idea why meson > > is not finding the paths I’m specifying with the -Dextra_lib_dirs and -Dextra_include_dirs? See below. I am not an expert on this topic, but do use these options on macOS and they do work for me. A typical 'meson setup' invocation for me is: meson setup $HOME/pgsql $HOME/pgsql-meson -Dcassert=true -Ddebug=true -Dextra_include_dirs=/opt/local/include -Dextra_lib_dirs=/opt/local/lib -Dprefix=$HOME/install/dev In your example, you set extra_lib_dirs=%openssl_directory%,%zlib_directory%,%icu4c_directory%. Those aren't actually pathnames, so something (your shell, for instance) would have to be substituting the actual correct pathnames. Maybe that isn't happening, or maybe the pathnames that are being substituted are not the right ones, or maybe they don't contain the files that meson thinks they ought to contain. One thing that you could do is have a look at the meson log file. On my machine, that shows up inside the directory where I run 'meson setup' at meson-logs/meson-logs.txt. I am not sure if it's different on Windows. If you look in that file for strings like icu or openssl or zlib, you may be able to understand what is going wrong. As far as "Srinath is in India I believe and not available currently," while that is probably true, I'm not sure that's really the issue. Your original email didn't give the exact command you ran, the exact output you got, or any error messages or log files. Your follow-up email didn't include any of that either, except material quoted from another email that you apparently sent off-list, and even that wasn't nearly as detailed as many posts that you will see here. Also, see also the "Email etiquette mechanics" section of https://wiki.postgresql.org/wiki/Mailing_Lists which suggests keeping replies on-list and not top-posting. -- Robert Haas EDB: http://www.enterprisedb.com
Hi, On Wed, 13 Nov 2024 at 18:17, Mark Hill <Mark.Hill@sas.com> wrote: > > The error above says meson can't find openssl/ssl.h but it's there: > D:\Jenkins\workspace\workspace\Postgres-9.4\PostgreSQL\postgres-Source\buildPostgreSQL_wx6_17.0\postgresql-17.0>dir D:\Jenkins\workspace\workspace\Postgres-9.4\OpenSSL\OpenSSL-Install\OpenSSL-3.1.6-wx6\include\openssl\ssl.h > Volume in drive D is Data > Volume Serial Number is 58B5-7193 > > Directory of D:\Jenkins\workspace\workspace\Postgres-9.4\OpenSSL\OpenSSL-Install\OpenSSL-3.1.6-wx6\include\openssl > > 08/12/2024 04:22 PM 127,595 ssl.h > 1 File(s) 127,595 bytes > 0 Dir(s) 210,974,670,848 bytes free > > I don't know why meson cannot find the OpenSSL installation I've specified via the options: > extra_lib_dirs > extra_include_dirs I think that the problem is that you are setting '.../include/openssl' as an include_dir not '.../include'. Could you please try: set openssl_include_dir=D:\Jenkins\workspace\workspace\Postgres-9.4\OpenSSL\OpenSSL-Install\OpenSSL-3.1.6-wx6\include -- Regards, Nazir Bilal Yavuz Microsoft
On Wed, 13 Nov 2024 at 10:53AM(EST), Nazir Bilal Yavuz <byavuz81@gmail.com > wrote: > I think that the problem is that you are setting '.../include/openssl' > as an include_dir not '.../include'. Could you please try: > set openssl_include_dir=D:\Jenkins\workspace\workspace\Postgres-9.4\OpenSSL\OpenSSL-Install\OpenSSL-3.1.6-wx6\include Hi Nazir, Thank you, that worked! I had actually tried that with openssl, icu, and zlib all enabled but when either icu or zlib failedit didn't get as far as openssl so I didn't know that it would work until I tried with just openssl by itself. I have the setup workingnow but ninja fails when I do the setup with openssl, zlib, and icu. If I setup just openssl and zlib, the build works. With openssl, zlib, and icu enabled in the setup, the ninja build fails trying to link src/backend/postgres.exe. There are40 unresolved external symbol errors (see below.) I checked a few of the symbols and they appear in the Postgres source without the "_72"text on the end. Is it getting "72" from the version of icu4c I'm using, 72.1? Anyone know how to prevent these errors? Thanks, Mark [1206/2170] Linking target src/backend/postgres.exe FAILED: src/backend/postgres.exe "link" @src/backend/postgres.exe.rsp Creating library src\backend\postgres.lib commands_collationcmds.c.obj : error LNK2019: unresolved external symbol uloc_getDisplayName_72 referenced in function get_icu_locale_comment commands_collationcmds.c.obj : error LNK2019: unresolved external symbol uloc_getAvailable_72 referenced in function pg_import_system_collations utils_adt_pg_locale.c.obj : error LNK2001: unresolved external symbol uloc_getAvailable_72 commands_collationcmds.c.obj : error LNK2019: unresolved external symbol uloc_countAvailable_72 referenced in function pg_import_system_collations utils_adt_pg_locale.c.obj : error LNK2001: unresolved external symbol uloc_countAvailable_72 regex_regcomp.c.obj : error LNK2019: unresolved external symbol u_islower_72 referenced in function pg_wc_islower regex_regcomp.c.obj : error LNK2019: unresolved external symbol u_isupper_72 referenced in function pg_wc_isupper regex_regcomp.c.obj : error LNK2019: unresolved external symbol u_isdigit_72 referenced in function pg_wc_isdigit regex_regcomp.c.obj : error LNK2019: unresolved external symbol u_isalpha_72 referenced in function pg_wc_isalpha regex_regcomp.c.obj : error LNK2019: unresolved external symbol u_isalnum_72 referenced in function pg_wc_isalnum regex_regcomp.c.obj : error LNK2019: unresolved external symbol u_ispunct_72 referenced in function pg_wc_ispunct regex_regcomp.c.obj : error LNK2019: unresolved external symbol u_isgraph_72 referenced in function pg_wc_isgraph regex_regcomp.c.obj : error LNK2019: unresolved external symbol u_isspace_72 referenced in function pg_wc_isspace regex_regcomp.c.obj : error LNK2019: unresolved external symbol u_isprint_72 referenced in function pg_wc_isprint regex_regcomp.c.obj : error LNK2019: unresolved external symbol u_tolower_72 referenced in function casecmp regex_regcomp.c.obj : error LNK2019: unresolved external symbol u_toupper_72 referenced in function pg_wc_toupper utils_adt_formatting.c.obj : error LNK2019: unresolved external symbol u_errorName_72 referenced in function icu_convert_case utils_adt_pg_locale.c.obj : error LNK2001: unresolved external symbol u_errorName_72 utils_adt_formatting.c.obj : error LNK2019: unresolved external symbol u_strToUpper_72 referenced in function str_toupper utils_adt_formatting.c.obj : error LNK2019: unresolved external symbol u_strToLower_72 referenced in function str_tolower utils_adt_formatting.c.obj : error LNK2019: unresolved external symbol u_strToTitle_72 referenced in function u_strToTitle_default_BI utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol u_versionToString_72 referenced in function get_collation_actual_version utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol uiter_setString_72 referenced in function pg_strnxfrm_prefix_icu utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol uiter_setUTF8_72 referenced in function pg_strnxfrm_prefix_icu utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol uloc_getLanguage_72 referenced in function icu_validate_locale utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol uloc_canonicalize_72 referenced in function icu_set_collation_attributes utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol uloc_toLanguageTag_72 referenced in function icu_language_tag utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucol_open_72 referenced in function pg_ucol_open utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucol_openRules_72 referenced in function make_icu_collator utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucol_close_72 referenced in function get_collation_actual_version utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucol_strcoll_72 referenced in function pg_strncoll_icu utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucol_strcollUTF8_72 referenced in function pg_strncoll_icu utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucol_getRules_72 referenced in function make_icu_collator utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucol_getSortKey_72 referenced in function pg_strnxfrm_icu utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucol_nextSortKeyPart_72 referenced in function pg_strnxfrm_prefix_icu utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucol_getVersion_72 referenced in function get_collation_actual_version utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucol_setAttribute_72 referenced in function icu_set_collation_attributes utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucnv_open_72 referenced in function init_icu_converter utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucnv_fromUChars_72 referenced in function icu_from_uchar utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol ucnv_toUChars_72 referenced in function uchar_convert utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol u_strlen_72 referenced in function make_icu_collator utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol u_strcat_72 referenced in function make_icu_collator utils_adt_pg_locale.c.obj : error LNK2019: unresolved external symbol u_strcpy_72 referenced in function make_icu_collator src\backend\postgres.exe : fatal error LNK1120: 40 unresolved externals [1211/2170] Compiling C object src/backend/snowball/dict_snowball.dll.p/libstemmer_stem_UTF_8_hindi.c.obj ninja: build stopped: subcommand failed.
Hi Mark, On Fri, 15 Nov 2024 at 16:01, Mark Hill <Mark.Hill@sas.com> wrote: > > On Wed, 14 Nov 2024 at 2:55PM(EST), Mark Hill <Mark.Hill@sas.com > wrote: > > > With openssl, zlib, and icu enabled in the setup, the ninja build fails trying to link src/backend/postgres.exe. > > There are 40 unresolved external symbol errors (see below.) I checked a few of the symbols and they appear > > in the Postgres source without the "_72" text on the end. Is it getting "72" from the version of icu4c I'm using, > > 72.1? Anyone know how to prevent these errors? > > I'm including the meson-log.txt file for the build I reported in my previous post for more information. I don't know the cause of the errors you mentioned. But I know that there is a repository from Dave Page, which builds some dependencies on Windows and compiles Postgres using meson [1]. I guess this may help you. [1] https://github.com/dpage/winpgbuild [1.1] https://github.com/dpage/winpgbuild/actions -- Regards, Nazir Bilal Yavuz Microsoft
On Thu, Nov 14, 2024 at 2:55 PM Mark Hill <Mark.Hill@sas.com> wrote: > With openssl, zlib, and icu enabled in the setup, the ninja build fails trying to link src/backend/postgres.exe. Thereare 40 unresolved > external symbol errors (see below.) I checked a few of the symbols and they appear in the Postgres source without the"_72" text on > the end. Is it getting "72" from the version of icu4c I'm using, 72.1? Anyone know how to prevent these errors? Yeah, I bet the library symbols are versioned. In general, I'd try to figure out if you have more than one ICU install on the machine. Maybe the versions are getting mixed somehow. More specifically, if this were on Linux, I'd try to figure out which ICU library it's linking against to get those symbols and run the appropriate tool on it to list the symbols in that library. On Linux it would be nm. Then for example where it's looking for u_strcpy_72 I would either find that (a) the library contains u_strcpy rather than u_strcpy72, or (b) the library contains u_strcpy_<some-other-number-here> rather than u_strcpy_72, or (c) it doesn't contain any symbols even vaguely of that sort. -- Robert Haas EDB: http://www.enterprisedb.com