ocerman / zenmonitor

Zen monitor is monitoring software for AMD Zen-based CPUs.
MIT License
251 stars 28 forks source link

Build Fails on GCC 10 #25

Closed gardotd426 closed 4 years ago

gardotd426 commented 4 years ago

Trying to build this on an up-to-date Arch or Manjaro (or other Arch derivative) will fail, with the following errors:

cc -Isrc/include `pkg-config --cflags gtk+-3.0` src/*.c src/ss/*.c -o zenmonitor `pkg-config --libs gtk+-3.0` -lm -no-pie -Wall
/usr/bin/ld: /tmp/ccWa2q8z.o:(.bss+0x0): multiple definition of `display_coreid'; /tmp/ccTxz7QB.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccP4n6ZC.o:(.bss+0x0): multiple definition of `display_coreid'; /tmp/ccTxz7QB.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccidjqdB.o:(.bss+0x0): multiple definition of `display_coreid'; /tmp/ccTxz7QB.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccN5s0Yz.o:(.bss+0x0): multiple definition of `display_coreid'; /tmp/ccTxz7QB.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccA63nlA.o:(.bss+0x0): multiple definition of `display_coreid'; /tmp/ccTxz7QB.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [makefile:6: build] Error 1

This is with both the zenmonitor and zenmonitor-git AUR packages, as well as trying to build directly from this repo. The issue is GCC 10, after downgrading to 9.3, the build succeeds and the program works perfectly.

birdie-github commented 4 years ago

Add -fcommon to your CFLAGS. That should fix it.

gardotd426 commented 4 years ago
CFLAGS=-fcommon make
cc -Isrc/include `pkg-config --cflags gtk+-3.0` src/*.c src/ss/*.c -o zenmonitor `pkg-config --libs gtk+-3.0` -lm -no-pie -Wall
/usr/bin/ld: /tmp/cc1I06we.o:(.bss+0x0): multiple definition of `display_coreid'; /tmp/ccdYIWOe.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccWhTeye.o:(.bss+0x0): multiple definition of `display_coreid'; /tmp/ccdYIWOe.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccGAfYne.o:(.bss+0x0): multiple definition of `display_coreid'; /tmp/ccdYIWOe.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccfvkBLf.o:(.bss+0x0): multiple definition of `display_coreid'; /tmp/ccdYIWOe.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/cc3YksPd.o:(.bss+0x0): multiple definition of `display_coreid'; /tmp/ccdYIWOe.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [makefile:6: build] Error 1
hehtkz commented 4 years ago

@gardotd426 put -fcommon on the makefile at the end of the cc command in build section

Maxr1998 commented 4 years ago

Maintainer of the AUR package zenmonitor-git here, I added a patch so it builds again now. I will however also open a PR in a minute that fixes the issue upstream.