Libmraa-rockpi4 not found

Following the instructions found at:
https://wiki.radxa.com/Rockpi4/dev/libmraa#Install_libmraa-rockpi4
to install the libmraa-rockpi4 library e.g.
apt-get install libmraa-rockpi4
I get the following error:
E: Unable to locate package libmraa-rockpi4

Has anyone successfully installed this library and got it to work?

Which image are you running? Currently we only packed the arm64 deb for libmraa.

Running Debian Stretch then applied the Radxa APT changes.

We will add the armhf libmraa package on Monday. You can build it by yourself for now.

git clone https://github.com/brian541/mraa.git

Then follow the instructions here:

https://github.com/brian541/mraa/blob/master/docs/building.md

to make and make install it.

Hi,

ROCK Pi 4 armhf Libmraa package is added.

Install it by

sudo apt-get update
sudo apt-get install libmraa-rockpi4

For more details, please checkout

https://wiki.radxa.com/Rockpi4/dev/libmraa

1 Like

In order to avoid all unnecessary difficulties, I have freshly installed rockpi4_debian_stretch_lxde_armhf_20181105_2120-gpt.img.gz on my 32GB eMMC. Then I worked through all described steps.
https://wiki.radxa.com/Rockpi4/dev/libmraa
Unfortunately I cannot install libmraa-rockpi4.

mike@mpc4:~$ ssh linaro@rpi4b
linaro@rpi4bā€™s password:
Linux rpi4b 4.4.154-75-rockchip-00013-gcc4fef3 #2 SMP Sat Mar 23 15:05:37 CST 2019 aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Mar 26 08:42:21 2019 from 192.168.178.24
linaro@rpi4b:~$ sudo apt update
Hit:1 http://apt.radxa.com/stretch stretch InRelease
Ign:2 http://http.debian.net/debian stretch InRelease
Hit:3 http://repo.linaro.org/ubuntu/linaro-overlay stretch InRelease
Hit:4 http://security.debian.org stretch/updates InRelease
Hit:5 http://http.debian.net/debian stretch-updates InRelease
Hit:6 http://http.debian.net/debian stretch Release
Reading package listsā€¦ Done
Building dependency tree
Reading state informationā€¦ Done
All packages are up to date.
linaro@rpi4b:~$ sudo apt install libmraa-rockpi4
Reading package listsā€¦ Done
Building dependency tree
Reading state informationā€¦ Done
libmraa-rockpi4 is already the newest version (0.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up libmraa-rockpi4 (0.1) ā€¦
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
dpkg: error processing package libmraa-rockpi4 (ā€“configure):
subprocess installed post-installation script returned error exit status 100
Errors were encountered while processing:
libmraa-rockpi4
E: Sub-process /usr/bin/dpkg returned an error code (1)
linaro@rpi4b:~$

I donā€™t know why it is to this ā€œlibmraa-rockpi4 is already the newest version (0.1).ā€ Message comes, this came already with the first attempt of the installation. After that I have to uninstall the package with ā€œapt purgeā€ and then start over, but nothing changes. However, I get another, perhaps interesting, message.

linaro@rpi4b:~$ sudo apt purge libmraa-rockpi4
Reading package listsā€¦ Done
Building dependency tree
Reading state informationā€¦ Done
The following packages will be REMOVED:
libmraa-rockpi4*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
(Reading database ā€¦ 75098 files and directories currently installed.)
Removing libmraa-rockpi4 (0.1) ā€¦
dpkg: warning: while removing libmraa-rockpi4, directory ā€˜/usr/local/lib/python2.7ā€™ not empty so not removed
linaro@rpi4b:~$

But there doesnā€™t seem to be any lock.

linaro@rpi4b:~$ sudo lsof /var/lib/dpkg/lock
linaro@rpi4b:~$

Hi, @SunWukong

We have updated a newer version of package. Not need to install a system image, just do this.

sudo apt-get update
sudo apt-get install libmraa-rockpi4
2 Likes

Thank you, now it works. :slightly_smiling_face:

linaro@rpi4b:~$ sudo apt update
Get:1 http://apt.radxa.com/stretch stretch InRelease [2361 B]
Ign:2 http://http.debian.net/debian stretch InRelease
Hit:3 http://repo.linaro.org/ubuntu/linaro-overlay stretch InRelease
Get:4 http://http.debian.net/debian stretch-updates InRelease [91.0 kB]
Hit:5 http://http.debian.net/debian stretch Release
Hit:6 http://security.debian.org stretch/updates InRelease
Get:7 http://apt.radxa.com/stretch stretch/main armhf Packages [10.3 kB]
Fetched 104 kB in 2s (50.0 kB/s)
Reading package listsā€¦ Done
Building dependency tree
Reading state informationā€¦ Done
All packages are up to date.
linaro@rpi4b:~$ sudo apt install libmraa-rockpi4
Reading package listsā€¦ Done
Building dependency tree
Reading state informationā€¦ Done
The following additional packages will be installed:
libjson-c3
The following NEW packages will be installed:
libjson-c3 libmraa-rockpi4
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 248 kB of archives.
After this operation, 57.3 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://http.debian.net/debian stretch/main armhf libjson-c3 armhf 0.12.1-1.1 [24.2 kB]
Get:2 http://apt.radxa.com/stretch stretch/main armhf libmraa-rockpi4 armhf 0.3 [223 kB]
Fetched 248 kB in 0s (1152 kB/s)
Selecting previously unselected package libjson-c3:armhf.
(Reading database ā€¦ 74961 files and directories currently installed.)
Preparing to unpack ā€¦/libjson-c3_0.12.1-1.1_armhf.deb ā€¦
Unpacking libjson-c3:armhf (0.12.1-1.1) ā€¦
Selecting previously unselected package libmraa-rockpi4.
Preparing to unpack ā€¦/libmraa-rockpi4_0.3_armhf.deb ā€¦
Unpacking libmraa-rockpi4 (0.3) ā€¦
Setting up libjson-c3:armhf (0.12.1-1.1) ā€¦
Processing triggers for libc-bin (2.24-11+deb9u4) ā€¦
Setting up libmraa-rockpi4 (0.3) ā€¦
linaro@rpi4b:~$

A small unimportant bug is in Wicki, since we did not clone mraa-gpio from Github and compile it afterwards, but got the package via apt install, the call is slightly different.

https://wiki.radxa.com/Rockpi4/dev/libmraa

Use mraa-gpio tool to test

rock@localhost:~/mraa/build$ mraa-gpio list

Thatā€™s how it worked for me.

linaro@rpi4b:~$ mraa-gpio list
01 3V3:
02 5V:
03 SDA7: GPIO I2C
04 5V:
05 SCL7: GPIO I2C

Both for the tool i2cdetect and for Python 2.7 the bus 0 has to be addressed with its ID 7. Otherwise it works quite well. I connected the character OLED NHD-0420CW from Newhaven Display to I2C as a test.

linaro@rpi4b:~$ mraa-i2c list
Bus   0: id=07 type=linux  default
Bus   1: id=02 type=linux 
Bus   2: id=06 type=linux 
linaro@rpi4b:~$ sudo mraa-i2c detect 0
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- 3d -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
linaro@rpi4b:~$ sudo i2cdetect -y 7
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- 3d -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

#!/usr/bin/python
# -*- coding: utf-8 -*-
# Example lcd_showtime
# shows time and date in first tow rows of LCD
# Date: Dec 8th, 2017
# 

import os
from I2cCharDisplay import I2cCharDisplay
# import locale                                   # https://help.ubuntu.com/community/Locale
from time import strftime
import threading                                  # I do not like to use sleep(1) to wait a second, not even in an example

OLEDADDRESS =   0x3d                              # i2c address for the oled display
busnum = 7
# locale.setlocale(locale.LC_ALL,'de_DE.utf8')    # Set locale for a nice date, to date french girl, change to fr_FR.utf8

oled = I2cCharDisplay("OLED", OLEDADDRESS, 4)     # create an oled object for a 4 line display


def getCpuTemperature():
    tempFile = open( "/sys/class/thermal/thermal_zone0/temp" )
    cpu_temp = tempFile.read()
    tempFile.close()
    return float(cpu_temp)/1000


oled.clear()
oled.setBrightness(4)


def show_time():
    threading.Timer(1.0, show_time).start()         # Show time and date every second
    oled.cursorMove(col=7,row=1)
    oled.writeString(strftime('%H:%M:%S'))          # Hour:minute:second
    oled.cursorMove(col=3,row=2)
    oled.writeString(strftime('%a %d. %b %Y'))      # Weekday as localeā€™s abbreviated name, Day of the month,
                                                    # Month as localeā€™s abbreviated name, Year with century
    oled.cursorMove(col=4,row=3)
    oled.writeString("CPU temp ")
    oled.writeString(str(round(getCpuTemperature(), 1)))
    oled.writeString("C")

show_time()
1 Like