bmx-routing / bmx7

BMX7 / SEMTOR Securely Entrusted Mesh Routing Protocol
GNU General Public License v2.0
63 stars 15 forks source link

Namespace clash between bmx7's list.h and <libubox/list.h> #34

Closed cotequeiroz closed 5 years ago

cotequeiroz commented 6 years ago

Compiling bmx7 with BMX7_LIB_IWINFO (openwrt bmx7 pakcage), I've got these errors:

mipsel-openwrt-linux-musl-gcc  -pedantic -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Os -g3 -std=gnu99 -DGIT_REV=\"9883383dc26df16da67b9ef7ba99efe62f79c4e7\" -DAVL_5XLINKED -DDEBUG_MALLOC -DCORE_LIMIT=20000       -pedantic -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Os -g3 -std=gnu99 -DGIT_REV=\"9883383dc26df16da67b9ef7ba99efe62f79c4e7\" -DAVL_5XLINKED -DDEBUG_MALLOC -DCORE_LIMIT=20000      -fpic -I../../ -Os -pipe -mno-branch-likely -mips32 -mtune=mips32 -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/home/equeiroz/src/openwrt/build_dir/target-mipsel_mips32_musl/bmx7-r2018042501:bmx7-r2018042501 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -I. -I/home/equeiroz/src/openwrt/staging_dir/target-mipsel_mips32_musl/usr/include -DCRYPTLIB=MBEDTLS_2_4_0 -DCORE_LIMIT=20000 -DTRAFFIC_DUMP -DNO_TRACE_FUNCTION_CALLS -DBMX7_LIB_IWINFO -c bmx7_iwinfo.c -o bmx7_iwinfo.o
In file included from /home/equeiroz/src/openwrt/staging_dir/target-mipsel_mips32_musl/usr/include/libubus.h:18:0,
                 from /home/equeiroz/src/openwrt/staging_dir/target-mipsel_mips32_musl/usr/include/iwinfo/utils.h:25,
                 from /home/equeiroz/src/openwrt/staging_dir/target-mipsel_mips32_musl/usr/include/iwinfo.h:251,
                 from bmx7_iwinfo.c:63:
/home/equeiroz/src/openwrt/staging_dir/target-mipsel_mips32_musl/usr/include/libubox/list.h:45:8: error: redefinition of 'struct list_head'
 struct list_head {
        ^~~~~~~~~
In file included from bmx7_iwinfo.c:41:0:
../../list.h:39:8: note: originally defined here
 struct list_head {
        ^~~~~~~~~
In file included from /home/equeiroz/src/openwrt/staging_dir/target-mipsel_mips32_musl/usr/include/libubus.h:18:0,
                 from /home/equeiroz/src/openwrt/staging_dir/target-mipsel_mips32_musl/usr/include/iwinfo/utils.h:25,
                 from /home/equeiroz/src/openwrt/staging_dir/target-mipsel_mips32_musl/usr/include/iwinfo.h:251,
                 from bmx7_iwinfo.c:63:
/home/equeiroz/src/openwrt/staging_dir/target-mipsel_mips32_musl/usr/include/libubox/list.h:145:1: error: conflicting types for 'list_add_tail'
 list_add_tail(struct list_head *_new, struct list_head *head)
 ^~~~~~~~~~~~~
In file included from bmx7_iwinfo.c:41:0:
../../list.h:82:6: note: previous declaration of 'list_add_tail' was here
 void list_add_tail(struct list_head *head, struct list_node * new);
      ^~~~~~~~~~~~~
bmx7_iwinfo.c: In function 'get_link_rate':
bmx7_iwinfo.c:81:8: warning: unused variable 'TODO_use_nl_tiny_lib_instead' [-Wunused-variable]
  IDM_T TODO_use_nl_tiny_lib_instead;
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[5]: *** [Makefile:26: bmx7_iwinfo.o] Error 1

The headers involved are bmx7's "list.h", and <libubox/list.h> As a workaround, I'm just adding -D_LINUX_LIST_H_ to CFLAGS, so that <libubox/list.h> does not get loaded. Avoiding name-space collision would probably be a better fix. Cheers, Eneas

dangowrt commented 6 years ago

resolved by https://github.com/bmx-routing/bmx7/pull/35

aparcar commented 5 years ago

merged #35