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

Reply via email to