Hi,
Build system is Ubuntu 14.04 LTS x86_64 for cross-compiling, with the VoCore2/OpenWRT tools installed from <
http://vocore.io/v2u.html> -> Downloads -> Toolchain: Download (Ubuntu 14.04 x64).
1) Unpack the toolchain
I unpacked these to ~/vocore2 and removed the "outer-shell" directories.
2) Prepare cross-build
$ PATH=$PATH:/home/goetz/vocore2/bin
$ export PATH
$ STAGING_DIR=/home/goetz/vocore2/
$ export STAGING_DIR
3) Fix "resolve.c"
Otherwise we’ll run into [1]:
$ diff ngircd-24/src/ngircd/resolve-orig.c ngircd-24/src/ngircd/resolve.c
112,113d111
< #if !defined(HAVE_GETADDRINFO) || !defined(HAVE_GETNAMEINFO)
< #if !defined(WANT_IPV6) && defined(h_errno)
130,131d127
< #endif
< #endif
Basically, we need to “enforce” the definition of Get_Error. Without removing the conditionals, it will be missing and the cross-build will fail.
3) Configure for cross-build
$ ./configure --build=mipsel-unknown-linux-gnu --host=mipsel-openwrt-linux-uclibc --build=x86_64-unknown-linux-gnu
Check that the line
checking whether we are cross compiling... yes
is there.
The summary should look similar to:
ngIRCd 24 has been configured with the following options:
Host: mipsel-openwrt-linux-uclibc
Compiler: mipsel-openwrt-linux-uclibc-gcc -std=gnu99
Compiler flags: -g -O2 -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes -DSYSCONFDIR='"$(sysconfdir)"' -DDOCDIR='"$(docdir)"'
'ngircd' binary: /usr/local/sbin
Configuration file: /usr/local/etc
Manual pages: /usr/local/share/man
Documentation: /usr/local/share/doc/ngircd
Syslog support: yes Enable debug code: no
zlib compression: no IRC sniffer: no
Use TCP Wrappers: no Strict RFC mode: no
IDENT support: no IRC+ protocol: yes
IPv6 protocol: no I/O backend: epoll(), select()
PAM support: no SSL support: no
libiconv support: no
4) Build ngircd from source
$ make CC=mipsel-openwrt-linux-uclibc-gcc LD=mipsel-openwrt-linux-uclibc-ld
5) Check correct binary type
$ file src/ngircd/ngircd
src/ngircd/ngircd: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), not stripped
Looking good! Now you can copy over the binary to your VoCore2 and run it.
[1]: Error with unpatched resolve.c:
resolve.c: In function 'ForwardLookup':
resolve.c:285:11: warning: implicit declaration of function 'Get_Error' [-Wimplicit-function-declaration]
hostname, Get_Error(h_errno));
^
resolve.c:236:56: warning: unused parameter 'af' [-Wunused-parameter]
ForwardLookup(const char *hostname, array *IpAddr, int af)
^
CCLD ngircd
client.o: In function `Client_Init':
ngircd-24/src/ngircd/client.c:94: warning: gethostbyname is obsolescent, use getnameinfo() instead.
resolve.o: In function `ForwardLookup':
ngircd-24/src/ngircd/resolve.c:284: undefined reference to `Get_Error'
collect2: error: ld returned 1 exit status
[2] Machine info:
BusyBox v1.23.2 (2016-09-03 09:56:08 CST) built-in shell (ash)
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
CHAOS CALMER (Chaos Calmer, r49378)
-----------------------------------------------------
* 1 1/2 oz Gin Shake with a glassful
* 1/4 oz Triple Sec of broken ice and pour
* 3/4 oz Lime Juice unstrained into a goblet.
* 1 1/2 oz Orange Juice
* 1 tsp. Grenadine Syrup
-----------------------------------------------------
root@VoCore2:~# cat /proc/cpuinfo
system type : MediaTek MT7628AN ver:1 eco:2
machine : VoCore2
processor : 0
cpu model : MIPS 24KEc V5.5
BogoMIPS : 385.84
wait instruction : yes
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa : mips1 mips2 mips32r1 mips32r2
ASEs implemented : mips16 dsp
shadow register sets : 1
kscratch registers : 0
package : 0
core : 0
VCED exceptions : not available
VCEI exceptions : not available
root@VoCore2:~# free -m
total used free shared buffers
Mem: 126476 37180 89296 252 4524
-/+ buffers: 32656 93820
Swap: 0 0 0
root@VoCore2:~# uname -a
Linux VoCore2 3.18.29 #22 Sun Oct 16 21:00:17 CST 2016 mips GNU/Linux
root@VoCore2:~# ./ngircd -n
[…]
[2803:4 0] No help text available, HELP command will be of limited use.
[2803:4 0] No administrative information configured but required by RFC!
[2803:5 0] ngIRCd 24-IRCPLUS+SYSLOG-mipsel/openwrt/linux-uclibc started.
[2803:6 0] Using configuration file "/usr/local/etc/ngircd.conf" ...
[2803:6 0] ServerUID must not be root(0), using "nobody" instead.
[2803:6 0] Running as user nobody(65534), group nogroup(65534), with PID 2803.
[2803:6 0] Not running with changed root directory.
[2803:6 0] IO subsystem: epoll (hint size 100, initial maxfd 100, masterfd 3).
[2803:6 0] Now listening on [0.0.0.0]:6667 (socket 6).
Regards
Götz
--