From "Cross-Compiling for the Omega" I cannot successfully build the gpioRead example
@Flemming-Richter This is the correct answer. Actually, you need to select the libugpio in the Libraries section of "make menuconfig" so that it will actually build.
@Flemming-Richter One thing I want: onion-spi.h for SPI development. That should be included in spi-gpio-driver. However, I cannot find that in the cross build environment.
Somehow, the cross compile documentation is still pretty lacking...
@Arne-Schmitz where in menuconfig is the selection for libugpio? I searched and searched to no avail. Thank you in advance.
In order for your systems to locate the libugpio you need to use either our Source Repo or a Docker image. Here are guides on how to cross-compile C Programs and refer to our latest blog post on how to cross-compile more complex C programs with libraries. I hope this will help and make it clear to understand the purpose of Cross-Compilation, Happy Hacking :-)
On the other hand, if you are not using our Docker Image, you will have to run
make menuconfigin the build system to select
libugpiopackage to be compiled and then compile it by running
In General you will need to have the external library, for instance
libugpio, to be compiled by the Build system before it can be dynamically linked to code that you are trying to cross compile. Above all, I strongly recommend basing your BUild system on our GitHub source repo since it is preconfigured to include the Onion software repo and to build all the libraries that are included on the Omega.
Pavel FYI I followed the instructions for 'cross-compile C Programs' and I used the source repo exactly and the instructions did not say to wget the Makefile and it was not preselected in the .config so I still got the same errors with the ugpio headers when I tried to run the example at the end of those instructions. If you read the "more complex..." section from the link in your post above that I copied below, its says it will all be done if I used that source but I still had to creat the dir, wget the files, select it in .config and then make again. I wouldn't have been able to do that unless I found this post and the example compile would never have worked. Not sure if I did something wrong or its just been missed but thanks for this post, you might want to check the repo for the lib.
"...A Small but Important Note
We keep mentioning that the program will use the ugpio library. In order for this to be possible, the library must first be compiled by LEDE build system.
If you’re using our omega2-source Docker image or building based on our source GitHub repo, you’re all good as it’s selected for compilation by default.
If not, you’ll have to run make menuconfig in the build system to select the libugpio package to be compiled and then compile it by running make.
the instructions did not say to wget the Makefile and it was not preselected in the .config
It was never mentioned that you have to
wgetthe makefile. If you followed this example, you are cloning the GitHub repo to your build system that already contains
xComile.shand the source code. The tutorial guides you through every step from building the source image and cross-compiling the program.
@Pavel-Metrokhin OK Thanks I never saw that tutorial. I think the problem is many versions of tutorials in different places, but this is good thanks.'
yeah, that is a good point. there are no links between many of the various examples or tutorials. the original documentation did a good job in referencing and linking the documentation to additional information or another part of the documentation. are these documents able to be edited by the community?
To change the documentation, we welcome pull requests to our Onion-Docs repo on GitHub to make changes that will benefit our entire community. Docs.onion.io is generated form this repo.
Also, if you want to make any additions or changes to conent on our website (e.g. 2 Bullet Tuesday) please send us an email or let us know in the community