Skip to contentSkip to conversation

Qt application on Xenomai

DISCUSSION [email protected] 2 participants 2 messages Apr 3, 2019 – Apr 4, 2019

lore
Share & tools
lore
#0 lore raw

Hi, Stéphane
I want to compile RT-task with QT-5.8-linux.
The application build well,but the app break when I run it. Here are some mesg:

[ 1856.686076] xenomaipro[22438]: segfault at 7ffea0117ff8 ip 00007fef26a3ae17 sp 00007ffea0118000 error 6 in libcobalt.so.2.0.0[7fef26a2f000+1f000]

I can find the program break when it runs : rt_task_create().
How can I fix this? I think the .pro is something missing, but can you fix it please? Many thanks!

My platform is ubuntu16 、linux4.4 and xenoam 3.0.5,using QT 5.8.

My qt project:
main.c:
#include <QCoreApplication> #include <stdlib.h> #include <math.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <sched.h> #include <time.h> #include <unistd.h> #include <signal.h> #include <alchemy/task.h> #include <alchemy/timer.h> RT_TASK task; static void latency(void *cookie) { RTIME start_ns; int ret; start_ns = rt_timer_read() + 1000000; ret = rt_task_set_periodic(NULL, start_ns, 10000000); if (ret) { printf("rt_task_set_periodic error\n"); return; } while(1){ rt_task_wait_period(NULL); printf("0\n"); } } int main(int argc, char *argv[]) { int ret; QCoreApplication a(argc, argv); ret = rt_task_create(&task, "task_name", 0, 99, 0); //break here!!! if (ret) { printf("rt_task_create error\n"); return 0; } ret = rt_task_start(&task, &latency, NULL); if (ret) { printf("rt_task_start error\n"); return 0; } return a.exec(); }

and .pro is:
QT += core
QT -= gui

CONFIG += c++11

TARGET = xenomaipro
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app

SOURCES += main.cpp

# The following define makes your compiler emit warnings if you use

# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
#LIBS += -L/usr/xenomai/lib -lalchemy -lanalogy -lcobalt -lcopperplate -lmodechk -lpsos -lsmokey -ltrank -lvxworks -lpthread -lrt INCLUDEPATH += /usr/xenomai/include
INCLUDEPATH += /usr/xenomai/include/cobalt

unix:!macx: LIBS += -L$$PWD/../../../../usr/xenomai/lib/ -lalchemy

INCLUDEPATH += $$PWD/../../../../usr/xenomai/include DEPENDPATH += $$PWD/../../../../usr/xenomai/include

unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../usr/xenomai/lib/libalchemy.a

unix:!macx: LIBS += -L$$PWD/../../../../usr/xenomai/lib/ -lcobalt

INCLUDEPATH += $$PWD/../../../../usr/xenomai/include DEPENDPATH += $$PWD/../../../../usr/xenomai/include

unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../usr/xenomai/lib/libcobalt.a

unix:!macx: LIBS += -L$$PWD/../../../../usr/xenomai/lib/ -lanalogy

INCLUDEPATH += $$PWD/../../../../usr/xenomai/include DEPENDPATH += $$PWD/../../../../usr/xenomai/include

unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../usr/xenomai/lib/libanalogy.a

unix:!macx: LIBS += -L$$PWD/../../../../usr/xenomai/lib/ -lcopperplate

INCLUDEPATH += $$PWD/../../../../usr/xenomai/include DEPENDPATH += $$PWD/../../../../usr/xenomai/include

unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../usr/xenomai/lib/libcopperplate.a

unix:!macx: LIBS += -L$$PWD/../../../../usr/xenomai/lib/ -lmodechk

INCLUDEPATH += $$PWD/../../../../usr/xenomai/include DEPENDPATH += $$PWD/../../../../usr/xenomai/include

unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../usr/xenomai/lib/libmodechk.a

unix:!macx: LIBS += -L$$PWD/../../../../usr/xenomai/lib/ -lpsos

INCLUDEPATH += $$PWD/../../../../usr/xenomai/include DEPENDPATH += $$PWD/../../../../usr/xenomai/include

unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../usr/xenomai/lib/libpsos.a

unix:!macx: LIBS += -L$$PWD/../../../../usr/xenomai/lib/ -lsmokey

INCLUDEPATH += $$PWD/../../../../usr/xenomai/include DEPENDPATH += $$PWD/../../../../usr/xenomai/include

unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../usr/xenomai/lib/libsmokey.a

unix:!macx: LIBS += -L$$PWD/../../../../usr/xenomai/lib/ -ltrank

INCLUDEPATH += $$PWD/../../../../usr/xenomai/include DEPENDPATH += $$PWD/../../../../usr/xenomai/include

unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../usr/xenomai/lib/libtrank.a

unix:!macx: LIBS += -L$$PWD/../../../../usr/xenomai/lib/ -lvxworks

INCLUDEPATH += $$PWD/../../../../usr/xenomai/include DEPENDPATH += $$PWD/../../../../usr/xenomai/include

unix:!macx: PRE_TARGETDEPS += $$PWD/../../../../usr/xenomai/lib/libvxworks.a

[email protected]

#1 lore raw

Can you post your source files somewhere? I can't see what's going on because all the code is a paragraph and word wrapped.

Alec