tomac/yersinia

Make error with gcc 11.1.0, ld 2.36

zmatthias opened this issue · 2 comments

`$ make

Making all in src
make[1]: Entering directory '/home/z/Downloads/yersinia/src'
make all-am
make[2]: Entering directory '/home/z/Downloads/yersinia/src'
gcc -O3 -Wall -g -D_DEFAULT_SOURCE -o yersinia xstp.o parser.o dtp.o cdp.o dhcp.o hsrp.o dot1q.o vtp.o arp.o isl.o dot1x.o mpls.o thread-util.o terminal.o interfaces.o attack.o yersinia.o md5.o md5-sum.o protocols.o dlist.o ncurses-gui.o ncurses-callbacks.o ncurses-interface.o gtk-gui.o gtk-support.o gtk-interface.o gtk-callbacks.o admin.o commands.o -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -lpthread -lrt -lnsl -lresolv -lpcap -lnet -lpanel -lncurses
/usr/bin/ld: ncurses-interface.o:/home/z/Downloads/yersinia/src/ncurses-interface.c:95: multiple definition of pointer'; yersinia.o:/home/z/Downloads/yersinia/src/gtk-gui.h:50: first defined here /usr/bin/ld: gtk-gui.o:/home/z/Downloads/yersinia/src/gtk-gui.h:50: multiple definition of pointer'; yersinia.o:/home/z/Downloads/yersinia/src/gtk-gui.h:50: first defined here
/usr/bin/ld: gtk-interface.o:/home/z/Downloads/yersinia/src/gtk-interface.h:29: multiple definition of protocols_tree'; gtk-gui.o:/home/z/Downloads/yersinia/src/gtk-interface.h:29: first defined here /usr/bin/ld: gtk-interface.o:/home/z/Downloads/yersinia/src/gtk-interface.h:30: multiple definition of protocols_tree_model'; gtk-gui.o:/home/z/Downloads/yersinia/src/gtk-interface.h:30: first defined here
/usr/bin/ld: gtk-interface.o:/home/z/Downloads/yersinia/src/gtk-gui.h:50: multiple definition of pointer'; yersinia.o:/home/z/Downloads/yersinia/src/gtk-gui.h:50: first defined here /usr/bin/ld: gtk-callbacks.o:/home/z/Downloads/yersinia/src/gtk-interface.h:29: multiple definition of protocols_tree'; gtk-gui.o:/home/z/Downloads/yersinia/src/gtk-interface.h:29: first defined here
/usr/bin/ld: gtk-callbacks.o:/home/z/Downloads/yersinia/src/gtk-interface.h:30: multiple definition of protocols_tree_model'; gtk-gui.o:/home/z/Downloads/yersinia/src/gtk-interface.h:30: first defined here /usr/bin/ld: gtk-callbacks.o:/home/z/Downloads/yersinia/src/gtk-gui.h:50: multiple definition of pointer'; yersinia.o:/home/z/Downloads/yersinia/src/gtk-gui.h:50: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:445: yersinia] Error 1
make[2]: Leaving directory '/home/z/Downloads/yersinia/src'
make[1]: *** [Makefile:352: all] Error 2
make[1]: Leaving directory '/home/z/Downloads/yersinia/src'
make: *** [Makefile:460: all-recursive] Error 1`

Apparently fixed it by adding static in front of u_int8_t pointer[MAX_PROTOCOLS]; in gtk-gui.h, line 50 and in front of GtkWidget *protocols_tree[MAX_PROTOCOLS + 1]; and GtkListStore *protocols_tree_model[MAX_PROTOCOLS + 1]; in "gtk-interface.h", lines 29 and 30.

It seems as though adding the static keyword to the three pointer variables in the header files removes the possibility of other functions defining their own respective pointers. This hints at some refactoring being needed for the gtk header files/source code, however that is outside the scope of this issue.
This issue is addressed in PR #72