Why do I encounter "Error using raspi.inte​rnal.updat​eServer (line 90) Error executing command "make -C /opt/MATLA​B/server_v​16.2.0 -f Makefile"." error message while creating a Raspberry pi object?

40 views (last 30 days)
I have the MATLAB Support Package for Raspberry Pi and when I try to create a raspi object for the Raspberry Pi 3B using the below command, I encounter the error message that follows:
>> mypi = raspi ('192.168.137.11','pi','raspberry')
### Updating Raspberry Pi I/O server...
### Connecting to board...
### Connected to 192.168.137.11...
### Creating server folder...
### Transferring source files...
### Building MATLAB I/O server...
Error using raspi.internal.updateServer (line 90)
Error executing command "make -C /opt/MATLAB/server_v16.2.0 -f Makefile". Details:
STDERR: I2C.c: In function ‘I2C_open’:
I2C.c:28:19: warning: unused variable ‘i2c_funcs’ [-Wunused-variable]
unsigned long i2c_funcs = 0;
^
I2C.c: In function ‘EXT_I2C_readRegister’:
I2C.c:73:20: error: array type has incomplete element type
struct i2c_msg msg[2];
^
I2C.c:82:20: error: ‘I2C_M_RD’ undeclared (first use in this function)
msg[1].flags = I2C_M_RD | I2C_M_NOSTART; // Read
^
I2C.c:82:20: note: each undeclared identifier is reported only once for each function it appears in
I2C.c:82:31: error: ‘I2C_M_NOSTART’ undeclared (first use in this function)
msg[1].flags = I2C_M_RD | I2C_M_NOSTART; // Read
^
I2C.c:73:20: warning: unused variable ‘msg’ [-Wunused-variable]
struct i2c_msg msg[2];
^
I2C.c: In function ‘EXT_I2C_writeRegister’:
I2C.c:109:20: error: array type has incomplete element type
struct i2c_msg msg[2];
^
I2C.c:121:20: error: ‘I2C_M_NOSTART’ undeclared (first use in this function)
msg[1].flags = I2C_M_NOSTART; // Write
^
I2C.c:109:20: warning: unused variable ‘msg’ [-Wunused-variable]
struct i2c_msg msg[2];
^
I2C.c: In function ‘EXT_I2C_write’:
I2C.c:147:20: error: storage size of ‘msg’ isn’t known
struct i2c_msg msg;
^
I2C.c:147:20: warning: unused variable ‘msg’ [-Wunused-variable]
I2C.c: In function ‘EXT_I2C_read’:
I2C.c:177:20: error: storage size of ‘msg’ isn’t known
struct i2c_msg msg;
^
I2C.c:181:17: error: ‘I2C_M_RD’ undeclared (first use in this function)
msg.flags = I2C_M_RD;
^
I2C.c:177:20: warning: unused variable ‘msg’ [-Wunused-variable]
struct i2c_msg msg;
^
make: * [obj/I2C.o] Error 1
STDOUT: make: Entering directory '/opt/MATLAB/server_v16.2.0'
[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 -Winline -pipe -D_DEBUG -D_MATLABIO_ 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 -Winline -pipe -D_DEBUG -D_MATLABIO_ 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 -Winline -pipe -D_DEBUG -D_MATLABIO_ 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 -Winline -pipe -D_DEBUG -D_MATLABIO_ 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 -Winline -pipe -D_DEBUG -D_MATLABIO_ 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 -Winline -pipe -D_DEBUG -D_MATLABIO_ 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 -Winline -pipe -D_DEBUG -D_MATLABIO_ I2C.c -o obj/I2C.o
Makefile:46: recipe for target 'obj/I2C.o' failed
make: Leaving directory '/opt/MATLAB/server_v16.2.0'
Error in raspi.updateServer (line 1192)
raspi.internal.updateServer(varargin{:});
Error in raspi/launchServer (line 792)
raspi.updateServer(obj.DeviceAddress,...
Error in raspi (line 203)
launchServer(obj);
=======================================================================

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 11 Dec 2017
The issue is due to missing the library "libi2c-dev". 
1.If MathWorks custom raspbian image is used on the Raspberry Pi, then do the following:
Go through targetupdater and install our custom image on the Raspberry Pi as all the required libraries(including libi2c-dev) are included in this image. To do that, execute the following in MATLAB:
>> targetupdater
and follow the instructions.
2.If you have disabled i2c from raspi-config, then do the following to enable it:
1. Execute the below command in the linux shell of Raspberry pi: 
$ sudo raspi-config
2. Go to "Advanced options"
3. Select "I2C" and enable it.
3.If you have removed "libi2c-dev" from the MathWorks custom raspbian image, try to reinstall it by executing the below command in linux shell of Raspberry pi:
$ sudo apt-get install libi2c-dev

More Answers (0)

Categories

Find more on MATLAB Support Package for Raspberry Pi Hardware in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!