Build Error with unchanged Sources for Mediatek MK7620 (RavPower RP-WD03)

Hi OpenWrt Community,

I tried to compile OpenWrt myself for the Mediatek MK7620 (RavPower RP-WD03) to get access to the kmod-fs-exfat to be able to read/write exFat volumes from SDXC-Cards.

I followed the Tutorials here:
https://oldwiki.archive.openwrt.org/doc/howto/buildroot.exigence
and
https://oldwiki.archive.openwrt.org/doc/howto/build

I installed a fresh Debian Stretch, the toolchain, all development libraries, fetched the Git-Sources, run the update script and the install script for all modules, started make menuconfig, changed only the target to the RavPower WD03 and switched the "patented Modules" ON, saved the .config, started make download and then make -j5 (for my 4 cores). Then I got an make error and started the build process again with make -j1 V=sc to see some details.

This is what I got:
https://pastebin.com/3dh1bNuD

here are the first few lines - this does repeat for several files:

the first errors

In file included from ../common/sock_any.h:43:0,
from ../common/smtppass.c:68:
/home/ralf/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include/netinet/in.h:14:8: error: redefinition of 'struct in_addr'
struct in_addr { in_addr_t s_addr; };
^~~~~~~
In file included from /home/ralf/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include/linux/netfilter.h:7:0,
from /home/ralf/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include/linux/netfilter_ipv4.h:9,
from ../common/smtppass.c:64:
/home/ralf/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include/linux/in.h:85:8: note: originally defined here
struct in_addr {
^~~~~~~
In file included from ../common/sock_any.h:43:0,
from ../common/smtppass.c:68:
/home/ralf/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/include/netinet/in.h:16:8: error: redefinition of 'struct sockaddr_in'
struct sockaddr_in {
^~~~~~~~~~~

How can I build this without entering every mentioned file to insert IFDEF statements ?

How have the (available) packages for the RavPower WD03 been generated ?

Any help is highly appreciated.

Greetings from Berlin,
Ralf

Did you clone trunk (master) or a release?

I did the exact steps in the "Build System" Tutorial:

git clone https://github.com/openwrt/openwrt.git

I just switched to 18.06.1 branch and do the same ...

...make download did throw an error for module - I think it was "freeswitch".

I just started make -j1 V=s .... let's see what it does...

It throws the following ERROR:

**[  2%] Building C object CMakeFiles/blobmsg_json-static.dir/blobmsg_json.c.o**
/home/ralf/openwrt/build_dir/hostpkg/libubox-2018-07-25-c83a84af/blobmsg_json.c:21:19: fatal error: json.h: No such file or directory
  #include <json.h>
                   ^
compilation terminated. 

...I install libjson-c-dev and try again, but this does not change the error :frowning:

Help appreciated.

I know this is super old but I just had the same issue with 20.02.0

sudo apt-get install libjsoncpp-dev
sudo ln -s /usr/include/jsoncpp/json/ /usr/include/json

I hope that somebody finds this helpful.