Created folder called ~/workspace
Extracted my targets SDK contents into ~/workspace
Entered the 2 environment veriables
PATH=$PATH:~/workspace/staging_dir/toolchain-mipsel_24kc_gcc-11.2.0_musl/bin
export PATH
STAGING_DIR=~/workspace/staging_dir/toolchain-mipsel_24kc_gcc-11.2.0_musl/bin
export STAGING_DIR
Downloaded and extracted ampr-ripd-2.4.1 source files here: ~/workspace/dl/ampr-ripd-2.4.1
Entered into ~/workspace/dl/ampr-ripd-2.4.1 and....
Entered make CC=mipsel-openwrt-linux-musl-cpp LD=mipsel-openwrt-linux-musl-ld
(Used cpp because I saw someone in the archives from way back who used it)
and got:
mipsel-openwrt-linux-musl-cpp -Wall -O2 -D HAVE_DEBUG -o ampr-ripd ampr-ripd.c
ampr-ripd.c:125:10: fatal error: bits/getopt_core.h: No such file or directory
125 | #include <bits/getopt_core.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:30: ampr-ripd] Error 1
For S & G's I tried it with the other compilers, c++, g++, gcc and got the same response.
Commented out:
//#include <bits/getopt_core.h> in ampr-ripd.c
Retyped: make CC=mipsel-openwrt-linux-musl-cpp LD=mipsel-openwrt-linux-musl-ld
and got:
mipsel-openwrt-linux-musl-cpp -Wall -O2 -D HAVE_DEBUG -o ampr-ripd ampr-ripd.c
ampr-ripd executable (assuming) appears in the folder. I think I'm doing good at this point.
Moved the executable to /usr/sbin on the target (Netgear R6220) and ran ./ampr-ripd
and got:
root@OpenWrt:/usr/sbin# ./ampr-ripd
./ampr-ripd: line 14: typedef: not found
./ampr-ripd: line 16: typedef: not found
./ampr-ripd: line 18: typedef: not found
./ampr-ripd: line 23: typedef: not found
./ampr-ripd: line 28: typedef: not found
./ampr-ripd: line 33: typedef: not found
./ampr-ripd: line 38: typedef: not found
./ampr-ripd: line 43: typedef: not found
./ampr-ripd: line 48: typedef: not found
./ampr-ripd: line 53: typedef: not found
./ampr-ripd: line 58: typedef: not found
./ampr-ripd: line 60: typedef: not found
./ampr-ripd: line 63: typedef: not found
./ampr-ripd: line 64: typedef: not found
./ampr-ripd: line 66: typedef: not found
./ampr-ripd: line 67: typedef: not found
./ampr-ripd: line 68: typedef: not found
./ampr-ripd: line 69: typedef: not found
./ampr-ripd: line 71: typedef: not found
./ampr-ripd: line 72: typedef: not found
./ampr-ripd: line 74: typedef: not found
./ampr-ripd: line 75: typedef: not found
./ampr-ripd: line 76: typedef: not found
./ampr-ripd: line 77: typedef: not found
./ampr-ripd: line 80: typedef: not found
./ampr-ripd: line 81: typedef: not found
./ampr-ripd: line 82: typedef: not found
./ampr-ripd: line 83: typedef: not found
./ampr-ripd: line 99: typedef: not found
./ampr-ripd: line 101: typedef: not found
./ampr-ripd: line 104: syntax error: unexpected "("
(I saw this error in the archives but had no answer for his issue)
Deleted the assumed executable from the working environment and....
Changed compilers
make CC=mipsel-openwrt-linux-musl-gcc LD=mipsel-openwrt-linux-musl-ld
and got:
mipsel-openwrt-linux-musl-gcc -Wall -O2 -D HAVE_DEBUG -o ampr-ripd ampr-ripd.c
ampr-ripd.c: In function 'create_fwsd':
ampr-ripd.c:1593:30: error: 'IPPORT_ROUTESERVER' undeclared (first use in this function); did you mean 'IPPORT_RESERVED'?
1593 | sin.sin_port = htons(IPPORT_ROUTESERVER);
| ^~~~~~~~~~~~~~~~~~
| IPPORT_RESERVED
ampr-ripd.c:1593:30: note: each undeclared identifier is reported only once for each function it appears in
ampr-ripd.c: In function 'create_amprfwsd':
ampr-ripd.c:1658:30: error: 'IPPORT_ROUTESERVER' undeclared (first use in this function); did you mean 'IPPORT_RESERVED'?
1658 | sin.sin_port = htons(IPPORT_ROUTESERVER);
| ^~~~~~~~~~~~~~~~~~
| IPPORT_RESERVED
ampr-ripd.c: In function 'on_alarm':
ampr-ripd.c:1800:34: error: 'IPPORT_ROUTESERVER' undeclared (first use in this function); did you mean 'IPPORT_RESERVED'?
1800 | sin.sin_port = htons(IPPORT_ROUTESERVER);
| ^~~~~~~~~~~~~~~~~~
| IPPORT_RESERVED
ampr-ripd.c: In function 'main':
ampr-ripd.c:2132:38: error: 'IPPORT_ROUTESERVER' undeclared (first use in this function); did you mean 'IPPORT_RESERVED'?
2132 | sin.sin_port = htons(IPPORT_ROUTESERVER);
| ^~~~~~~~~~~~~~~~~~
| IPPORT_RESERVED
ampr-ripd.c:2238:49: error: 'struct udphdr' has no member named 'dest'
2238 | (udh->dest == htons(IPPORT_ROUTESERVER)) &&
| ^~
ampr-ripd.c:2239:49: error: 'struct udphdr' has no member named 'source'
2239 | (udh->source == htons(IPPORT_ROUTESERVER)))
| ^~
make: *** [Makefile:30: ampr-ripd] Error 1
(I got the same when using some of the other compiler options)
so I added to ampr-ripd.c as seen in the groups
#define IPPORT_ROUTESERVER 520
Retyped: make CC=mipsel-openwrt-linux-musl-gcc LD=mipsel-openwrt-linux-musl-ld
now i get:
mipsel-openwrt-linux-musl-gcc -Wall -O2 -D HAVE_DEBUG -o ampr-ripd ampr-ripd.c
ampr-ripd.c: In function 'main':
ampr-ripd.c:2240:49: error: 'struct udphdr' has no member named 'dest'
2240 | (udh->dest == htons(IPPORT_ROUTESERVER)) &&
| ^~
ampr-ripd.c:2241:49: error: 'struct udphdr' has no member named 'source'
2241 | (udh->source == htons(IPPORT_ROUTESERVER)))
| ^~
make: *** [Makefile:30: ampr-ripd] Error 1
Stopped right here and this is where Im staying for now. LOL