Re: meson vs. llvm bitcode files

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: meson vs. llvm bitcode files
Date: 2026-03-18 22:23:35
Message-ID: CAN4CZFNLJ9_-0H7kCQA+CLnjvS3eU=oq2=TPjCqbP+VhOg9CsQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

+ bitcode_targets += custom_target(
+ targetname,
+ depends: [bitcode_obj],
+ input: [srcfile],
+ output: targetname,
+ command: [llvm_irgen_command, bitcode_cflags_gen_local],
+ install: true,
+ install_dir: dir_bitcode,
+ )

This seems overeager to rebuild to me. If I touch a single header
file, it rebuilds all bc files because bitcode_obj (postgres_lib)
changes.

Wouldn't something like the following work?

bitcode_targets += custom_target(
targetname,
depends: [generated_backend_headers_stamp], # instead of [postgres_lib]
input: [srcfile],
output: targetname,
command: [llvm_irgen_command, llvm_irgen_dep_args,
bitcode_cflags_local], # added llvm_irgen_dep_args
depfile: targetname + '.d', # added
install: true,
install_dir: dir_bitcode,
)

It seems to work in my testing, and results in less rebuilds. But I
also have a fairly recent meson version, there might be some
issues/limitations with earlier versions?

+bitcode_modules += {
+ 'target': hstore_plpython,
+ 'srcfiles': hstore_plpython_sources,
+ 'additional_flags': [
+ '-I(at)0@'.format(hstore_dir_up),
+ '-DPLPYTHON_LIBNAME="plpython3"',
+ '-I(at)0@'.format(python3_incdir),
+ '-I(at)0@'.format(plpython_dir),
+ perl_ccflags,
+ ]
+}

Do we need perl_ccflags for python?

+meson_args = ' '.join(args.meson_args)
...
+ if meson_args:
+ meson_setup_command = [meson_bin, meson_args, 'setup',
test_args, test_out_dir]
+ else:

Will this properly work with multiple args?

+
+project('auth_delay', 'c')
+

Seems like a copy paste mistake, this is in postgres_fdw

+ if meson_args:
+ meson_setup_command = [meson_bin, meson_args, 'setup',
test_args, test_out_dir]
+ else:
+ meson_setup_command = [meson_bin, 'setup', test_args, test_out_dir]
+
+ meson_compile_command = ['meson', 'compile', '-C', test_out_dir, '-v']

last one should also be meson_bin

+
+exit_code = 0
+

This is an unused variable

src/makefiles/meson.build contains the following, this should be
updated with this patch?

# TODO: requires bitcode generation to be implemented for meson
'BITCODE_CFLAGS': '',
'BITCODE_CXXFLAGS': '',

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-03-18 22:26:42 Re: pg_plan_advice
Previous Message Robert Haas 2026-03-18 22:19:31 Re: pg_plan_advice