Code generation error for Raspberry Pi 3 when using referenced model
10 views (last 30 days)
Show older comments
I'm getting errors on te build process for Raspberry Pi 3 for a model that implements drivers for the Navio2 https://emlid.com/navio/ board. I implemented the model using drivers written in C++, and interface with MATLAB/Simulink using the matlab system object https://www.mathworks.com/help/supportpkg/raspberrypi/device-driver-blocks.html.
The problem is: when I run the original model, I get no errors. But, when I use the model as referenced by another one, I get the following errors:
FIrst, I tried to generate C code (even with the drivers being written in C++), and got this:
---
Error executing command "touch -c /home/pi/slprj/ert/Navio2Sensors/*.*;make -f Navio2Sensors.mk all -C /home/pi/slprj/ert/Navio2Sensors". Details:
STDERR: In file included from Navio2Sensors.h:23:0,
from Navio2Sensors.c:16:
Ublox.h:40:19: fatal error: cstdlib: No such file or directory
#include <cstdlib>
^
compilation terminated.
make: *** [Navio2Sensors.c.o] Error 1
---
Then, I tried to generate C++ code and got this:
---
Error executing command "touch -c /home/pi/Teste_ert_rtw/*.*;make -f Teste.mk all -C /home/pi/Teste_ert_rtw". Details:
STDERR: cc1: warning: command line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C
cc1: warning: command line option ‘-fpermissive’ is valid for C++/ObjC++ but not for C
In file included from linuxinitialize.cpp:8:0:
linuxinitialize.h:4:0: warning: "_GNU_SOURCE" redefined
#define _GNU_SOURCE
^
<command-line>:0:0: note: this is the location of the previous definition
linuxinitialize.cpp: In function ‘void myRTOSInit(double, int)’:
linuxinitialize.cpp:258:99: warning: invalid conversion from ‘void*’ to ‘void* (*)(void*)’ [-fpermissive]
status = pthread_create(&subRateThread[i], &attr, (void *) subrateTask, (void *)&taskId[i]);
^
In file included from linuxinitialize.h:11:0,
from linuxinitialize.cpp:8:
/usr/include/pthread.h:244:12: note: initializing argument 3 of ‘int pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*), void*)’
extern int pthread_create (pthread_t *__restrict __newthread,
^
In file included from ert_main.cpp:22:0:
linuxinitialize.h:4:0: warning: "_GNU_SOURCE" redefined
#define _GNU_SOURCE
^
<command-line>:0:0: note: this is the location of the previous definition
In file included from ert_main.cpp:22:0:
ert_main.cpp: In function ‘void* terminateTask(void*)’:
ert_main.cpp:143:75: warning: invalid conversion from ‘void*’ to ‘void**’ [-fpermissive]
CHECK_STATUS(pthread_join(subRateThread[i],(void *)&threadJoinStatus), 0,
^
linuxinitialize.h:18:50: note: in definition of macro ‘CHECK_STATUS’
#define CHECK_STATUS(status, expStatus, fcn) if (status != expStatus) {fprintf(stderr, "Call to %s returned error status (%d).\n", fcn, status); perror(fcn); fflush(stderr); exit(EXIT_FAILURE);}
^
In file included from /usr/include/arm-linux-gnueabihf/c++/4.9/bits/gthr-default.h:35:0,
from /usr/include/arm-linux-gnueabihf/c++/4.9/bits/gthr.h:148,
from /usr/include/c++/4.9/ext/atomicity.h:35,
from /usr/include/c++/4.9/bits/ios_base.h:39,
from /usr/include/c++/4.9/ios:42,
from /usr/include/c++/4.9/ostream:38,
from /usr/include/c++/4.9/iostream:39,
from Ublox.h:43,
from Navio2Sensors.h:22,
from Teste.h:35,
from ert_main.cpp:17:
/usr/include/pthread.h:261:12: note: initializing argument 2 of ‘int pthread_join(pthread_t, void**)’
extern int pthread_join (pthread_t __th, void **__thread_return);
^
In file included from ert_main.cpp:22:0:
ert_main.cpp:143:75: warning: invalid conversion from ‘void*’ to ‘void**’ [-fpermissive]
CHECK_STATUS(pthread_join(subRateThread[i],(void *)&threadJoinStatus), 0,
^
linuxinitialize.h:18:137: note: in definition of macro ‘CHECK_STATUS’
#define CHECK_STATUS(status, expStatus, fcn) if (status != expStatus) {fprintf(stderr, "Call to %s returned error status (%d).\n", fcn, status); perror(fcn); fflush(stderr); exit(EXIT_FAILURE);}
^
In file included from /usr/include/arm-linux-gnueabihf/c++/4.9/bits/gthr-default.h:35:0,
from /usr/include/arm-linux-gnueabihf/c++/4.9/bits/gthr.h:148,
from /usr/include/c++/4.9/ext/atomicity.h:35,
from /usr/include/c++/4.9/bits/ios_base.h:39,
from /usr/include/c++/4.9/ios:42,
from /usr/include/c++/4.9/ostream:38,
from /usr/include/c++/4.9/iostream:39,
from Ublox.h:43,
from Navio2Sensors.h:22,
from Teste.h:35,
from ert_main.cpp:17:
/usr/include/pthread.h:261:12: note: initializing argument 2 of ‘int pthread_join(pthread_t, void**)’
extern int pthread_join (pthread_t __th, void **__thread_return);
^
../slprj/ert/_sharedutils/rtwshared.lib(rt_nonfinite.cpp.o): In function `rt_InitInfAndNaN':
rt_nonfinite.cpp:(.text+0x0): multiple definition of `rt_InitInfAndNaN'
../slprj/ert/_sharedutils/rtwshared.lib(rt_nonfinite.c.o):rt_nonfinite.c:(.text+0x0): first defined here
../slprj/ert/_sharedutils/rtwshared.lib(rt_nonfinite.cpp.o): In function `rtIsInf':
rt_nonfinite.cpp:(.text+0x40): multiple definition of `rtIsInf'
../slprj/ert/_sharedutils/rtwshared.lib(rt_nonfinite.c.o):rt_nonfinite.c:(.text+0x90): first defined here
../slprj/ert/_sharedutils/rtwshared.lib(rt_nonfinite.cpp.o): In function `rtIsInfF':
rt_nonfinite.cpp:(.text+0x78): multiple definition of `rtIsInfF'
../slprj/ert/_sharedutils/rtwshared.lib(rt_nonfinite.c.o):rt_nonfinite.c:(.text+0xf4): first defined here
../slprj/ert/_sharedutils/rtwshared.lib(rt_nonfinite.cpp.o): In function `rtIsNaN':
rt_nonfinite.cpp:(.text+0xb0): multiple definition of `rtIsNaN'
../slprj/ert/_sharedutils/rtwshared.lib(rt_nonfinite.c.o):rt_nonfinite.c:(.text+0x158): first defined here
../slprj/ert/_sharedutils/rtwshared.lib(rt_nonfinite.cpp.o): In function `rtIsNaNF':
rt_nonfinite.cpp:(.text+0xc4): multiple definition of `rtIsNaNF'
../slprj/ert/_sharedutils/rtwshared.lib(rt_nonfinite.c.o):rt_nonfinite.c:(.text+0x198): first defined here
collect2: error: ld returned 1 exit status
make: *** [../Teste.elf] Error 1
0 Comments
Answers (1)
See Also
Categories
Find more on Build Configuration in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!