Error when connecting Raspberry PI to MATLAB: "json-c/json.h: No such file or directory"

18 visualizzazioni (ultimi 30 giorni)
Hi,
2 months ago I connected Raspberry Pi to Matlab and it worked.
Now, I'm trying to connect other raspberry pi to Matlab and I get the error below... please, someone can help me to solve it??
All the explanations that I have find in answers to questions here is not working for me...
>> b=raspi('...','...','...')
### Updating Raspberry Pi I/O server...
### Connecting to board...
### Connected to 192.168.62.16...
### Creating server folder...
### Transferring source files...
### Building MATLAB I/O server...
Error executing command "make ONLY_MATLAB_IO=0 -C /opt/MATLAB/mw_server_v20.2.0 -f Makefile". Details:
STDERR: IO_wrapperv4l2.c: In function v4l2CameraInitialize:
IO_wrapperv4l2.c:43:9: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
printf("Webcam: Initialized successfully \n");
^~~~~~
IO_wrapperv4l2.c:43:9: warning: incompatible implicit declaration of built-in function ‘printf’
IO_wrapperv4l2.c:43:9: note: include <stdio.h>or provide a declaration of ‘printf’
IO_wrapperv4l2.c:11:1:
+#include <stdio.h>
IO_wrapperv4l2.c:43:9:
printf("Webcam: Initialized successfully \n");
^~~~~~
IO_wrapperv4l2.c:45:9: warning: incompatible implicit declaration of built-in function ‘printf’
printf("Webcam: Initialization failed \n");
^~~~~~
IO_wrapperv4l2.c:45:9: note: include <stdio.h>or provide a declaration of ‘printf’
IO_wrapperv4l2.c: In function v4l2CameraSnapshot:
IO_wrapperv4l2.c:96:5: warning: incompatible implicit declaration of built-in function ‘printf’
printf("Webcam: Sent an image of framesize %u \n",payloadSize);
^~~~~~
IO_wrapperv4l2.c:96:5: note: include <stdio.h>or provide a declaration of ‘printf’
v4l2_cam.c: In function EXT_webcamInit:
v4l2_cam.c:900:26: warning: unused variable ‘imageHeight’ [-Wunused-variable]
uint32_T imageWidth, imageHeight;
^~~~~~~~~~~
v4l2_cam.c:900:14: warning: unused variable ‘imageWidth’ [-Wunused-variable]
uint32_T imageWidth, imageHeight;
^~~~~~~~~~
v4l2_cam.c:898:9: warning: unused variable ‘ret’ [-Wunused-variable]
int ret = 0;
^~~
In file included from v4l2_cam.c:21:
At top level:
availableWebcam.h:29:36: warning: numSupportedResdefined but not used [-Wunused-variable]
static int numberOfConnetions = 0, numSupportedRes[10];
^~~~~~~~~~~~~~~
availableWebcam.h:29:12: warning: numberOfConnetionsdefined but not used [-Wunused-variable]
static int numberOfConnetions = 0, numSupportedRes[10];
^~~~~~~~~~~~~~~~~~
IO_wrapperCameraboard.c: In function camerboardInitialize:
IO_wrapperCameraboard.c:38:19: warning: pointer targets in assignment from ‘uint8_T *’ {aka ‘unsigned char *’} to ‘char_T *’ {aka ‘char *’} differ in
signedness [-Wpointer-sign]
controlParams = &payloadBufferRx[index];
^
IO_wrapperCameraboard.c:41:5: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
printf("REQUEST_CAMERABOARD_INIT: (w, h, fps, q) = [%d, %d, %d, %d]\n", width, height,
^~~~~~
IO_wrapperCameraboard.c:41:5: warning: incompatible implicit declaration of built-in function ‘printf’
IO_wrapperCameraboard.c:41:5: note: include <stdio.h>or provide a declaration of ‘printf’
IO_wrapperCameraboard.c:11:1:
+#include <stdio.h>
IO_wrapperCameraboard.c:41:5:
printf("REQUEST_CAMERABOARD_INIT: (w, h, fps, q) = [%d, %d, %d, %d]\n", width, height,
^~~~~~
IO_wrapperCameraboard.c: In function cameraboardSnapshot:
IO_wrapperCameraboard.c:66:5: warning: incompatible implicit declaration of built-in function ‘printf’
printf("REQUEST_CAMERABOARD_SNAPSHOT \n");
^~~~~~
IO_wrapperCameraboard.c:66:5: note: include <stdio.h>or provide a declaration of ‘printf’
IO_wrapperCameraboard.c: In function cameraboardControl:
IO_wrapperCameraboard.c:95:19: warning: pointer targets in assignment from ‘uint8_T *’ {aka ‘unsigned char *’} to ‘char_T *’ {aka ‘char *’} differ in
signedness [-Wpointer-sign]
controlParams = &payloadBufferRx[0];
^
IO_wrapperCameraboard.c:96:5: warning: incompatible implicit declaration of built-in function ‘printf’
printf("REQUEST_CAMERABOARD_CONTROL: %s \n", controlParams);
^~~~~~
IO_wrapperCameraboard.c:96:5: note: include <stdio.h>or provide a declaration of ‘printf’
IO_wrapperCameraboard.c: In function cameraboardTerminate:
IO_wrapperCameraboard.c:118:5: warning: incompatible implicit declaration of built-in function ‘printf’
printf("REQUEST_CAMERABOARD_TERMINATE \n");
^~~~~~
IO_wrapperCameraboard.c:118:5: note: include <stdio.h>or provide a declaration of ‘printf’
availableWebcam.c: In function getCameraResolution:
availableWebcam.c:156:11: warning: unused variable ‘search’ [-Wunused-variable]
char *search = "x";
^~~~~~
availableWebcam.c:155:11: warning: unused variable ‘token’ [-Wunused-variable]
char *token;
^~~~~
availableWebcam.c:153:16: warning: unused variable ‘indx_count’ [-Wunused-variable]
static int indx_count = 0;
^~~~~~~~~~
availableWebcam.c: In function getCameraAddrIndex:
availableWebcam.c:145:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
availableWebcam.c: In function validateResolution:
availableWebcam.c:226:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
At top level:
availableWebcam.c:153:16: warning: indx_countdefined but not used [-Wunused-variable]
static int indx_count = 0;
^~~~~~~~~~
picam.c: In function EXT_CAMERABOARD_init:
picam.c:515:9: warning: unused variable ‘result’ [-Wunused-variable]
int result = EXT_CAMERABOARD_terminate();
^~~~~~
IO_wrapperLED.c: In function setLEDTrigger:
IO_wrapperLED.c:54:13: warning: pointer targets in assignment from ‘uint8_T *’ {aka ‘unsigned char *’} to ‘char_T *’ {aka ‘char *’} differ in signedness
[-Wpointer-sign]
trigger = &payloadBufferRx[index];
^
MW_I2C.c: In function I2C_open:
MW_I2C.c:41:19: warning: unused variable ‘i2c_funcs’ [-Wunused-variable]
unsigned long i2c_funcs = 0;
^~~~~~~~~
MW_I2C.c: In function EXT_I2C_writeH:
MW_I2C.c:75:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
msg.buf = data;
^
MW_I2C.c: In function MW_I2C_MasterWrite:
MW_I2C.c:196:9: warning: unused variable ‘i’ [-Wunused-variable]
int i;
^
In file included from IO_wrapperNanomsgPubSub.h:16,
from customFunction.c:21:
MW_JSONParser.h:8:10: fatal error: json-c/json.h: No such file or directory
#include <json-c/json.h>
^~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:81: obj/customFunction.o] Error 1
STDOUT: make: Entering directory '/opt/MATLAB/mw_server_v20.2.0'
[Compiling] GPIO.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE GPIO.c -o obj/GPIO.o
[Compiling] IO_wrapperv4l2.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE IO_wrapperv4l2.c -o obj/IO_wrapperv4l2.o
[Compiling] MW_PWM.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE MW_PWM.c -o obj/MW_PWM.o
[Compiling] MW_pigs.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE MW_pigs.c -o obj/MW_pigs.o
[Compiling] devices.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE devices.c -o obj/devices.o
[Compiling] sharedServer.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE sharedServer.c -o obj/sharedServer.o
[Compiling] v4l2_cam.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE v4l2_cam.c -o obj/v4l2_cam.o
[Compiling] IO_wrapperCameraboard.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE IO_wrapperCameraboard.c -o obj/IO_wrapperCameraboard.o
[Compiling] LED.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE LED.c -o obj/LED.o
[Compiling] MW_SPI.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE MW_SPI.c -o obj/MW_SPI.o
[Compiling] availableWebcam.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE availableWebcam.c -o obj/availableWebcam.o
[Compiling] picam.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE picam.c -o obj/picam.o
[Compiling] system.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE system.c -o obj/system.o
[Compiling] IO_wrapperLED.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE IO_wrapperLED.c -o obj/IO_wrapperLED.o
[Compiling] MW_I2C.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE MW_I2C.c -o obj/MW_I2C.o
[Compiling] MW_digitalIO.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE MW_digitalIO.c -o obj/MW_digitalIO.o
[Compiling] customFunction.c
gcc -c -g -O0 -D_DEBUG -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_ -DMW_WEBSOC_INUSE customFunction.c -o obj/customFunction.o
make: Leaving directory '/opt/MATLAB/mw_server_v20.2.0'
>>

Risposta accettata

Prasanth Sunkara
Prasanth Sunkara il 25 Mar 2021
Hi Sapir,
Looks like json C library is missing on your Raspberry Pi image.
Open a SSH session with your Pi and execute "sudo apt install libjson-c-dev". This would install the required json C library.
Now do r=raspi() from MATLAB.
Please let me know how this goes.
Thanks,
Prasanth
  2 Commenti
Mahdi Barati
Mahdi Barati il 6 Apr 2022
Thank you for your guidance.
I had the same problem. I installed the package you mentioned, but the problem still exists with exactly the same error. Do you have any other suggestion?
Prasanth Sunkara
Prasanth Sunkara il 6 Apr 2022
Just for me to understand this correctly, could you please share the complete error message/log that you got?

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by