bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Cla


From: Sam James
Subject: Missing -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 in pkg-config files in Clang + LLVM environment?
Date: Fri, 9 Sep 2022 00:26:08 +0100

Originally reported to pinentry at https://dev.gnupg.org/T6193.

It looks like -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600
is missing from the .pc files in some environments which
leads to a pinentry build failure with Clang 15.

This is on a musl + Clang system (details below for how
to reproduce).

When going through a full package rebuild with Clang 15 (which
makes implicit function declarations an error by default, among
other changes: 
https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#improvements-to-clang-s-diagnostics),
I hit a build failure in pinentry:
```
clang -DHAVE_CONFIG_H -I. -I..   -I../secmem -Wall -I/usr/include/ncursesw  -O2 
-pipe -fdiagnostics-color=always -frecord-gcc-switches -Wall -Wno-pointer-sign 
-Wpointer-arith -c -o libpinentry_curses_a-pinentry-curses.o `test -f 
'pinentry-curses.c' || echo './'`pinentry-curses.c
pinentry-curses.c:651:8: error: call to undeclared function 'addnwstr'; ISO C99 
and later do not support implicit function declarations 
[-Wimplicit-function-declaration]
              ADDCH (start[i]);
              ^
[...]
```

On a "normal" Gentoo system (glibc + gcc):
```
$ pkg-config --cflags ncurses
-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600
```

But in this musl + pure LLVM environment:
```
$ pkg-config --cflags nurses

```

I appreciate that testing on other distros
can be a pain. This particular environment
is an experimental Clang + pure LLVM setup
(no GCC, uses libc++, etc).

A "stage3" can be found at
https://mirror.bytemark.co.uk/gentoo/releases/amd64/autobuilds/current-stage3-amd64-musl-clang/stage3-amd64-musl-clang-20220821T170533Z.tar.xz.

It should be possible to chroot into this,
run the following commands:
1. emerge --sync
2. echo 'ACCEPT_KEYWORDS=~amd64' >> /etc/portage.make.conf # needed to get LLVM 
15
3. emerge -v1 sys-devel/clang:15 # upgrade Clang
2. emerge -v1 sys-libs/ncurses
3. emerge -v1 app-crypt/pinentry # or just run pkg-config at this point
... to hit the problem.

(There is no need to do a system install, a chroot is sufficient.
If desired, I can try cook up a Dockerfile as some folks
find that easier to use.)

If more information is needed, just let me know,
and I'll grab whatever is required.

Best,
sam

Attachment: signature.asc
Description: Message signed with OpenPGP


reply via email to

[Prev in Thread] Current Thread [Next in Thread]