Subject: Re: Meson and Numa: C header not found

From: Tomas Vondra <[email-masked]>
Date: Thu, 10 Apr 2025 11:22:29 +0200

On 4/10/25 08:00, Daniel Westermann (DWE) wrote:
> Hi,
> 
> I wanted to play a bit with the Numa stuff recently committed but Meson fails to find numa.h:
> 
> Found pkg-config: YES (/usr/bin/pkg-config) 2.3.0
> Run-time dependency numa found: YES 2.0.19
> 
> ../postgresql/meson.build:957:12: ERROR: C header 'numa.h' not found
> 
> Is this expected? The header file is there:
> 
> postgres@pgbox:/home/postgres/ [DEV] sudo find / -name numa.h
> /usr/include/numa.h
> 
> This is a Fedora 41 system.
> 

That's weird. I'm on Fedora 41 too, and I don't have this issue. If I do

    $ meson setup build

I get

    libnuma : YES 2.0.19

and then

    ninja -C build

completes just fine. What exactly are the commands you're executing?

FWIW I guess -hackers would be a better place for this question.

regards

-- 
Tomas Vondra

---

From: "Daniel Westermann (DWE)" <[email-masked]>
Date: Thu, 10 Apr 2025 09:53:06 +0000

>FWIW I guess -hackers would be a better place for this question.

Nothing special, just this:

meson configure -Dprefix=${PGHOME} \
                -Dbindir=${PGHOME}/bin \
                -Ddatadir=${PGHOME}/share \
                -Dincludedir=${PGHOME}/include \
                -Dlibdir=${PGHOME}/lib \
                -Dsysconfdir=${PGHOME}/etc \
                -Dpgport=5432 \
                -Dplperl=enabled \
                -Dplpython=enabled \
                -Dssl=openssl \
                -Dpam=enabled \
                -Dldap=enabled \
                -Dlibxml=enabled \
                -Dlibxslt=enabled \
                -Dsegsize=${SEGSIZE} \
                -Dblocksize=${BLOCKSIZE} \
                -Dllvm=enabled \
                -Duuid=ossp \
                -Dzstd=enabled \
                -Dlz4=enabled \
                -Dzstd=enabled \
                -Dgssapi=enabled \
                -Dsystemd=enabled \
                -Dicu=enabled \
                -Dlibcurl=enabled \
                -Dliburing=enabled \
                -Dlibnuma=disabled \
                -Dsystem_tzdata=/usr/share/zoneinfo
ninja 
ninja install

Regards
Daniel

---

From: Tomas Vondra <[email-masked]>
Date: Thu, 10 Apr 2025 12:07:45 +0200

>                 -Dsystem_tzdata=/usr/share/zoneinfo

Are you sure this is the sequence that fails? Because this has

 -Dlibnuma=disabled

so that shouldn't build the NUMA stuff at all.

regards

-- 
Tomas Vondra

---

From: Tom Lane <[email-masked]>
Date: Thu, 10 Apr 2025 10:33:15 -0400

> That's weird. I'm on Fedora 41 too, and I don't have this issue. If I do

I couldn't reproduce it on F41 either.  Note that you need to
have numactl-devel installed else /usr/include/numa.h isn't
there; but meson seems to fail as-expected without that,
or silently fall back to libnuma=disabled if you don't try to
force it.

			regards, tom lane

---

From: "Daniel Westermann (DWE)" <[email-masked]>
Date: Thu, 10 Apr 2025 15:48:40 +0000

force it.
  
It is there:

postgres@pgbox:/home/postgres/ [DEV] ls /usr/include/numa.h
/usr/include/numa.h

Regards
Daniel

---

From: Tom Lane <[email-masked]>
Date: Thu, 10 Apr 2025 12:10:20 -0400

> postgres@pgbox:/home/postgres/ [DEV] ls /usr/include/numa.h

Just to confirm, do you have all of these in /usr/lib64?

$ ls -l /usr/lib64/libnuma*
lrwxrwxrwx. 1 root root    16 Nov  4 19:00 /usr/lib64/libnuma.so -> libnuma.so.1.0.0
lrwxrwxrwx. 1 root root    16 Nov  4 19:00 /usr/lib64/libnuma.so.1 -> libnuma.so.1.0.0
-rwxr-xr-x. 1 root root 62424 Nov  4 19:00 /usr/lib64/libnuma.so.1.0.0

As of HEAD, line 957 of meson.build is

  if not cc.has_header('numa.h', dependencies: libnuma, required: libnumaopt)

I'm not familiar at all with meson, but I wonder exactly what the
dependencies: bit does.  That kind of looks like it might cause the
check to fail if the libnuma library isn't there, which is something
we do need to check, but doing it this way seems like it'd produce
a pretty misleading failure message if numa.h exists but the library
doesn't.

			regards, tom lane

---

From: "Daniel Westermann (DWE)" <[email-masked]>
Date: Thu, 10 Apr 2025 16:26:54 +0000

>  if not cc.has_header('numa.h', dependencies: libnuma, required: libnumaopt)

postgres@pgbox:/home/postgres/ [DEV] ls -l /usr/lib64/libnuma*
lrwxrwxrwx. 1 root root    16 Nov  5 01:00 /usr/lib64/libnuma.so -> libnuma.so.1.0.0
lrwxrwxrwx. 1 root root    16 Nov  5 01:00 /usr/lib64/libnuma.so.1 -> libnuma.so.1.0.0
-rwxr-xr-x. 1 root root 62424 Nov  5 01:00 /usr/lib64/libnuma.so.1.0.0
18:25:38 postgres@pgbox:/home/postgres/ [DEV]

Yes, it it there

Regards
Daniel

---

From: Tom Lane <[email-masked]>
Date: Thu, 10 Apr 2025 12:39:22 -0400

> Yes, it it there

That's just weird then.  The only other theory that comes to mind
is that there's something wrong with the SELinux attributes on these
files.  restorecon might help if so.

			regards, tom lane