omniedgeio / omniedge

Bringing intranet on the internet with Zero-Config Mesh VPNs.

Home Page:https://omniedge.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cli cross compile error for MIPS

yongqianme opened this issue · comments

Try to cross compile omniedge cli for mips from docker, and got the errors as following :

root@f506c105fb7d:/project/omniedge-cli# export GOARCH=mips
root@f506c105fb7d:/project/omniedge-cli# export GOMIPS=softfloat
root@f506c105fb7d:/project/omniedge-cli# vim internal/edge.go
root@f506c105fb7d:/project/omniedge-cli# BUILD_ENV=prod make build
go generate ./...
Cloning into 'n2n'...
remote: Enumerating objects: 6889, done.
remote: Counting objects: 100% (78/78), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 6889 (delta 48), reused 63 (delta 42), pack-reused 6811
Receiving objects: 100% (6889/6889), 3.38 MiB | 1.14 MiB/s, done.
Resolving deltas: 100% (4695/4695), done.
Checking connectivity... done.
Branch 2.6-stable-omni set up to track remote branch 2.6-stable-omni from origin.
Switched to a new branch '2.6-stable-omni'
Wait please...

Now run ./configure
checking for x86_64-linux-gnu-gcc... mips-linux-gnu-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether mips-linux-gnu-gcc accepts -g... yes
checking for mips-linux-gnu-gcc option to accept ISO C89... none needed
checking for AES_cbc_encrypt in -lcrypto... no
checking for pcap_open_live in -lpcap... no
checking for pcap_set_immediate_mode in -lpcap... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating tools/Makefile
config.status: creating config.h
make[1]: Entering directory '/project/omniedge-cli/internal/n2n'
mips-linux-gnu-gcc  -g3  -Wall   -fpic -c n2n.c -o n2n.o
mips-linux-gnu-gcc  -g3  -Wall   -fpic -c wire.c -o wire.o
mips-linux-gnu-gcc  -g3  -Wall   -fpic -c minilzo.c -o minilzo.o
mips-linux-gnu-gcc  -g3  -Wall   -fpic -c twofish.c -o twofish.o
mips-linux-gnu-gcc  -g3  -Wall   -fpic -c edge_utils.c -o edge_utils.o
mips-linux-gnu-gcc  -g3  -Wall   -fpic -c transform_null.c -o transform_null.o
mips-linux-gnu-gcc  -g3  -Wall   -fpic -c transform_tf.c -o transform_tf.o
mips-linux-gnu-gcc  -g3  -Wall   -fpic -c tuntap_freebsd.c -o tuntap_freebsd.o
mips-linux-gnu-gcc  -g3  -Wall   -fpic -c tuntap_netbsd.c -o tuntap_netbsd.o
mips-linux-gnu-gcc  -g3  -Wall   -fpic -c tuntap_linux.c -o tuntap_linux.o
mips-linux-gnu-gcc  -g3  -Wall   -fpic -c tuntap_osx.c -o tuntap_osx.o
ar rcs libn2n.a n2n.o wire.o minilzo.o twofish.o edge_utils.o transform_null.o transform_tf.o tuntap_freebsd.o tuntap_netbsd.o tuntap_linux.o tuntap_osx.o
mips-linux-gnu-gcc  -g3  -Wall   -fpic edge.c libn2n.a  -o edge
mips-linux-gnu-gcc  -g3  -Wall   -fpic sn.c libn2n.a  -o supernode
mips-linux-gnu-gcc  -g3  -Wall   -fpic example_edge_embed.c libn2n.a  -o example_edge_embed
gzip -c edge.8 > edge.8.gz
gzip -c supernode.1 > supernode.1.gz
gzip -c n2n.7 > n2n.7.gz
make -C tools
make[2]: Entering directory '/project/omniedge-cli/internal/n2n/tools'
mips-linux-gnu-gcc -I.. -g3  -Wall benchmark.c ../libn2n.a  -o n2n-benchmark
make[2]: Leaving directory '/project/omniedge-cli/internal/n2n/tools'
make[1]: Leaving directory '/project/omniedge-cli/internal/n2n'
rm -rf ./out
GOOS=linux go build -ldflags "-X main.Env=prod" -o out/omniedge cmd/edgecli/main.go
# runtime/cgo
/usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/bin/ld: Warning: $WORK/b083/_cgo_.o uses -mhard-float (set by /usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/lib/../lib/crt1.o), $WORK/b083/_cgo_main.o uses -msoft-float
/usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/bin/ld: Warning: $WORK/b083/_cgo_.o uses -mhard-float (set by /usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/lib/../lib/crt1.o), $WORK/b083/_x001.o uses -msoft-float
/usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/bin/ld: Warning: $WORK/b083/_cgo_.o uses -mhard-float (set by /usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/lib/../lib/crt1.o), $WORK/b083/_x002.o uses -msoft-float
/usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/bin/ld: Warning: $WORK/b083/_cgo_.o uses -mhard-float (set by /usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/lib/../lib/crt1.o), $WORK/b083/_x003.o uses -msoft-float
/usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/bin/ld: Warning: $WORK/b083/_cgo_.o uses -mhard-float (set by /usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/lib/../lib/crt1.o), $WORK/b083/_x004.o uses -msoft-float
/usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/bin/ld: Warning: $WORK/b083/_cgo_.o uses -mhard-float (set by /usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/lib/../lib/crt1.o), $WORK/b083/_x005.o uses -msoft-float
/usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/bin/ld: Warning: $WORK/b083/_cgo_.o uses -mhard-float (set by /usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/lib/../lib/crt1.o), $WORK/b083/_x006.o uses -msoft-float
/usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/bin/ld: Warning: $WORK/b083/_cgo_.o uses -mhard-float (set by /usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/lib/../lib/crt1.o), $WORK/b083/_x007.o uses -msoft-float
/usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/bin/ld: Warning: $WORK/b083/_cgo_.o uses -mhard-float (set by /usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/lib/../lib/crt1.o), $WORK/b083/_x008.o uses -msoft-float
/usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/bin/ld: Warning: $WORK/b083/_cgo_.o uses -mhard-float (set by /usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/lib/../lib/crt1.o), $WORK/b083/_x009.o uses -msoft-float
/usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/bin/ld: Warning: $WORK/b083/_cgo_.o uses -mhard-float (set by /usr/lib/gcc/mips-linux-gnu/4.3.5/../../../../mips-linux-gnu/lib/../lib/crt1.o), $WORK/b083/_x010.o uses -msoft-float
# runtime/cgo
/tmp/cc4zx9dF.s: Assembler messages:
/tmp/cc4zx9dF.s: Warning: .gnu_attribute 4,3 requires `softfloat'
# runtime/cgo
/tmp/cc1C6rgI.s: Assembler messages:
/tmp/cc1C6rgI.s: Warning: .gnu_attribute 4,3 requires `softfloat'
# runtime/cgo
/tmp/ccEDb7SH.s: Assembler messages:
/tmp/ccEDb7SH.s: Warning: .gnu_attribute 4,3 requires `softfloat'
# runtime/cgo
/tmp/ccsQ5AHG.s: Assembler messages:
/tmp/ccsQ5AHG.s: Warning: .gnu_attribute 4,3 requires `softfloat'
# runtime/cgo
/tmp/ccretcFK.s: Assembler messages:
/tmp/ccretcFK.s: Warning: .gnu_attribute 4,3 requires `softfloat'
# runtime/cgo
/tmp/ccXNUiiM.s: Assembler messages:
/tmp/ccXNUiiM.s: Warning: .gnu_attribute 4,3 requires `softfloat'
# runtime/cgo
/tmp/ccltUY6R.s: Assembler messages:
/tmp/ccltUY6R.s: Warning: .gnu_attribute 4,3 requires `softfloat'
# runtime/cgo
/tmp/cc50Vf3U.s: Assembler messages:
/tmp/cc50Vf3U.s: Warning: .gnu_attribute 4,3 requires `softfloat'
# runtime/cgo
/tmp/cc9lg2oW.s: Assembler messages:
/tmp/cc9lg2oW.s: Warning: .gnu_attribute 4,3 requires `softfloat'
# runtime/cgo
/tmp/ccdB0wRY.s: Assembler messages:
/tmp/ccdB0wRY.s: Warning: .gnu_attribute 4,3 requires `softfloat'
# runtime/cgo
/tmp/ccqtONyV.s: Assembler messages:
/tmp/ccqtONyV.s: Warning: .gnu_attribute 4,3 requires `softfloat'
# net
cgo: mips-linux-gnu-gcc did not produce error at completed:1
on input:

#line 1 "cgo-builtin-prolog"
#include <stddef.h> /* for ptrdiff_t and size_t below */

/* Define intgo when compiling with GCC.  */
typedef ptrdiff_t intgo;

#define GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; intgo n; } _GoString_;
typedef struct { char *p; intgo n; intgo c; } _GoBytes_;
_GoString_ GoString(char *p);
_GoString_ GoStringN(char *p, int l);
_GoBytes_ GoBytes(void *p, int n);
char *CString(_GoString_);
void *CBytes(_GoBytes_);
void *_CMalloc(size_t);

__attribute__ ((unused))
static size_t _GoStringLen(_GoString_ s) { return (size_t)s.n; }

__attribute__ ((unused))
static const char *_GoStringPtr(_GoString_ s) { return s.p; }
#line 9 "/usr/local/go/src/net/cgo_resnew.go"

#include <sys/types.h>
#include <sys/socket.h>

#include <netdb.h>

#line 1 "cgo-generated-wrapper"
#line 1 "not-declared"
void __cgo_f_1_1(void) { __typeof__(char) *__cgo_undefined__1; }
#line 1 "not-type"
void __cgo_f_1_2(void) { char *__cgo_undefined__2; }
#line 1 "not-int-const"
void __cgo_f_1_3(void) { enum { __cgo_undefined__3 = (char)*1 }; }
#line 1 "not-num-const"
void __cgo_f_1_4(void) { static const double __cgo_undefined__4 = (char); }
#line 1 "not-str-lit"
void __cgo_f_1_5(void) { static const char __cgo_undefined__5[] = (char); }
#line 2 "not-declared"
void __cgo_f_2_1(void) { __typeof__(getnameinfo) *__cgo_undefined__1; }
#line 2 "not-type"
void __cgo_f_2_2(void) { getnameinfo *__cgo_undefined__2; }
#line 2 "not-int-const"
void __cgo_f_2_3(void) { enum { __cgo_undefined__3 = (getnameinfo)*1 }; }
#line 2 "not-num-const"
void __cgo_f_2_4(void) { static const double __cgo_undefined__4 = (getnameinfo); }
#line 2 "not-str-lit"
void __cgo_f_2_5(void) { static const char __cgo_undefined__5[] = (getnameinfo); }
#line 3 "not-declared"
void __cgo_f_3_1(void) { __typeof__(socklen_t) *__cgo_undefined__1; }
#line 3 "not-type"
void __cgo_f_3_2(void) { socklen_t *__cgo_undefined__2; }
#line 3 "not-int-const"
void __cgo_f_3_3(void) { enum { __cgo_undefined__3 = (socklen_t)*1 }; }
#line 3 "not-num-const"
void __cgo_f_3_4(void) { static const double __cgo_undefined__4 = (socklen_t); }
#line 3 "not-str-lit"
void __cgo_f_3_5(void) { static const char __cgo_undefined__5[] = (socklen_t); }
#line 1 "completed"
int __cgo__1 = __cgo__2;

full error output:
cc1: error: unrecognized command line option "-fno-lto"

# os/user
cgo: mips-linux-gnu-gcc did not produce error at completed:1
on input:

#line 1 "cgo-builtin-prolog"
#include <stddef.h> /* for ptrdiff_t and size_t below */

/* Define intgo when compiling with GCC.  */
typedef ptrdiff_t intgo;

#define GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; intgo n; } _GoString_;
typedef struct { char *p; intgo n; intgo c; } _GoBytes_;
_GoString_ GoString(char *p);
_GoString_ GoStringN(char *p, int l);
_GoBytes_ GoBytes(void *p, int n);
char *CString(_GoString_);
void *CBytes(_GoBytes_);
void *_CMalloc(size_t);

__attribute__ ((unused))
static size_t _GoStringLen(_GoString_ s) { return (size_t)s.n; }

__attribute__ ((unused))
static const char *_GoStringPtr(_GoString_ s) { return s.p; }
#line 15 "/usr/local/go/src/os/user/cgo_listgroups_unix.go"

#include <unistd.h>
#include <sys/types.h>

#line 1 "cgo-generated-wrapper"
#line 1 "not-declared"
void __cgo_f_1_1(void) { __typeof__(char) *__cgo_undefined__1; }
#line 1 "not-type"
void __cgo_f_1_2(void) { char *__cgo_undefined__2; }
#line 1 "not-int-const"
void __cgo_f_1_3(void) { enum { __cgo_undefined__3 = (char)*1 }; }
#line 1 "not-num-const"
void __cgo_f_1_4(void) { static const double __cgo_undefined__4 = (char); }
#line 1 "not-str-lit"
void __cgo_f_1_5(void) { static const char __cgo_undefined__5[] = (char); }
#line 2 "not-declared"
void __cgo_f_2_1(void) { __typeof__(gid_t) *__cgo_undefined__1; }
#line 2 "not-type"
void __cgo_f_2_2(void) { gid_t *__cgo_undefined__2; }
#line 2 "not-int-const"
void __cgo_f_2_3(void) { enum { __cgo_undefined__3 = (gid_t)*1 }; }
#line 2 "not-num-const"
void __cgo_f_2_4(void) { static const double __cgo_undefined__4 = (gid_t); }
#line 2 "not-str-lit"
void __cgo_f_2_5(void) { static const char __cgo_undefined__5[] = (gid_t); }
#line 3 "not-declared"
void __cgo_f_3_1(void) { __typeof__(int) *__cgo_undefined__1; }
#line 3 "not-type"
void __cgo_f_3_2(void) { int *__cgo_undefined__2; }
#line 3 "not-int-const"
void __cgo_f_3_3(void) { enum { __cgo_undefined__3 = (int)*1 }; }
#line 3 "not-num-const"
void __cgo_f_3_4(void) { static const double __cgo_undefined__4 = (int); }
#line 3 "not-str-lit"
void __cgo_f_3_5(void) { static const char __cgo_undefined__5[] = (int); }
#line 1 "completed"
int __cgo__1 = __cgo__2;

full error output:
cc1: error: unrecognized command line option "-fno-lto"

# github.com/omniedgeio/omniedge-cli/internal
cgo: mips-linux-gnu-gcc did not produce error at completed:1
on input:

#line 1 "cgo-builtin-prolog"
#include <stddef.h> /* for ptrdiff_t and size_t below */

/* Define intgo when compiling with GCC.  */
typedef ptrdiff_t intgo;

#define GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; intgo n; } _GoString_;
typedef struct { char *p; intgo n; intgo c; } _GoBytes_;
_GoString_ GoString(char *p);
_GoString_ GoStringN(char *p, int l);
_GoBytes_ GoBytes(void *p, int n);
char *CString(_GoString_);
void *CBytes(_GoBytes_);
void *_CMalloc(size_t);

__attribute__ ((unused))
static size_t _GoStringLen(_GoString_ s) { return (size_t)s.n; }

__attribute__ ((unused))
static const char *_GoStringPtr(_GoString_ s) { return s.p; }
#line 5 "/project/omniedge-cli/internal/edge.go"



#include "edge.h"

#line 1 "cgo-generated-wrapper"
#line 1 "not-declared"
void __cgo_f_1_1(void) { __typeof__(CString) *__cgo_undefined__1; }
#line 1 "not-type"
void __cgo_f_1_2(void) { CString *__cgo_undefined__2; }
#line 1 "not-int-const"
void __cgo_f_1_3(void) { enum { __cgo_undefined__3 = (CString)*1 }; }
#line 1 "not-num-const"
void __cgo_f_1_4(void) { static const double __cgo_undefined__4 = (CString); }
#line 1 "not-str-lit"
void __cgo_f_1_5(void) { static const char __cgo_undefined__5[] = (CString); }
#line 2 "not-declared"
void __cgo_f_2_1(void) { __typeof__(edge_configure) *__cgo_undefined__1; }
#line 2 "not-type"
void __cgo_f_2_2(void) { edge_configure *__cgo_undefined__2; }
#line 2 "not-int-const"
void __cgo_f_2_3(void) { enum { __cgo_undefined__3 = (edge_configure)*1 }; }
#line 2 "not-num-const"
void __cgo_f_2_4(void) { static const double __cgo_undefined__4 = (edge_configure); }
#line 2 "not-str-lit"
void __cgo_f_2_5(void) { static const char __cgo_undefined__5[] = (edge_configure); }
#line 3 "not-declared"
void __cgo_f_3_1(void) { __typeof__(edge_start) *__cgo_undefined__1; }
#line 3 "not-type"
void __cgo_f_3_2(void) { edge_start *__cgo_undefined__2; }
#line 3 "not-int-const"
void __cgo_f_3_3(void) { enum { __cgo_undefined__3 = (edge_start)*1 }; }
#line 3 "not-num-const"
void __cgo_f_3_4(void) { static const double __cgo_undefined__4 = (edge_start); }
#line 3 "not-str-lit"
void __cgo_f_3_5(void) { static const char __cgo_undefined__5[] = (edge_start); }
#line 4 "not-declared"
void __cgo_f_4_1(void) { __typeof__(int) *__cgo_undefined__1; }
#line 4 "not-type"
void __cgo_f_4_2(void) { int *__cgo_undefined__2; }
#line 4 "not-int-const"
void __cgo_f_4_3(void) { enum { __cgo_undefined__3 = (int)*1 }; }
#line 4 "not-num-const"
void __cgo_f_4_4(void) { static const double __cgo_undefined__4 = (int); }
#line 4 "not-str-lit"
void __cgo_f_4_5(void) { static const char __cgo_undefined__5[] = (int); }
#line 5 "not-declared"
void __cgo_f_5_1(void) { __typeof__(n2n_edge_conf_t) *__cgo_undefined__1; }
#line 5 "not-type"
void __cgo_f_5_2(void) { n2n_edge_conf_t *__cgo_undefined__2; }
#line 5 "not-int-const"
void __cgo_f_5_3(void) { enum { __cgo_undefined__3 = (n2n_edge_conf_t)*1 }; }
#line 5 "not-num-const"
void __cgo_f_5_4(void) { static const double __cgo_undefined__4 = (n2n_edge_conf_t); }
#line 5 "not-str-lit"
void __cgo_f_5_5(void) { static const char __cgo_undefined__5[] = (n2n_edge_conf_t); }
#line 6 "not-declared"
void __cgo_f_6_1(void) { __typeof__(tuntap_dev) *__cgo_undefined__1; }
#line 6 "not-type"
void __cgo_f_6_2(void) { tuntap_dev *__cgo_undefined__2; }
#line 6 "not-int-const"
void __cgo_f_6_3(void) { enum { __cgo_undefined__3 = (tuntap_dev)*1 }; }
#line 6 "not-num-const"
void __cgo_f_6_4(void) { static const double __cgo_undefined__4 = (tuntap_dev); }
#line 6 "not-str-lit"
void __cgo_f_6_5(void) { static const char __cgo_undefined__5[] = (tuntap_dev); }
#line 7 "not-declared"
void __cgo_f_7_1(void) { __typeof__(tuntap_open) *__cgo_undefined__1; }
#line 7 "not-type"
void __cgo_f_7_2(void) { tuntap_open *__cgo_undefined__2; }
#line 7 "not-int-const"
void __cgo_f_7_3(void) { enum { __cgo_undefined__3 = (tuntap_open)*1 }; }
#line 7 "not-num-const"
void __cgo_f_7_4(void) { static const double __cgo_undefined__4 = (tuntap_open); }
#line 7 "not-str-lit"
void __cgo_f_7_5(void) { static const char __cgo_undefined__5[] = (tuntap_open); }
#line 1 "completed"
int __cgo__1 = __cgo__2;

full error output:
cc1: error: unrecognized command line option "-fno-lto"

Makefile:4: recipe for target 'build' failed

OmniEdge cli for openwrt mips works now.

Tested on GL.iNet GL-MIFI only, CPU Model:MIPS 24Kc V7.4

Download:omniedgecli-0.2.3-mips.zip

If you got error like: ERROR[2022-08-22T22:56:54] Fail to generate hardware id, err is machineid: open /etc/machine-id: no such file or directory,run cp /proc/sys/kernel/random/uuid /etc/machine-id.

FazPJuGaIAAxKrt

The compile method

Prepare ubuntu system

sudo apt-get update && sudo apt-get install build-essential autoconf openssl gzip libssl-dev zip upx -y

Install Go bootstrap 1.4

curl -# -O https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz
tar -zxvf go1.4-bootstrap-20171003.tar.gz
cd go/src/
GOOS=linux GOARCH=amd64 ./make.bash

Prepare openwrt Cross compile

wget https://downloads.openwrt.org/releases/19.07.9/targets/ar71xx/generic/openwrt-sdk-19.07.9-ar71xx-generic_gcc-7.5.0_musl.Linux-x86_64.tar.xz
tar -xf openwrt-sdk-19.07.9-ar71xx-generic_gcc-7.5.0_musl.Linux-x86_64.tar.xz
mv openwrt-sdk-19.07.9-ar71xx-generic_gcc-7.5.0_musl.Linux-x86_64 openwrt_19.07.09-ar71xx
rm go1.4-bootstrap-20171003.tar.gz
rm openwrt-sdk-19.07.9-ar71xx-generic_gcc-7.5.0_musl.Linux-x86_64.tar.xz

Compile go from src for MIPS

export GOROOT_BOOTSTRAP=/home/ubuntu/go
export STAGING_DIR=/home/ubuntu/openwrt_19.07.09-ar71xx/staging_dir

wget https://go.dev/dl/go1.16.6.src.tar.gz
mv go1.16.6.src.tar.gz golang/
cd golang/
tar -xvf go1.16.6.src.tar.gz
cd go/src/
CGO_ENABLED=1 GOOS=linux GOARCH=mips GOMIPS=softfloat ./make.bash
cd ..
ls /pkg
ls /bin

Prepare the environment variable

export GOROOT_BOOTSTRAP=/home/ubuntu/golang/go
export CC=/home/ubuntu/openwrt_19.07.09-ar71xx/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/bin/mips-openwrt-linux-gcc
export CXX=/home/ubuntu/openwrt_19.07.09-ar71xx/staging_dir/toolchain-mips_24kc_gcc-7.5.0_musl/bin/mips-openwrt-linux-g++
export GOROOT=/home/ubuntu/golang/go
export GOBIN=$GOROOT/bin
export GOPATH=/home/ubuntu/omniedge
export PATH=$PATH:$GOBIN:GOPATH/bin

Verify environment variable

echo $PATH
go version

Compile OmniEdge

git clone https://github.com/omniedgeio/omniedge-cli
cd omniedge-cli
go mod download
go generate
CGO_ENABLED=1 GOOS=linux GOARCH=mips GOMIPS=softfloat BUILD_ENV=prod make build

Compress omniedge with UPX

upx -9 -k omniedge