https://github.com/op4packages/pdnsd-alt
https://github.com/AlexZhuo/luci-app-pdnsd

遇到的问题

  • redefinition of
    /home/openwrt/lede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
      |  ^~~~~~~
    In file included from ../dns.h:30,
                 from ../cache.h:31,
                 from ../helpers.h:32,
                 from ../error.h:35,
                 from ../icmp.c:63:
    /home/openwrt/lede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/net/if.h:64:8: error: redefinition of 'struct ifmap'
    64 | struct ifmap {
      |        ^~~~~
    In file included from /home/openwrt/lede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/linux/icmp.h:23,
                 from ../icmp.c:44:
    /home/openwrt/lede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/linux/if.h:194:8: note: originally defined here
    194 | struct ifmap {
      |        ^~~~~
    In file included from ../dns.h:30,
                 from ../cache.h:31,
                 from ../helpers.h:32,
                 from ../error.h:35,
                 from ../icmp.c:63:
    /home/openwrt/lede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/net/if.h:76:8: error: redefinition of 'struct ifreq'
    76 | struct ifreq {
      |        ^~~~~
    In file included from /home/openwrt/lede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/linux/icmp.h:23,
                 from ../icmp.c:44:
    /home/openwrt/lede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/linux/if.h:232:8: note: originally defined here
    232 | struct ifreq {
      |        ^~~~~
    In file included from ../dns.h:30,
                 from ../cache.h:31,
                 from ../helpers.h:32,
                 from ../error.h:35,
                 from ../icmp.c:63:
    /home/openwrt/lede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/net/if.h:116:8: error: redefinition of 'struct ifconf'
    116 | struct ifconf {
      |        ^~~~~~
    In file included from /home/openwrt/lede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/linux/icmp.h:23,
                 from ../icmp.c:44:
    /home/openwrt/lede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/linux/if.h:284:8: note: originally defined here
    284 | struct ifconf  {
      |        ^~~~~~
    make[6]: *** [Makefile:460: icmp.o] Error 1
    make[6]: Leaving directory '/home/openwrt/lede/build_dir/target-x86_64_musl/pdnsd-1.2.9/src/test'
    make[5]: *** [Makefile:607: all-recursive] Error 1
    make[5]: Leaving directory '/home/openwrt/lede/build_dir/target-x86_64_musl/pdnsd-1.2.9/src'
    Making all in doc
    make[5]: Entering directory '/home/openwrt/lede/build_dir/target-x86_64_musl/pdnsd-1.2.9/doc'
    make[5]: Nothing to be done for 'all'.
    make[5]: Leaving directory '/home/openwrt/lede/build_dir/target-x86_64_musl/pdnsd-1.2.9/doc'
    Making all in contrib
    make[5]: Entering directory '/home/openwrt/lede/build_dir/target-x86_64_musl/pdnsd-1.2.9/contrib'
    make[5]: Nothing to be done for 'all'.
    make[5]: Leaving directory '/home/openwrt/lede/build_dir/target-x86_64_musl/pdnsd-1.2.9/contrib'
    make[5]: Entering directory '/home/openwrt/lede/build_dir/target-x86_64_musl/pdnsd-1.2.9'
    make[5]: Leaving directory '/home/openwrt/lede/build_dir/target-x86_64_musl/pdnsd-1.2.9'
    make[4]: *** [Makefile:270: all-recursive] Error 1
    make[4]: Leaving directory '/home/openwrt/lede/build_dir/target-x86_64_musl/pdnsd-1.2.9'
    make[3]: *** [Makefile:202: all] Error 2
    make[3]: Leaving directory '/home/openwrt/lede/build_dir/target-x86_64_musl/pdnsd-1.2.9'
    make[2]: *** [Makefile:58: /home/openwrt/lede/build_dir/target-x86_64_musl/pdnsd-1.2.9/.built] Error 2
    make[2]: Leaving directory '/home/openwrt/lede/feeds/openwrtpdnsd/pdnsd'
    time: package/feeds/openwrtpdnsd/pdnsd/compile#6.23#1.35#11.23
    ERROR: package/feeds/openwrtpdnsd/pdnsd failed to build.
    make[1]: *** [package/Makefile:116: package/feeds/openwrtpdnsd/pdnsd/compile] Error 1
    make[1]: Leaving directory '/home/openwrt/lede'
    make: *** [/home/openwrt/lede/include/toplevel.mk:231:package/luci-app-pdnsd/compile] 错误 2

1)问题原因:lede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/net/if.hlede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/linux/if.h出现了相同定义。

2)查找解决办法:
查看lede/staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/linux/if.h

/* for compatibility with glibc net/if.h */
#if __UAPI_DEF_IF_IFMAP
struct ifmap {
        unsigned long mem_start;
        unsigned long mem_end;
        unsigned short base_addr;
        unsigned char irq;
        unsigned char dma;
        unsigned char port;
        /* 3 bytes spare */
};
#endif /* __UAPI_DEF_IF_IFMAP */

注释已经说明了for compatibility with glibc net/if.h,用宏解决与net/if.h文件的冲突,经查找宏定义位于staging_dir/toolchain-x86_64_gcc-11.3.0_musl/include/linux/libc-compat.h文件中。

3)解决方法:
将相关的宏定义全部改为0,重新编译。

#define __UAPI_DEF_IF_IFCONF 0
#define __UAPI_DEF_IF_IFMAP 0
#define __UAPI_DEF_IF_IFNAMSIZ 0
#define __UAPI_DEF_IF_IFREQ 0

0 条评论

发表回复

您的电子邮箱地址不会被公开。