I'm developing a service for Cortex A7 powered device running under OpenWrt. Now, I managed to go through entire procedure to bring "HelloWorld" binary to the target device and make it work. Then I started with real stuff and it seems I'm stuck. I'm using the following libraries - json-c, curl, modbus, paho-mqtt - except for the curl, those libs do not exist within the device SDK folder structure.
After some research I understood that I should cross compile those libraries using target platform gcc version which is within the SDK, and the procedure should be like this:
Clone lib repositories from git sources
Cross compile them - here I do not know how should I run make script to use arm-openwrt-linux-gcc located under staging_dir instead of ordinary gcc - should I export PATH and just run make build?
Copy header files and lib binaries to the /lib and /include within the SDK
Include dependencies in my project's makefile
Make it and upload package to the device
Install the package, the binaries will be distributed within the device FS and the application can be executed
The make fails, because there are no header files for those libraries. I don't have either includes or those nor compiled binaries within this SDK and I don't know how to add them there.
Sorry, I'm a bit new for embedded development and cross compiling.
You're not defining dependencies, you're just telling GCC what you want to link to. You'd add dependencies under define Package/vtscd with DEPENDS
As an example, I recently added Hexedit to OpenWrt's packages and Hexedit depends on libncurses. As such, I defined the package as:
define Package/hexedit
TITLE:=Viewer and editor in hexadecimal or ASCII
SUBMENU:=Editors
SECTION:=utils
CATEGORY:=Utilities
URL:=http://rigaux.org/hexedit.html
DEPENDS:=+libncurses
endef
and the first libraries were downloaded, compiled successfully, but the other two was not included (libpaho-mqtt3c and libmodbus). I believe, that I should add some repositories reference to the SDK. But how?
I was wrong: there is python-paho-mqtt package in the repos, but not the C-library. Doesn't look like it'd be a lot of work to add, though.
libmodbus is in the repositories, though; you just probably didn't see it being downloaded, because the build-system failed at finding libpaho-mqtt3c before it reached the dependency for libmodbus.
no, when I first run make after added dependencies it crashed on #include modbus.h, when I changed the order of those declarations - first libpaho, then libmodbus it crashed on libpaho.
I checked build_dir and I found packages curl, json, nghttp2, openssl, - those that were downloaded, but no traces of either modbus nor mqtt
What is the procedure to add those packages to the SDK?