I'm getting build failures when building with meson and llvm enabled,
like this:
[1/112] Generating src/backend/jit/llvm/llvmjit_types.bc with a custom
command
FAILED: src/backend/jit/llvm/llvmjit_types.bc
/usr/local/bin/ccache /usr/local/Cellar/llvm/18.1.6/bin/clang -c -o
src/backend/jit/llvm/llvmjit_types.bc
../src/backend/jit/llvm/llvmjit_types.c -flto=thin -emit-llvm -MD -MQ
src/backend/jit/llvm/llvmjit_types.bc -MF
src/backend/jit/llvm/llvmjit_types.c.bc.d -O2 -Wno-ignored-attributes
-Wno-empty-body -fno-strict-aliasing -fwrapv -I./src/include
-I./src/backend/utils/misc -I../src/include
In file included from ../src/backend/jit/llvm/llvmjit_types.c:27:
In file included from ../src/include/postgres.h:45:
../src/include/c.h:75:10: fatal error: 'libintl.h' file not found
75 | #include <libintl.h>
| ^~~~~~~~~~~
1 error generated.
The reason is that libintl.h is at /usr/local/include/libintl.h, but
that is not in the include path for this command. I have
-I/usr/local/include in CPPFLAGS in the environment, which is why the
normal compilation commands pick it up, but this is not used by this
custom command.
Wit this small patch I can make it work:
diff --git a/src/backend/jit/llvm/meson.build
b/src/backend/jit/llvm/meson.build
index 41c759f73c5..4a4232661ba 100644
--- a/src/backend/jit/llvm/meson.build
+++ b/src/backend/jit/llvm/meson.build
@@ -63,6 +63,7 @@ bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv']
if llvm.version().version_compare('=15.0')
bitcode_cflags += ['-Xclang', '-no-opaque-pointers']
endif
+bitcode_cflags += get_option('c_args')
bitcode_cflags += cppflags
# XXX: Worth improving on the logic to find directories here
Is that correct?