Interfacing Matlab and Raspberry Pi gives 'make' file error

13 次查看(过去 30 天)
I am trying to control my R Pi with matlab remotely (over the same wifi network). but i am running into the same error over and over again
i have tried the following
  • removing matlab related folder from my pi and then running the command from my pc's matlab
  • installing matlab-online and then trying to do the set up from pc
Nothing seemed to work
My end result (what i hope for) is to be able to run a simulink model on my pc while sending and recieving data from my raspberry-pi. If there is any simpler way to do the above, please do suggest that too. Also i want to do the above wirelessly.
>> mypi = raspi('ipaddress', 'pi', 'password')
### Updating Raspberry Pi I/O server...
### Connecting to board...
### Connected to 192.168.43.239...
### Creating server folder...
### Transferring source files...
### Building MATLAB I/O server...
Error executing command "make -C /opt/MATLAB/server_v18.2.1 -f Makefile". Details:
STDERR: I2C.c: In function ‘I2C_open’:
I2C.c:29:23: warning: unused variable ‘i2c_funcs’ [-Wunused-variable]
unsigned long i2c_funcs = 0;
^~~~~~~~~
I2C.c: In function ‘EXT_I2C_readRegister’:
I2C.c:81:22: warning: assignment discards ‘const’ qualifier from pointer target type
[-Wdiscarded-qualifiers]
msg[0].buf = ®
^
I2C.c: In function ‘EXT_I2C_writeRegister’:
I2C.c:120:22: warning: assignment discards ‘const’ qualifier from pointer target type
[-Wdiscarded-qualifiers]
msg[0].buf = ®
^
I2C.c:124:22: warning: assignment discards ‘const’ qualifier from pointer target type
[-Wdiscarded-qualifiers]
msg[1].buf = data;
^
I2C.c: In function ‘EXT_I2C_write’:
I2C.c:154:19: warning: assignment discards ‘const’ qualifier from pointer target type
[-Wdiscarded-qualifiers]
msg.buf = data;
^
picam.c: In function ‘EXT_CAMERABOARD_init’:
picam.c:512:9: warning: unused variable ‘result’ [-Wunused-variable]
int result = EXT_CAMERABOARD_terminate();
^~~~~~
v4l2_cam.c: In function ‘EXT_webcamInit’:
v4l2_cam.c:889:26: warning: unused variable ‘imageHeight’ [-Wunused-variable]
uint32_T imageWidth, imageHeight;
^~~~~~~~~~~
v4l2_cam.c:889:14: warning: unused variable ‘imageWidth’ [-Wunused-variable]
uint32_T imageWidth, imageHeight;
^~~~~~~~~~
v4l2_cam.c:887:9: warning: unused variable ‘ret’ [-Wunused-variable]
int ret = 0;
^~~
In file included from v4l2_cam.c:19:0:
At top level:
availableWebcam.h:29:36: warning: ‘numSupportedRes’ defined but not used [-Wunused-variable]
static int numberOfConnetions = 0, numSupportedRes[10];
^~~~~~~~~~~~~~~
availableWebcam.h:29:12: warning: ‘numberOfConnetions’ defined but not used [-Wunused-variable]
static int numberOfConnetions = 0, numSupportedRes[10];
^~~~~~~~~~~~~~~~~~
joystick.c: In function ‘EXT_JOYSTICK_INIT’:
joystick.c:45:25: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
for(ii=0; ii<100 & glob_buffer.gl_pathv[i] != '\0'; ii++)
~~^~~~
joystick.c: In function ‘EXT_JOYSTICK_READ’:
joystick.c:82:17: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
for(ii=0;(ii<100 & sh_evdevName[ii] != '\0');ii++)
~~^~~~
frameBuffer.c: In function ‘EXT_FRAMEBUFFER_INIT’:
frameBuffer.c:45:24: warning: suggest parentheses around comparison in operand of ‘&’
[-Wparentheses]
for(ii=0;ii<100 & glob_buffer.gl_pathv[i] != '\0';ii++)
~~^~~~
frameBuffer.c: In function ‘EXT_FRAMEBUFFER_WRITEPIXEL’:
frameBuffer.c:71:9: warning: unused variable ‘ii’ [-Wunused-variable]
int ii ;
^~
frameBuffer.c: In function ‘EXT_FRAMEBUFFER_DISPLAYIMAGE’:
frameBuffer.c:98:17: warning: suggest parentheses around comparison in operand of ‘&’
[-Wparentheses]
for(ii=0; ii<100 & sh_fbname[ii] != '\0'; ii++)
~~^~~~
frameBuffer.c:96:10: warning: variable ‘fileName’ set but not used [-Wunused-but-set-variable]
char fileName[100];
^~~~~~~~
frameBuffer.c:95:9: warning: unused variable ‘pxllocation’ [-Wunused-variable]
int pxllocation=0;
^~~~~~~~~~~
TimerBasedRecorder.c: In function ‘gpioRead’:
TimerBasedRecorder.c:422:25: warning: unused variable ‘bytes’ [-Wunused-variable]
int bytes = nn_send(pubSockFd, tmpPdata->FileMemBuff , (TIME_STAMP_BYTES +
GPIO_VALUE_BYTES + GPIO_SUB_TOKEN_SIZE) , 0);
^~~~~
AudioRecorder.c: In function ‘initializeAudio’:
AudioRecorder.c:77:20: warning: assignment from incompatible pointer type
[-Wincompatible-pointer-types]
pData->capture = audioRead;
^
obj/RaspiCamControl.o: In function `raspicamcontrol_set_saturation':
RaspiCamControl.c:(.text+0xcb4): undefined reference to `mmal_status_to_int'
obj/RaspiCamControl.o: In function `raspicamcontrol_set_sharpness':
RaspiCamControl.c:(.text+0xd3c): undefined reference to `mmal_status_to_int'
obj/RaspiCamControl.o: In function `raspicamcontrol_set_contrast':
RaspiCamControl.c:(.text+0xdc4): undefined reference to `mmal_status_to_int'
obj/RaspiCamControl.o: In function `raspicamcontrol_set_brightness':
RaspiCamControl.c:(.text+0xe48): undefined reference to `mmal_status_to_int'
obj/RaspiCamControl.o: In function `raspicamcontrol_set_ISO':
RaspiCamControl.c:(.text+0xe80): undefined reference to `mmal_status_to_int'
obj/RaspiCamControl.o:RaspiCamControl.c:(.text+0xec0): more undefined references to
`mmal_status_to_int' follow
collect2: error: ld returned 1 exit status
make: *** [build] Error 1
STDOUT: make: Entering directory '/opt/MATLAB/server_v18.2.1'
[Compiling] auth.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 auth.c -o
obj/auth.o
[Compiling] server.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 server.c -o
obj/server.o
[Compiling] handler.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 handler.c -o
obj/handler.o
[Compiling] devices.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 devices.c -o
obj/devices.o
[Compiling] LED.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 LED.c -o obj/LED.o
[Compiling] GPIO.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 GPIO.c -o
obj/GPIO.o
[Compiling] I2C.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 I2C.c -o obj/I2C.o
[Compiling] SPI.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 SPI.c -o obj/SPI.o
[Compiling] serial.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 serial.c -o
obj/serial.o
[Compiling] system.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 system.c -o
obj/system.o
[Compiling] picam.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 picam.c -o
obj/picam.o
[Compiling] ip_server.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 ip_server.c -o
obj/ip_server.o
[Compiling] v4l2_cam.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 v4l2_cam.c -o
obj/v4l2_cam.o
[Compiling] MW_pigs.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 MW_pigs.c -o
obj/MW_pigs.o
[Compiling] /opt/userland/host_applications/linux/apps/raspicam/RaspiCamControl.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1
/opt/userland/host_applications/linux/apps/raspicam/RaspiCamControl.c -o obj/RaspiCamControl.o
[Compiling] /opt/userland/host_applications/linux/apps/raspicam/RaspiPreview.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1
/opt/userland/host_applications/linux/apps/raspicam/RaspiPreview.c -o obj/RaspiPreview.o
[Compiling] /opt/userland/host_applications/linux/apps/raspicam/RaspiCLI.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1
/opt/userland/host_applications/linux/apps/raspicam/RaspiCLI.c -o obj/RaspiCLI.o
[Compiling] joystick.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 joystick.c -o
obj/joystick.o
[Compiling] frameBuffer.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 frameBuffer.c -o
obj/frameBuffer.o
[Compiling] alsa_rdwr.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 alsa_rdwr.c -o
obj/alsa_rdwr.o
[Compiling] TimerBasedRecorder.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1
TimerBasedRecorder.c -o obj/TimerBasedRecorder.o
[Compiling] UdpRecorder.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 UdpRecorder.c -o
obj/UdpRecorder.o
[Compiling] AudioRecorder.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 AudioRecorder.c -o
obj/AudioRecorder.o
[Compiling] recorder.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include
-I/opt/userland/interface/vcos -I/opt/userland/interface/vcos/pthreads
-I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 recorder.c -o
obj/recorder.o
echo [Linking]
[Linking]
Makefile:63: recipe for target 'build' failed
make: Leaving directory '/opt/MATLAB/server_v18.2.1'
  4 个评论
Viraj
Viraj 2019-1-25
I'm pretty sure it's a software bug from their side. Guess that the next update will fix it up.
(I actually don't want to use the Mathworks raspbian image, i already have other data in my R Pi)
Thanks for the suggestion though.
James Carter
James Carter 2022-1-2
VT: Thanks for the answer you provided. The very first line of your answer solved my problem, which was the inability of MATLAB to recognize my pi with a new SD card. Wow, this was too simple with the proper format [ mypi = raspi('ipaddress', 'pi', 'password')]

请先登录,再进行评论。

回答(4 个)

ARCHANA DUBEY
ARCHANA DUBEY 2019-4-16
I was also facing this same issue while connecting my raspberry pi board to the MATLAB. And after several attempts I found the solution.
  1. Install raspbian strech on your pi board. Do not install NOOBS. It is the main cause of creating issue.
  2. In the MATLAB raspberry pi hardware setup select 'customize the existing operating system running on my hardware'.
  3. As I was trying to connect raspberry pi with wifi. So please mind to connect both raspberry pi and your host pc with same wifi connection.
  4. type command hostname -I in raspberry pi command window and you will find the ip address of your device.
  5. enter Ip address of your pi in device address in hardware setup login credential in matlab and also enter other login credentials like device username and password. click on test connection enter next.
  6. in configure peripheral modules window I have enabled all four tabs and then clicked next.
  7. After doing all these steps . type command mypi= raspi() in matlab command window. then it worked fine.
important: 1. raspberry pi OS should be raspbian strech or raspbian jessie only.
2. In some case, it is working fine with MATLAB 2018a. In my case, it worked fine with MATLAB 2019a.
I hope this will be helpful for you.

Kenneth De Leener
编辑:Kenneth De Leener 2019-2-4
Same issue here.
The userland library builds fine, but when building from the matlab Makefile, it doesn't work...
Matlab doesn't include the necessary files for userland RaspiCam, but the files are present in the package that matlab sends to the rapsberry pi.
I didn't take the time to adjust it though :x

Latika Channapattan
Error executing command "make -C /opt/MATLAB/server_v18.2.1 -f Makefile". Details:
STDERR: server.c:15:24: fatal error: nanomsg/nn.h: No such file or directory
#include <nanomsg/nn.h>
^
compilation terminated.
make: *** [obj/server.o] Error 1
STDOUT: make: Entering directory '/opt/MATLAB/server_v18.2.1'
[Compiling] auth.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 auth.c -o obj/auth.o
[Compiling] server.c
gcc -c -O2 -Wall -I/opt/userland -I/opt/userland/host_applications/linux/libs/bcm_host/include -I/opt/userland/interface/vcos
-I/opt/userland/interface/vcos/pthreads -I/opt/userland/interface/vmcs_host/linux -I/opt/userland/host_applications/linux/apps/raspicam
-I/opt/nanomsg/include -Winline -pipe -D_DEBUG -D_MATLABIO_ -DNANOMSG_TRANSPORT=1 server.c -o obj/server.o
Makefile:53: recipe for target 'obj/server.o' failed
make: Leaving directory '/opt/MATLAB/server_v18.2.1'
This error i am getting while connecting raspberry.

Prasanth Sunkara
Prasanth Sunkara 2021-3-25
MATLAB/Simulink Support Package for Raspberry Pi requires some libraries and linux packages to be installed on Raspberry Pi before you can use the support package features. This is handled by the "Hardware Setup" process just after installing the Add-On.
In the Hardware Setup, you could choose either MathWorks Customized Image(this would have all the libraries pre-installed) or you could customize your existing raspberry pi's operating system to install the addtional llibrary dependencies.
Please refer the below video to know more about the hardware setup process.
Thanks,
Prasanth

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for Raspberry Pi Hardware 的更多信息

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by