small fix for llvm build

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: small fix for llvm build
Date: 2024-05-28 15:17:34
Message-ID: c1384a7b-ed12-4862-a0da-a05c7945171a@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2024-05-28 15:18:02 Re: Schema variables - new implementation for Postgres 15
Previous Message James Coleman 2024-05-28 15:11:11 Re: Add last_commit_lsn to pg_stat_database