Mercury build fixes
v3 cover Mercury build fixes
The Mercury core and its testsuite no longer build on next, as several includes are only pulled in indirectly with Cobalt, and pipe-1 is built although the Alchemy pipe API only exists with Cobalt.
The missing includes don't depend on the C library: glibc 2.24, 2.35 and 2.44 and uClibc-ng 1.0.59 all fail on the same lines. Only the missing <stdbool.h> depends on the compiler, as GCC 15 and later default to C23, where bool is a keyword.
Tested with next plus this series:
- Mercury with the testsuite, built directly with configure and "make -k" for aarch64 (glibc 2.24, GCC 6), armv7 (glibc 2.44, GCC 16), armv5 (uClibc-ng 1.0.59, GCC 15) and x86_64 (glibc 2.35, GCC 11).
- With Buildroot: Mercury with and without the testsuite and the Alchemy, pSOS and VxWorks skins, for armv5 (uClibc), armv7 (glibc), aarch64 (glibc, GCC 6) and a static uClibc arm toolchain.
- With Buildroot: Cobalt with the testsuite and all skins for armv7 and aarch64, and for x86_64 with GCC 16 together with a 6.12 Dovetail kernel. With uClibc, Cobalt fails as before on __OPEN_NEEDS_MODE in rtdm.c and on the missing <sys/auxv.h> in parse_vdso.c, which this series doesn't touch.
The series also applies cleanly to stable/v3.3.x.
Changes v2 -> v3:
- Added Florian's "testsuite/smokey/alchemytests: Fix build failure with core !cobalt" from wip/flo/refactor-includes as patch 2 (suggested by Florian).
Changes v1 -> v2:
- Rebased on next.
- Dropped the autotune, sched-tp and pSOS/VxWorks GCC 16 fixes, which are already in next (thanks Florian).
- Patch 1: include the headers only for the Mercury core (suggested by Florian).
- New patches 3 and 4: further missing includes found when building the Mercury testsuite.
Florian Bezdeka (1):
testsuite/smokey/alchemytests: Fix build failure with core !cobalt
Yegor Yefremov (4):
lib: Restore includes needed by the Mercury core testsuite/smokey/alchemytests: Add missing includes testsuite/smokey: Include stdbool.h where needed testsuite/gpiobench: Include stdarg.h
lib/boilerplate/setup.c | 3 +++ lib/copperplate/internal.c | 4 ++++ testsuite/gpiobench/gpiobench.c | 1 + testsuite/smokey/alchemytests/Makefile.am | 17 ++++++++++++----- testsuite/smokey/alchemytests/alchemytests.c | 3 +++ testsuite/smokey/alchemytests/event-1.c | 1 + testsuite/smokey/alchemytests/mq-2.c | 1 + testsuite/smokey/alchemytests/task-11.c | 1 + testsuite/smokey/alchemytests/task-2.c | 2 ++ testsuite/smokey/psostests/task-2.c | 1 + testsuite/smokey/vxworkstests/task-2.c | 1 + 11 files changed, 30 insertions(+), 5 deletions(-)
Signature · 1 line
2.34.1
PATCH v3 1/5 lib: Restore includes needed by the Mercury core
Commits 41de7cc7196f ("lib/boilerplate: Cleanup includes") and 7b7ddf4a3658 ("lib/copperplate: Cleanup includes") dropped headers that are still needed by the Mercury-only code paths. With the Cobalt core, that code is not built, but building the Mercury core fails:
setup.c: In function '__xenomai_init':
setup.c:606:23: error: implicit declaration of function 'mlockall' [-Wimplicit-function-declaration] setup.c:606:32: error: 'MCL_CURRENT' undeclared (first use in this function) setup.c:606:46: error: 'MCL_FUTURE' undeclared (first use in this function)
internal.c:108:24: error: '__NR_tkill' undeclared (first use in this function)
Include <sys/mman.h> and <sys/syscall.h> again, only for the Mercury core, after xeno_config.h has been pulled in.
--- lib/boilerplate/setup.c | 3 +++ lib/copperplate/internal.c | 4 ++++ 2 files changed, 7 insertions(+)
lib/boilerplate/setup.c +3 -0
@@ -30,6 +30,9 @@#include <assert.h> #include <xeno_config.h> +#ifdef CONFIG_XENO_MERCURY +#include <sys/mman.h> +#endif #include <boilerplate/lock.h> #include <boilerplate/ancillaries.h> #include <xenomai/init.h>
lib/copperplate/internal.c +4 -0
@@ -31,6 +31,10 @@#include <copperplate/threadobj.h> #include "internal.h" +#ifdef CONFIG_XENO_MERCURY +#include <sys/syscall.h> +#endif +static int thread_spawn_prologue (struct corethread_attributes *cta);static int thread_spawn_epilogue (struct corethread_attributes *cta);
Signature · 1 line
2.34.1
PATCH v3 2/5 testsuite/smokey/alchemytests: Fix build failure with core !cobalt
In reply to Yegor YefremovFrom: Florian Bezdeka <[email protected]>
Taken from lib/alchemy/Makefile:
if XENO_COBALT
libalchemy@CORE@_la_SOURCES += \ pipe.c \ pipe.h
endif
That means that all functions part of pipe.c are missing in libalchemy when build for non-cobalt cores. The following configuration triggered a build/linking error, that revealed that some tests need to depend on the same condition:
./configure --with-core=mercury
The linking errors:
/usr/bin/ld: alchemytests_pipe1-pipe-1.o: in function `rt_pipe_read_until':
pipe-1.c:(.text+0x130): undefined reference to rt_pipe_read_timed' /usr/bin/ld: alchemytests_pipe1-pipe-1.o: in function realtime_task':
pipe-1.c:(.text+0x172): undefined reference to rt_pipe_bind' /usr/bin/ld: pipe-1.c:(.text+0x1cd): undefined reference to rt_pipe_read' /usr/bin/ld: pipe-1.c:(.text+0x26d): undefined reference to rt_pipe_write' /usr/bin/ld: alchemytests_pipe1-pipe-1.o: in function main':
pipe-1.c:(.text+0x4dc): undefined reference to rt_pipe_create' /usr/bin/ld: pipe-1.c:(.text+0x512): undefined reference to rt_pipe_delete' /usr/bin/ld: pipe-1.c:(.text+0x612): undefined reference to rt_pipe_create' /usr/bin/ld: pipe-1.c:(.text+0x67f): undefined reference to rt_pipe_read' /usr/bin/ld: pipe-1.c:(.text+0x73d): undefined reference to rt_pipe_read_timed' /usr/bin/ld: pipe-1.c:(.text+0x7ab): undefined reference to rt_pipe_read' /usr/bin/ld: pipe-1.c:(.text+0x981): undefined reference to `rt_pipe_read_timed'
collect2: error: ld returned 1 exit status
--- testsuite/smokey/alchemytests/Makefile.am | 17 ++++++++++++----- testsuite/smokey/alchemytests/alchemytests.c | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-)
testsuite/smokey/alchemytests/Makefile.am +12 -5
@@ -21,7 +21,6 @@ test_PROGRAMS = \ alchemytests_mq3 \ alchemytests_mutex1 \ alchemytests_mutex2 \ - alchemytests_pipe1 \ alchemytests_sem1 \ alchemytests_sem2 \ alchemytests_task1 \
@@ -36,6 +35,11 @@ test_PROGRAMS = \ alchemytests_task10 \ alchemytests_task11 +if XENO_COBALT +test_PROGRAMS += \ + alchemytests_pipe1 +endif + alchemycppflags = \ $(XENO_USER_CFLAGS) \ -I$(top_srcdir)/include
@@ -75,10 +79,6 @@ alchemytests_mutex2_SOURCES = mutex-2.c alchemytests_mutex2_CPPFLAGS = $(alchemycppflags) alchemytests_mutex2_LDADD = $(alchemyldadd) alchemytests_mutex2_LDFLAGS = @XENO_AUTOINIT_LDFLAGS@ -alchemytests_pipe1_SOURCES = pipe-1.c -alchemytests_pipe1_CPPFLAGS = $(alchemycppflags) -alchemytests_pipe1_LDADD = $(alchemyldadd) -alchemytests_pipe1_LDFLAGS = @XENO_AUTOINIT_LDFLAGS@ alchemytests_mq1_SOURCES = mq-1.c alchemytests_mq1_CPPFLAGS = $(alchemycppflags) alchemytests_mq1_LDADD = $(alchemyldadd)
@@ -143,3 +143,10 @@ alchemytests_task11_SOURCES = task-11.c alchemytests_task11_CPPFLAGS = $(alchemycppflags) alchemytests_task11_LDADD = $(alchemyldadd) alchemytests_task11_LDFLAGS = @XENO_AUTOINIT_LDFLAGS@ + +if XENO_COBALT +alchemytests_pipe1_SOURCES = pipe-1.c +alchemytests_pipe1_CPPFLAGS = $(alchemycppflags) +alchemytests_pipe1_LDADD = $(alchemyldadd) +alchemytests_pipe1_LDFLAGS = @XENO_AUTOINIT_LDFLAGS@ +endif
testsuite/smokey/alchemytests/alchemytests.c +2 -0
@@ -14,7 +14,9 @@ static const char * const tests[] = {"alchemytests_mq3" ,"alchemytests_mutex1" ,"alchemytests_mutex2" , +#ifdef CONFIG_XENO_COBALT"alchemytests_pipe1" , +#endif"alchemytests_sem1" ,"alchemytests_sem2" , "alchemytests_task1",
Signature · 1 line
2.34.1
PATCH v3 3/5 testsuite/smokey/alchemytests: Add missing includes
In reply to Yegor YefremovWith the Mercury core, the alchemy tests fail to build, as some declarations are only pulled in indirectly by the Cobalt headers:
alchemytests.c:43:17: error: implicit declaration of function 'fprintf' [-Wimplicit-function-declaration] alchemytests.c:43:25: error: 'stderr' undeclared (first use in this function) task-2.c:34:17: error: implicit declaration of function 'compiler_barrier' [-Wimplicit-function-declaration]
Include <stdio.h> and <boilerplate/atomic.h>.
--- testsuite/smokey/alchemytests/alchemytests.c | 1 + testsuite/smokey/alchemytests/task-2.c | 1 + 2 files changed, 2 insertions(+)
testsuite/smokey/alchemytests/alchemytests.c +1 -0
@@ -1,4 +1,5 @@// SPDX-License-Identifier: GPL-2.0 +#include <stdio.h> #include <string.h> #include <stdlib.h> #include <smokey/smokey.h>
testsuite/smokey/alchemytests/task-2.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> +#include <boilerplate/atomic.h> #include <copperplate/traceobj.h> #include <alchemy/task.h> #include <alchemy/sem.h>
Signature · 1 line
2.34.1
PATCH v3 4/5 testsuite/smokey: Include stdbool.h where needed
In reply to Yegor YefremovSeveral Alchemy, pSOS and VxWorks tests use bool without including <stdbool.h>. With the Cobalt core, the header is pulled in indirectly, and GCC 15 and later default to C23 where bool is a keyword, but building the Mercury core with an older compiler fails:
event-1.c:14:8: error: unknown type name 'bool'
mq-2.c:10:8: error: unknown type name 'bool'
task-11.c:64:2: error: unknown type name 'bool'
task-2.c:17:8: error: unknown type name 'bool'
Include <stdbool.h> in the affected tests.
--- testsuite/smokey/alchemytests/event-1.c | 1 + testsuite/smokey/alchemytests/mq-2.c | 1 + testsuite/smokey/alchemytests/task-11.c | 1 + testsuite/smokey/alchemytests/task-2.c | 1 + testsuite/smokey/psostests/task-2.c | 1 + testsuite/smokey/vxworkstests/task-2.c | 1 + 6 files changed, 6 insertions(+)
testsuite/smokey/alchemytests/event-1.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <copperplate/traceobj.h> #include <alchemy/task.h> #include <alchemy/event.h>
testsuite/smokey/alchemytests/mq-2.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <boilerplate/ancillaries.h> #include <copperplate/traceobj.h> #include <alchemy/task.h>
testsuite/smokey/alchemytests/task-11.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <copperplate/traceobj.h> #include <alchemy/task.h>
testsuite/smokey/alchemytests/task-2.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <boilerplate/atomic.h> #include <copperplate/traceobj.h> #include <alchemy/task.h>
testsuite/smokey/psostests/task-2.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <stdio.h> #include <stdlib.h> +#include <stdbool.h> #include <copperplate/traceobj.h> #include <copperplate/threadobj.h> #include <psos/psos.h>
testsuite/smokey/vxworkstests/task-2.c +1 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include <stdlib.h> +#include <stdbool.h> #include <unistd.h> #include <copperplate/threadobj.h> #include <copperplate/traceobj.h>
Signature · 1 line
2.34.1
PATCH v3 5/5 testsuite/gpiobench: Include stdarg.h
In reply to Yegor Yefremovgpiobench uses va_list, va_start() and va_end(), but stopped including <stdarg.h> indirectly when <xenomai/init.h> was dropped. With the Cobalt core, the header still comes in through other headers, but building the Mercury core fails:
gpiobench.c:268:9: error: unknown type name 'va_list'
gpiobench.c:283:9: error: implicit declaration of function 'va_start' [-Wimplicit-function-declaration]
Include <stdarg.h> directly.
--- testsuite/gpiobench/gpiobench.c | 1 + 1 file changed, 1 insertion(+)
testsuite/gpiobench/gpiobench.c +1 -0
@@ -21,6 +21,7 @@* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include <stdarg.h> #include <stdlib.h> #include <stdio.h> #include <string.h>
Signature · 1 line
2.34.1
Jan Kiszka
AppliedQuoted 48 lines · Yegor Yefremov
The Mercury core and its testsuite no longer build on next, as several includes are only pulled in indirectly with Cobalt, and pipe-1 is built although the Alchemy pipe API only exists with Cobalt.
The missing includes don't depend on the C library: glibc 2.24, 2.35 and 2.44 and uClibc-ng 1.0.59 all fail on the same lines. Only the missing <
stdbool.h> depends on the compiler, as GCC 15 and later default to C23, where bool is a keyword.Tested with next plus this series:
- Mercury with the testsuite, built directly with configure and "make -k" for aarch64 (glibc 2.24, GCC 6), armv7 (glibc 2.44, GCC 16), armv5 (uClibc-ng 1.0.59, GCC 15) andx86_64(glibc 2.35, GCC 11).
- With Buildroot: Mercury with and without the testsuite and the Alchemy, pSOS and VxWorks skins, for armv5 (uClibc), armv7 (glibc), aarch64 (glibc, GCC 6) and a static uClibc arm toolchain.
- With Buildroot: Cobalt with the testsuite and all skins for armv7 and aarch64, and forx86_64with GCC 16 together with a 6.12 Dovetail kernel. With uClibc, Cobalt fails as before on__OPEN_NEEDS_MODEinrtdm.cand on the missing <sys/auxv.h> inparse_vdso.c, which this series doesn't touch.The series also applies cleanly to stable/v3.3.x.
Changes v2 -> v3:
- Added Florian's "testsuite/smokey/alchemytests: Fix build failure with core !cobalt" from wip/flo/refactor-includes as patch 2 (suggested by Florian).Changes v1 -> v2:
- Rebased on next.
- Dropped the autotune, sched-tp and pSOS/VxWorks GCC 16 fixes, which are already in next (thanks Florian).
- Patch 1: include the headers only for the Mercury core (suggested by Florian).
- New patches 3 and 4: further missing includes found when building the Mercury testsuite.Florian Bezdeka (1):
testsuite/smokey/alchemytests: Fix build failure with core !cobaltYegor Yefremov (4):
lib: Restore includes needed by the Mercury core testsuite/smokey/alchemytests: Add missing includes testsuite/smokey: Includestdbool.hwhere needed testsuite/gpiobench: Includestdarg.h
Quoted 13 lines
lib/boilerplate/setup.c | 3 +++ lib/copperplate/internal.c | 4 ++++ testsuite/gpiobench/gpiobench.c | 1 + testsuite/smokey/alchemytests/Makefile.am | 17 ++++++++++++----- testsuite/smokey/alchemytests/alchemytests.c | 3 +++ testsuite/smokey/alchemytests/event-1.c | 1 + testsuite/smokey/alchemytests/mq-2.c | 1 + testsuite/smokey/alchemytests/task-11.c | 1 + testsuite/smokey/alchemytests/task-2.c | 2 ++ testsuite/smokey/psostests/task-2.c | 1 + testsuite/smokey/vxworkstests/task-2.c | 1 + 11 files changed, 30 insertions(+), 5 deletions(-)
Thanks, applied to next. I need to spend some time on backporting fixes to stable, soon...
Jan
Signature · 2 lines
Siemens AG, Foundational Technologies Linux Expert Center