Include external library

Hello, I’m new in RIOT. I have to include this library, https://github.com/bro/broccoli, in RIOT and flash a program in OpenMote for my thesis. I read in the RIOT api that you can import external libraries as packages.

I moved the library in to pkg folder of RIOT. I added the USEPKG macro in my application’s Makefile but when i use “include <broccoli.h>” in main.c of my program i have this error: /home/user/RIOT/examples/hello-world/main.c:23:22: fatal error: broccoli.h: No such file or directory #include <broccoli.h>. Can you help me please?

Thanks.

Hi Alberto,

Hi Bas, thanks very for reply. I’ll take a look at that link. Patches file are mandatory? Because I do not know how to go about my library, or I do not know if there’s no need.

Thank u.

Hi Alberto!

I did as show link that you sent me, but when i try to flash a program (simple hello world with "include <broccoli.h>) on OpenMote i see this:

“make” -C /home/ciolo/RIOT/pkg/broccoli rm -Rf /home/ciolo/RIOT/examples/hello-world/bin/pkg/openmote-cc2538/broccoli mkdir -p /home/ciolo/RIOT/examples/hello-world/bin/pkg/openmote-cc2538/broccoli /home/ciolo/RIOT/dist/tools/git/git-cache clone “https://github.com/bro/broccoli” “765eab50f7796fdb3c308fe9232cd7891f098c67” “/home/ciolo/RIOT/examples/hello-world/bin/pkg/openmote-cc2538/broccoli”

  • local REMOTE=https://github.com/bro/broccoli
  • local SHA1=765eab50f7796fdb3c308fe9232cd7891f098c67
  • basename https://github.com/bro/broccoli
  • local REMOTE_NAME=broccoli
  • local TARGET_PATH=/home/ciolo/RIOT/examples/hello-world/bin/pkg/openmote-cc2538/broccoli
  • _check_commit 765eab50f7796fdb3c308fe9232cd7891f098c67
  • git_cache cat-file -e 765eab50f7796fdb3c308fe9232cd7891f098c67^{commit}
  • git -C /home/ciolo/.gitcache cat-file -e 765eab50f7796fdb3c308fe9232cd7891f098c67^{commit} fatal: Cannot change to ‘/home/ciolo/.gitcache’: No such file or directory
  • git clone https://github.com/bro/broccoli /home/ciolo/RIOT/examples/hello-world/bin/pkg/openmote-cc2538/broccoli Cloning into ‘/home/ciolo/RIOT/examples/hello-world/bin/pkg/openmote-cc2538/broccoli’… remote: Counting objects: 1591, done. remote: Total 1591 (delta 0), reused 0 (delta 0), pack-reused 1591 Receiving objects: 100% (1591/1591), 688.54 KiB | 943.00 KiB/s, done. Resolving deltas: 100% (803/803), done. Checking connectivity… done.
  • git -C /home/ciolo/RIOT/examples/hello-world/bin/pkg/openmote-cc2538/broccoli checkout 765eab50f7796fdb3c308fe9232cd7891f098c67 Note: checking out ‘765eab50f7796fdb3c308fe9232cd7891f098c67’.

You are in ‘detached HEAD’ state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:

git checkout -b

HEAD is now at 765eab5… Updating CHANGES and VERSION.

  • set +ex touch /home/ciolo/RIOT/examples/hello-world/bin/pkg/openmote-cc2538/broccoli/.git-downloaded “make” -C /home/ciolo/RIOT/examples/hello-world/bin/pkg/openmote-cc2538/broccoli Error: No build/ directory found. Did you run configure? Makefile:45: recipe for target ‘configured’ failed make[2]: *** [configured] Error 1 Makefile:8: recipe for target ‘all’ failed make[1]: *** [all] Error 2 /home/ciolo/RIOT/examples/hello-world/…/…/Makefile.include:308: recipe for target ‘/home/ciolo/RIOT/examples/hello-world/bin/openmote-cc2538/broccoli.a’ failed make: *** [/home/ciolo/RIOT/examples/hello-world/bin/openmote-cc2538/broccoli.a] Error 2

Hello,

It says why it fails: Error: No build/ directory found. Did you run configure? Makefile:45: recipe for target 'configured' failed

If i already downloaded the library and i did ./configure make and make install in local how can i include it without git in Makefile?