* [ada] fix unknown type name 'cpu_set_t'
@ 2023-02-27 15:15 宋冬生
2023-02-27 15:45 ` Andreas Schwab
0 siblings, 1 reply; 2+ messages in thread
From: 宋冬生 @ 2023-02-27 15:15 UTC (permalink / raw)
To: gcc-patches; +Cc: Arnaud Charlet, Eric Botcazou, Marc Poulhiès
Hi,
When building ada with musl, I encountered the following error:
----------------
make[7]: Entering directory '/opt/gcc-build/gcc/build/gcc/ada/rts'
/opt/gcc-build/gcc/build/./gcc/xgcc -B/opt/gcc-build/gcc/build/./gcc/ -B/opt/gcc-13/aarch64-linux-musl/usr/aarch64-linux-musl/bin/ -B/opt/gcc-13/aarch64-linux-musl/usr/aarch64-linux-musl/lib/ -isystem /opt/gcc-13/aarch64-linux-musl/usr/aarch64-linux-musl/include -isystem /opt/gcc-13/aarch64-linux-musl/usr/aarch64-linux-musl/sys-include --sysroot=/opt/gcc-13/aarch64-linux-musl/usr/aarch64-linux-musl/sys-root -c -DCROSS_DIRECTORY_STRUCTURE -DIN_GCC -W -Wall -g -O2 -g -O2 -fexceptions -DIN_RTS -DHAVE_GETIPINFO -fPIC -fno-lto \
-iquote . -iquote .. -iquote ../.. -iquote /opt/gcc-build/gcc/gcc/ada -iquote /opt/gcc-build/gcc/gcc -I/opt/gcc-build/gcc/include -I./../.. adadecode.c -o adadecode.o
In file included from adadecode.c:37:
adaint.h:324:8: error: unknown type name 'cpu_set_t'
324 | extern cpu_set_t *__gnat_cpu_alloc (size_t);
| ^~~~~~~~~
----------------
It can be seen from the man pages[1] that this error is caused by not defining `_GNU_SOURCE`, so I recommend the following fix:
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 987432c93..fa8ddaf13 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -319,6 +319,9 @@ extern void *__gnat_lwp_self (void);
/* Routines for interface to required CPU set primitives */
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
#include <sched.h>
extern cpu_set_t *__gnat_cpu_alloc (size_t);
[1] https://man7.org/linux/man-pages/man3/CPU_SET.3.html
Please help commit if appropriate.
--
Best regards,
Dongsheng Song
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ada] fix unknown type name 'cpu_set_t'
2023-02-27 15:15 [ada] fix unknown type name 'cpu_set_t' 宋冬生
@ 2023-02-27 15:45 ` Andreas Schwab
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2023-02-27 15:45 UTC (permalink / raw)
To: 宋冬生 via Gcc-patches
Cc: 宋冬生,
Arnaud Charlet, Eric Botcazou, Marc Poulhiès
On Feb 27 2023, 宋冬生 via Gcc-patches wrote:
> diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
> index 987432c93..fa8ddaf13 100644
> --- a/gcc/ada/adaint.h
> +++ b/gcc/ada/adaint.h
> @@ -319,6 +319,9 @@ extern void *__gnat_lwp_self (void);
>
> /* Routines for interface to required CPU set primitives */
>
> +#ifndef _GNU_SOURCE
> +#define _GNU_SOURCE
> +#endif
> #include <sched.h>
>
> extern cpu_set_t *__gnat_cpu_alloc (size_t);
Feature test macros must always be defined before any system header is
included.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-27 15:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 15:15 [ada] fix unknown type name 'cpu_set_t' 宋冬生
2023-02-27 15:45 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).