arishy
Posts: 11
Joined: Mon Jul 16, 2012 10:33 pm

Installing mraa library

Sat May 12, 2018 2:15 am

I ran into circles trying to install the above library....If any one here can help me install it, will greatly appreciate it.
The python programs I am using rely on this library. I can post it for an alternative solution if needed.

I am using the latest image with RPi 3

User avatar
DougieLawson
Posts: 35602
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Installing mraa library

Sat May 12, 2018 8:50 am

The docs at: https://iotdk.intel.com/docs/master/mraa/building.html seem sane and will work on a Raspberry running Raspbian Stretch.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

arishy
Posts: 11
Joined: Mon Jul 16, 2012 10:33 pm

Re: Installing mraa library

Sat May 12, 2018 10:00 am

Thank you for the link...."Bin there done that" !!! The dependencies dragged me down to a black hole.....
I had the same feeling as you did about the link you gave me......maybe I ask"them" for help. The problem is "they" have no time for the mere mortals like me.
What I need is someone who actually DID IT on RPi.

User avatar
DougieLawson
Posts: 35602
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Installing mraa library

Sat May 12, 2018 10:54 am

Try this recipe

sudo apt-get install git build-essential swig3.0 python-dev nodejs-dev cmake libjson-c-dev
cd /tmp
git clone https://github.com/intel-iot-devkit/mraa
cd mraa
mkdir build
cd build
cmake ..
make
sudo make install
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

arishy
Posts: 11
Joined: Mon Jul 16, 2012 10:33 pm

Re: Installing mraa library

Sat May 12, 2018 3:01 pm

WOW I have you to handhold me....appreciate it so such.
As I mentioned before I am running RPi 3 with the latest updates and upgrades.
Here is my first screen... I hope you have the patience..to pursue this with me.

You noticed I gave the att. a number which means more to follow....!!!! What to do next ???
Attachments
MRAA01.jpg
MRAA01.jpg (105.14 KiB) Viewed 2177 times

User avatar
DougieLawson
Posts: 35602
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Installing mraa library

Sat May 12, 2018 3:04 pm

It worked on my Raspbian Stretch system when I tried it.
Start with sudo apt update.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

arishy
Posts: 11
Joined: Mon Jul 16, 2012 10:33 pm

Re: Installing mraa library

Sat May 12, 2018 3:21 pm

So, I did my googling and found that swig 3.0 is now swig-3.0.12.tar.gz so I downloaded it and tar then went to folder with same name
follow this link please with regard installing swig

https://github.com/Yadoms/yadoms/wiki/ ... aspberryPI

The ./configure started ok then spelled errors about
........
checking whether to use local PCRE... no
checking for a sed that does not truncate output...
/bin/sed
checking for pcre-config... no
configure: error: in `/home/pi/swig-3.0.12':
........

So I could not do the next step which is make

I am sure you feel the frustration I am going through

arishy
Posts: 11
Joined: Mon Jul 16, 2012 10:33 pm

Re: Installing mraa library

Sat May 12, 2018 3:27 pm

I have the latest RPi image:

2018-03-13-raspbian-stretch with update and upgrade before I started this saga.

You know I am ready to create another RPi ( 2 in this case ) with a fresh image [ 2018-03-13-raspbian-stretch]
and follow your steps ...What do you think ??? is it worth the trouble ?? I am ready

User avatar
B.Goode
Posts: 8059
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Installing mraa library

Sat May 12, 2018 3:39 pm

arishy wrote:
Sat May 12, 2018 3:27 pm
I have the latest RPi image:

2018-03-13-raspbian-stretch with update and upgrade before I started this saga.

You know I am ready to create another RPi ( 2 in this case ) with a fresh image [ 2018-03-13-raspbian-stretch]
and follow your steps ...What do you think ??? is it worth the trouble ?? I am ready

If you are going to the trouble of starting again with a fresh image - which is always a reasonable thing to try if things don't go according to plan - you should be aware that 2018-03-13-raspbian-stretch is not the latest RPi image from the RPF at the time of writing.

See https://www.raspberrypi.org/downloads/raspbian/

arishy
Posts: 11
Joined: Mon Jul 16, 2012 10:33 pm

Re: Installing mraa library

Sat May 12, 2018 3:47 pm

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

arishy
Posts: 11
Joined: Mon Jul 16, 2012 10:33 pm

Re: Installing mraa library

Sat May 12, 2018 4:00 pm

I will be back!!!...I am downloading 2018-04-18-raspbian-stretch.zip.
Will install on RPi 2 and report back

arishy
Posts: 11
Joined: Mon Jul 16, 2012 10:33 pm

Re: Installing mraa library

Sat May 12, 2018 6:09 pm

That did it. All your steps went OK with no glitches.
To test it I have this small python program that asks for the mraa library.
I got errors I cannot understand, but I think it has to do with the dependencies..Again here it is:

pi@RPi2:~/mraa $ sudo python smartswitch.py
Traceback (most recent call last):
File "smartswitch.py", line 1, in <module>
import mraa
File "/usr/local/lib/python2.7/dist-packages/mraa.py", line 23, in <module>
_mraa = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/mraa.py", line 22, in swig_import_helper
return importlib.import_module('_mraa')
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: libmraa.so.1: cannot open shared object file: No such file or directory

I hate to drag you to MY problems ...but here is the program:

Code: Select all

import mraa   
import time 
# Refer to the pin-out diagram for the GPIO number 
#button pin 
buttonpin = mraa.Gpio(43)   
buttonpin.dir(mraa.DIR_IN)     
relaypin = mraa.Gpio(3) 
relaypin.dir(mraa.DIR_IN) 
relaypin_out = mraa.Gpio(3) 
relaypin_out.dir(mraa.DIR_OUT) 
while True: 
	if buttonpin.read() == 0: #button was pressed 
		time.sleep(0.5) 
		print "button pressed" 
		print "relay:", relaypin.read() 

		if relaypin.read() == 0: 
			relaypin_out.write(1) 
		else: 
			relaypin_out.write(0) 
As you can see it is a very simple program

arishy
Posts: 11
Joined: Mon Jul 16, 2012 10:33 pm

Re: Installing mraa library

Sat May 12, 2018 6:14 pm

I cd to the mraa.py and
pi@RPi2:/usr/local/lib/python2.7/dist-packages $ sudo python mraa.py
Traceback (most recent call last):
File "mraa.py", line 23, in <module>
_mraa = swig_import_helper()
File "mraa.py", line 22, in swig_import_helper
return importlib.import_module('_mraa')
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: libmraa.so.1: cannot open shared object file: No such file or directory

Same error !!!!!! weird do you agree ???

arishy
Posts: 11
Joined: Mon Jul 16, 2012 10:33 pm

Re: Installing mraa library

Sun May 13, 2018 3:33 am

last attempt
Currently our install logic puts Python bindings into standard paths, which do not work on Debian due to their policy.

We are working on a permanent solution, in the meantime please use this command after make install to link installed modules where Debian's Python expects them:

sudo ln -s <your install prefix, e.g. /usr>/lib/python2.7/site-packages/* /usr/lib/python2.7/dist-packages
Same approach works for Python 3, you'll just need to adjust the version number in the path accordingly.
I did that ....same error message !!!!

TheDeadGuy
Posts: 1
Joined: Thu May 16, 2019 9:47 pm

Re: Installing mraa library

Thu May 16, 2019 9:51 pm

Hi,

I know this is an old thread but i had the same issue and managed to do it.

https://www.ics.com/blog/getting-starte ... spberry-pi

The above site helped me out. I skipped installing "Libpcre3 libpcre3-dev Byacc" i also skipped installing Java JDK's. and skipped downloading SWIG code.

Hope this helps someone.

viptuyen101
Posts: 1
Joined: Sat Jul 13, 2019 4:20 am

Re: Installing mraa library

Sat Jul 13, 2019 4:39 am

Hi everyone,

I'm new to Raspberry Pi. I adopt in the way that is using Eclipse IDE on Windows PC platform via cross - compiler (toolchain) to build application file into Raspberry Pi 3 platform. I'm currently approaching with mraa library. I've installed this lib following Dougie Lawson's instruction on Raspberry Pi 3 on July 11, 2019. The shared library (.so file) I got on that date is in version 2.0.0. I've give it a try with a elementary example called hellomraa and it worked directly on terminal. When I deployed the shared library and did the same thing but on Eclipse IDE (Windows) + cross - compiler (GCC 4.6.3 from http://gnutoolchains.com/raspberry/), the thing was I got errors depicted in the attached screenshot
Image

I've been making question in lots of forum but getting nothing new until today my colleague helped me with the shared library that he already installed which is in version 1.7.0 and it successfully works.

Does anyone know why I got that problems? I think that version of library I got being not compatible with the toolchain I'm currently using.

Thanks in advance.

Return to “Python”