libmraa by Eclipse Foundation/Intel
-
Hello,
I was wondering if some of us have used the libmraa library. From the project description at Github: "Eclipse Mraa - Low Level Skeleton Library for Communication on GNU/Linux platforms"URL:
Under MIPS, Onion Omega2 is listed as as supported HW platform.
Thanks..
-
@tjoseph1 The library is available in the repositories. Edit /etc/opkg/distfeeds.conf uncomment lines 2 and 5, then run opkg update, then run opkg install libmraa
-
@crispyoz: Thank a lot for the pointer.. I have installed libmraa from the repo.
It appears that the version provided in the repo is 0.8.1
root@Omega-745F:/# ls -l /usr/lib/libmraa*
-rwxr-xr-x 1 root root 41495 Aug 2 16:19 /usr/lib/libmraa.so
-rwxr-xr-x 1 root root 41495 Aug 2 16:19 /usr/lib/libmraa.so.0
-rwxr-xr-x 1 root root 41495 Aug 2 16:19 /usr/lib/libmraa.so.0.8.1The opkg install creates 3 files, with contents identical ? (usually the other two must be links to "libmraa.so.0.8.1"?)
root@Omega-745F:/usr/lib# diff libmraa.so libmraa.so.0
root@Omega-745F:/usr/lib# diff libmraa.so libmraa.so.0.8.1As per the "change log" Omega 2 is supported from version 1.9.0 of MRAA:
https://github.com/eclipse/mraa/blob/master/docs/changelog.mdAlso, when I try to cross-compile "examples/c/led.c" with libmraa.so.0.8.1 (I copied that file to my Linux WS and added to Netbeans Project's Linker Section.(Thanks for your excellent post on mips cross-compile using netbeans/Linux).
Compilation is throwing error: (The headers and implementation of all these "mraa_init()", "mraa_led_init()" etc., called from "led.c" are included in the project appropriately, to the best I know.)
<<<
build/Debug/GNU_OpenWRT_Omega2/+-Linux/led.o:In function 'led1: ~/NetBeansProjects/Omega_LED_C/led.c:41: undefined reference to mraa_init'
~/NetBeansProjects/Omega_LED_C/led.c:45:undefined reference to 'mraa_led_init'
..
~/NetBeansProjects/Omega_LED_C/led.c:94:undefined reference to mraa_deinit'
collect2: error:ld returned 1 exit status
nbproject/Makefile-Debug.mk:65:recipe for target 'dist/Debug/GNU_OpenWRT_Omega2/+-Linux/omega_led_c' failed
make[2]:*** [dist/Debug/GNU_OpenWRT_Omega2/+-Linux/omega_led_c] Error 1
make[2]:Leaving directory '~/NetBeansProjects/Omega_LED_C' nbproject/Makefile-Debug.mk:59: 'recipe for target '.build-conf' failed
make[1]:*** [.build-conf] Error 2
make[1]:Leaving directory '~/NetBeansProjects/Omega_LED_C' nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make:*** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 132ms)
<<<<I am planning to cross-compile the libmraa 2.1.0 from github sources and see what happens. It erred, may be because, the example I used is from 2.1.0; there is no "example/c/led.c" in 0.8.1 in the github repo.
-
@tjoseph1 The crux of the error is: "ld returned 1 exit status", this indicates that the linker cannot find the library and/or the functions you are calling within the available libraries. So you need to ensure you have included it in your library path and that the functions you are calling exist in the .so.
-
@crispyoz:
I cross compiled 2.1.0 version of the library from 2.1.0 sources..The flags used for cross-compiling were:
cmake -DBUILDARCH=mips
-DBUILDDOC=OFF
-DBUILDSWIGPYTHON=OFF
-DBUILDSWIGNODE=OFF
-DBUILDSWIG=OFF
-DBUILDSWIGJAVA=OFF
-DJSONPLAT=OFF
-DCMAKE_C_COMPILER=<path_to_mips_c_compiler>
-DCMAKE_CXX_COMPILER=<path_to_mips_c++_compiler>I am interested only in C/C++ support.
I didn't do the "sudo make install" step as specified here:
https://github.com/eclipse/mraa/blob/master/docs/building.md ,
but used the the generated libmraa.so with Netbeans, and that gave a successful compile, nothing else changed in the project hierarchy.
<<<<
..
..
make[2]:Leaving directory '~/NetBeansProjects/Omega_LED_C'
cp lib/libmraa.so.2.1.0 dist/Debug/GNU_OpenWRT_Omega2/+-Linux
make[1]:Leaving directory '~/NetBeansProjects/Omega_LED_C'
BUILD SUCCESSFUL (total time: 120ms)
<<<<I am able to run the executable in omega2 (FW b232) after I copied the libmraa.so.2.1.0 to /usr/lib of the omega as libmraa.so.2.
root@Omega-745F:/tmp# chmod a+x omega_led_c
root@Omega-745F:/tmp# ./omega_led_c
Error loading shared library libmraa.so.2: No such file or directory (needed by ./omega_led_c)
Error relocating ./omega_led_c: mraa_deinit: symbol not found
Error relocating ./omega_led_c: mraa_led_set_trigger: symbol not found
Error relocating ./omega_led_c: mraa_init: symbol not found
Error relocating ./omega_led_c: mraa_led_init: symbol not found
Error relocating ./omega_led_c: mraa_result_print: symbol not found
Error relocating ./omega_led_c: mraa_led_close: symbol not found
Error relocating ./omega_led_c: mraa_led_set_brightness: symbol not found
Error relocating ./omega_led_c: mraa_led_read_max_brightness: symbol not foundcopied libmraa.so.2.1.0 as /usr/lib/libmraa.so.2
root@Omega-745F:/tmp# ls -l /usr/lib/libmraa.so.2
-rwxr-xr-x 1 root root 248052 Aug 26 09:09 /usr/lib/libmraa.so.2root@Omega-745F:/tmp# ./omega_led_c
Failed to initialize LED
root@Omega-745F:/tmp#Now, the uphill ride begins.. to study/understand libmraa 2.1.0.. and rebuild the library properly fro the Omega2. At this point, I don't where the LED is pointing to..
Again, your post on Netbeans gave me the initial pull... Thanks..
-
@tjoseph1 OK I can see you are on the correct path now. I haven't used libmraa so I will be interested to see how you go. Please continue to post your successes and failures for the benefit of us all.