@crispyoz said in Porting C code to Omega2:
@El-Berto Just look down your inlcude path for the header files and then examine their content.
Content is different, that's why I don't know how to proceed....
@crispyoz said in Porting C code to Omega2:
@El-Berto Just look down your inlcude path for the header files and then examine their content.
Content is different, that's why I don't know how to proceed....
Hi to all, I'm newbie in Omega2 and crosscompiling....
I have to port C code (born for Unix desktop) working on Ubuntu PC and on Raspberry Pi.
Actually I can correctly compile all code using gcc.
I bought Omega2 board (BusyBox v1.25.1 and Ω-ware: 0.2.2 b202).
I can't change/update OS.
Now I would like to run code (Earthworm seismic processing software) on it.
I suppose there are two ways:
I installed cross-compiler on Ubuntu machine, and now I started having many issues just compiling a couple of libraries....
#ifndef _RPC_TYPES_H
#define _RPC_TYPES_H 1
typedef int bool_t;
typedef int enum_t;
/* This needs to be changed to uint32_t in the future */
typedef unsigned long rpcprog_t;
typedef unsigned long rpcvers_t;
typedef unsigned long rpcproc_t;
typedef unsigned long rpcprot_t;
typedef unsigned long rpcport_t;
#define dontcare -1
#ifndef FALSE
#endif
#ifndef TRUE
#endif
#ifndef NULL
#endif
#include <stdlib.h> /* For malloc decl. /
#define mem_alloc(bsize) malloc(bsize)
/
#ifndef makedev /* ie, we haven't already included it */
#include <sys/types.h>
#endif
#if defined APPLE_CC || defined FreeBSD
#endif
#ifndef __u_char_defined
typedef __u_char u_char;
typedef __u_short u_short;
typedef __u_int u_int;
typedef __u_long u_long;
typedef __quad_t quad_t;
typedef __u_quad_t u_quad_t;
typedef __fsid_t fsid_t;
#endif
#ifndef __daddr_t_defined
typedef __daddr_t daddr_t;
typedef __caddr_t caddr_t;
#endif
#include <sys/time.h>
#include <sys/param.h>
#include <netinet/in.h>
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK (u_long)0x7F000001
#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
#endif
#endif /* rpc/types.h */
Is it missing in cross-compiler or am I setting wrong path?
error: 'PTHREAD_MUTEX_ADAPTIVE_NP' undeclared
Here the same.
Thanks.
@crispyoz It works, many thanks!
[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=ugpio
Compiling 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?
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)):
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.