unicode test programs don't build with meson

Started by Peter Eisentrautover 1 year ago3 messageshackers
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

The test programs in src/common/unicode/ (case_test, category_test,
norm_test), don't build with meson if the nls option is enabled, because
a libintl dependency is missing.

(pg_strerror_r() in src/port/strerror.c makes a gettext call, so in that
sense libpgport has a dependency on libintl.)

The makefiles are ok, because they just link all programs against all
libraries that configure finds, more or less, but meson needs explicit
dependencies declared.

I can see a few ways to fix that, so I'm looking for feedback on which
way is best.

1) Add libintl directly to the affected programs, like

  case_test = executable('case_test',
    ['case_test.c'],
-  dependencies: [frontend_port_code, icu],
+  dependencies: [frontend_port_code, icu, libintl],
    include_directories: inc,
    link_with: [common_static, pgport_static],
    build_by_default: false,

etc.

2) Add libintl as a dependency of frontend_port_code:

--- a/meson.build
+++ b/meson.build
@@ -2986,7 +2986,7 @@ subdir('config')
  frontend_port_code = declare_dependency(
    compile_args: ['-DFRONTEND'],
    include_directories: [postgres_inc],
-  dependencies: os_deps,
+  dependencies: [os_deps, libintl],
  )

3) Add libintl to os_deps directly?

4) Change the dependencies of the test programs to something like

--- a/src/common/unicode/meson.build
+++ b/src/common/unicode/meson.build
@@ -75,7 +75,7 @@ inc = include_directories('.')

norm_test = executable('norm_test',
['norm_test.c', norm_test_table],
- dependencies: [frontend_port_code],
+ dependencies: [frontend_code],
include_directories: inc,
link_with: [common_static, pgport_static],
build_by_default: false,

Or something else, or some combination?

#2Aleksander Alekseev
aleksander@timescale.com
In reply to: Peter Eisentraut (#1)
Re: unicode test programs don't build with meson

Hi Peter,

1) Add libintl directly to the affected programs, like

case_test = executable('case_test',
['case_test.c'],
-  dependencies: [frontend_port_code, icu],
+  dependencies: [frontend_port_code, icu, libintl],
include_directories: inc,
link_with: [common_static, pgport_static],
build_by_default: false,

To me the first option seems to be the most natural one (does the
program depend on the library? add it to the list of dependencies for
this program). Also it seems to be most consistent with what we
currently have, see how icu is listed.

--
Best regards,
Aleksander Alekseev

#3Peter Eisentraut
peter_e@gmx.net
In reply to: Aleksander Alekseev (#2)
Re: unicode test programs don't build with meson

On 18.10.24 15:17, Aleksander Alekseev wrote:

1) Add libintl directly to the affected programs, like

case_test = executable('case_test',
['case_test.c'],
-  dependencies: [frontend_port_code, icu],
+  dependencies: [frontend_port_code, icu, libintl],
include_directories: inc,
link_with: [common_static, pgport_static],
build_by_default: false,

To me the first option seems to be the most natural one (does the
program depend on the library? add it to the list of dependencies for
this program). Also it seems to be most consistent with what we
currently have, see how icu is listed.

As there were no other opinions forthcoming, I have committed it like
this. Thanks!