[totally newbie] I can't still cross-compile gpio example
-
Hi to all, I'm new about Onion (I'm using Omega 2) and I'm trying to port my C code (born for Raspberry) to Omega2, so I want cross-compile sources on Ubuntu.
I followed instructions about installing cross-compiler:
[https://docs.onion.io/omega2-docs/cross-compiling.html](link url)then gpio example:
[https://github.com/OnionIoT/c-cross-compile-example](link url)But when compiling I got error:
Searching among discussions I've found I haven't libugpio option available on menuconfig menu, so I followed these instructions [(https://community.onion.io/topic/2101/from-cross-compiling-for-the-omega-i-cannot-successfully-build-the-gpioread-example/11](link url)):
- mkdir package/libs/libugpio/
- cd package/libs/libugpio/
- create Makefile ([https://raw.githubusercontent.com/openwrt/packages/master/libs/libugpio/Makefile](link url))
- $ cd -
- $ make menuconfig
- select libugpio
- save changes and exit
- $ make -j4
Still ugpio/ugpio.h: No such file or directory
So, can someone tell me how compile example step-by-step? Please keep in mind I'm a noob about cross-compilation...
Thanks.
-
@El-Berto try this:
scripts/feeds update
scripts/feeds install libugpioRun make menuconfig to check that libugpio is enabled, then run make -j4
-
[sentinel@sysop-ThinkCentre-M910s:~/crosscompiler/source$ scripts/feeds update
Updating feed 'packages' from 'https://git.openwrt.org/feed/packages.git;openwrt-18.06' ...
Already up-to-date.
Create index file './feeds/packages.index'
Updating feed 'luci' from 'https://git.openwrt.org/project/luci.git;openwrt-18.06' ...
Already up-to-date.
Create index file './feeds/luci.index'
Updating feed 'routing' from 'https://git.openwrt.org/feed/routing.git;openwrt-18.06' ...
Already up-to-date.
Create index file './feeds/routing.index'
Updating feed 'telephony' from 'https://git.openwrt.org/feed/telephony.git;openwrt-18.06' ...
Already up-to-date.
Create index file './feeds/telephony.index'
Updating feed 'onion' from 'https://github.com/OnionIoT/OpenWRT-Packages.git;openwrt-18.06' ...
Already up-to-date.
Create index file './feeds/onion.index'
sentinel@sysop-ThinkCentre-M910s:~/crosscompiler/source$ scripts/feeds install libugpio
WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a build dependency on 'libpam', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libgnutls', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libopenldap', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libidn2', which does not exist
WARNING: Makefile 'package/network/utils/curl/Makefile' has a dependency on 'libssh2', which does not exist
WARNING: Makefile 'package/boot/kexec-tools/Makefile' has a dependency on 'liblzma', which does not exist
WARNING: Makefile 'package/network/services/lldpd/Makefile' has a dependency on 'libnetsnmp', which does not exist
sentinel@sysop-ThinkCentre-M910s:~/crosscompiler/source$ make menuconfig (I select libugpio)
sentinel@sysop-ThinkCentre-M910s:~/crosscompiler/source$ make -j4
...
sentinel@sysop-ThinkCentre-M910s:~/crosscompiler/source/mio$ sh xCompile.sh -buildroot /home/sentinel/crosscompiler/source -lib ugpio -debug
CC=/home/sentinel/crosscompiler/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/bin/mipsel-openwrt-linux-gcc
CXX=/home/sentinel/crosscompiler/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/bin/mipsel-openwrt-linux-g++
LD=/home/sentinel/crosscompiler/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/bin/mipsel-openwrt-linux-ld
CFLAGS=-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I /home/sentinel/crosscompiler/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/usr/include -I /home/sentinel/crosscompiler/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include -I /home/sentinel/crosscompiler/source/staging_dir/target-mipsel_24kc_musl-1.1.16/usr/include -I /home/sentinel/crosscompiler/source/staging_dir/target-mipsel_24kc_musl-1.1.16/include
LDFLAGS=-L/home/sentinel/crosscompiler/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/usr/lib -L/home/sentinel/crosscompiler/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/lib -L/home/sentinel/crosscompiler/source/staging_dir/target-mipsel_24kc_musl-1.1.16/usr/lib -L/home/sentinel/crosscompiler/source/staging_dir/target-mipsel_24kc_musl-1.1.16/lib
USER_LIBS=ugpioCompiling C program
/home/sentinel/crosscompiler/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/bin/mipsel-openwrt-linux-gcc -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I /home/sentinel/crosscompiler/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/usr/include -I /home/sentinel/crosscompiler/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include -I /home/sentinel/crosscompiler/source/staging_dir/target-mipsel_24kc_musl-1.1.16/usr/include -I /home/sentinel/crosscompiler/source/staging_dir/target-mipsel_24kc_musl-1.1.16/include gpioRead.c -o gpioRead -L/home/sentinel/crosscompiler/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/usr/lib -L/home/sentinel/crosscompiler/source/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/lib -L/home/sentinel/crosscompiler/source/staging_dir/target-mipsel_24kc_musl-1.1.16/usr/lib -L/home/sentinel/crosscompiler/source/staging_dir/target-mipsel_24kc_musl-1.1.16/lib -lugpio
gpioRead.c:7:10: fatal error: ugpio/ugpio.h: No such file or directory
#include <ugpio/ugpio.h>
^~~~~~~~~~~~~~~
compilation terminated.
Makefile:9: recipe for target 'gpioRead' failed
make: *** [gpioRead] Error 1](quote)
May you understand where is the error?
-
@El-Berto It looks like your xCompile.sh has an error in it, your target line should be
TARGET_NAME="target-mipsel_24kc_musl"It looks like it is set to target-mipsel_24kc_musl-1.1.16 which won't exist so your include of ugpio/ugpio.h will not resolve.
-
@crispyoz It works, many thanks!