sardemff7 / eventd

A simple daemon to track remote or local events and do actions the user wants to
https://www.eventd.org
Other
46 stars 4 forks source link

plugins/nd: Fix building with CFLAGS=-fno-common #49

Closed jer-gentoo closed 4 years ago

jer-gentoo commented 4 years ago

With the GCC -fno-common flag, enabled by default in GCC >=10, the linker fails with messages like these:

ld: plugins/nd/1b87e75@@nd@sha/src_notification.c.o:(.bss+0x0): multiple definition of eventd_nd_backends_names'; plugins/nd/1b87e75@@nd@sha/src_nd.c.o:(.data.rel.local+0x20): first defined here ld: plugins/nd/1b87e75@@nd@sha/src_backends.c.o:(.bss+0x0): multiple definition ofeventd_nd_backends_names'; plugins/nd/1b87e75@@nd@sha/src_nd.c.o:(.data.rel.local+0x20): first defined here collect2: error: ld returned 1 exit status

Fix this by declaring eventd_nd_backends_names as extern.

Signed-off-by: Jeroen Roovers jer@gentoo.org

sardemff7 commented 4 years ago

Thanks for the patch!

I’ll just be nitpicky on the commit message: although I don’t always succeed, I try to describe the actual issue in the summary for this kind of fixes. The flag breaking the build is a symptom here. I would go with “Avoid a possible multiple definition”, what do you think?

Also, I use "nd:" as the prefix (IOW, just the plugin name), "plugins:" is for commits that affects many plugins at once for a generic change.

jer-gentoo commented 4 years ago

I adjusted the commit message.

sardemff7 commented 4 years ago

Perfect! Thanks again :-)