Building example code
Hello!
My team and I are trying to build an EVL-based application on a Raspberry Pi 4B [1] without success. We followed the steps reported in the guide [2] to compile the code in [3].
It would be great if you could tell us what we did wrong.
Many thanks for your work!
[1] kernel 5.15.35-v8, compiled using https://source.denx.de/Xenomai/xenomai4/linux-evl
[2] https://evlproject.org/core/user-api/#build-evl-app
[3] https://evlproject.org/core/user-api/thread/#thread-services
source code (foo.c)
#include <sys/types.h>
#include <unistd.h>
#include <sched.h>
#include <pthread.h>
#include <evl/sched.h>
#include <evl/thread.h>
int main(int argc, char *argv[])
{
struct sched_param param;
int ret, tfd;
param.sched_priority = 8;
ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m);
/* EVL inherits the in-band scheduling params upon attachment. */
tfd = evl_attach_self("app-main-thread:%d", getpid());
/*
* Now main() is running out-of-band, in the EVL SCHED_FIFO
* class at priority 8.
*/
return 0;
}
meson.build
project('a_foo_system', [ 'c' ], version : '0.0.0')
pthread_dep = dependency('threads')
libevl_dep = dependency('evl', method : 'pkg-config')
executable('foo',
'foo.c',
install: true,
dependencies : [ libevl_dep, pthread_dep ],
)
compiler output
FAILED: foo.p/foo.c.o
cc -Ifoo.p -I. -I../src -I/usr/evl/include -I/usr/evl/include/evl -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O0 -g -pthread -MD -MQ foo.p/foo.c.o -MF foo.p/foo.c.o.d -o foo.p/foo.c.o -c ../src/foo.c
../src/foo.c: In function ‘main’:
../src/foo.c:11:21: error: storage size of ‘param’ isn’t known
11 | struct sched_param param;
| ^~~~~
../src/foo.c:15:46: error: ‘SCHED_FIFO’ undeclared (first use in this function); did you mean ‘SCHED_TP’?
15 | ret = pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m);
| ^~~~~~~~~~
| SCHED_TP
../src/foo.c:15:46: note: each undeclared identifier is reported only once for each function it appears in
../src/foo.c:12:11: warning: variable ‘tfd’ set but not used [-Wunused-but-set-variable]
12 | int ret, tfd;
| ^~~
../src/foo.c:12:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
12 | int ret, tfd;
| ^~~
../src/foo.c:11:21: warning: unused variable ‘param’ [-Wunused-variable]
11 | struct sched_param param;
| ^~~~~
ninja: build stopped: subcommand failed.
Edited by Roberto Ferri