frlen / nagnu

Nagios dashboard in ncurses
BSD 2-Clause "Simplified" License
19 stars 3 forks source link

Doesn't build with -fno-common #5

Open clausecker opened 1 year ago

clausecker commented 1 year ago

This project currently doesn't build with -fno-common, which is the default on recent versions of gcc and clang:

ld: error: duplicate symbol: num_strings               
>>> defined at nagnu.c                                                                                                 
>>>            /tmp/nagnu-c0929e.o:(num_strings)                                                                       
>>> defined at excludes.c                                                                                              
>>>            /tmp/excludes-2a14e1.o:(.bss+0x4)                                                                       

ld: error: duplicate symbol: longest_string              
>>> defined at nagnu.c                                                                                                 
>>>            /tmp/nagnu-c0929e.o:(longest_string)                                                                    
>>> defined at excludes.c                                  
>>>            /tmp/excludes-2a14e1.o:(.bss+0x0)                                                                       

ld: error: duplicate symbol: excludes_save                                                                             
>>> defined at nagnu.c                                                                                                 
>>>            /tmp/nagnu-c0929e.o:(excludes_save)                                                                     
>>> defined at excludes.c                                  
>>>            /tmp/excludes-2a14e1.o:(.bss+0x8)           

ld: error: duplicate symbol: errorss  
>>> defined at nagnu.c                                                                                                 
>>>            /tmp/nagnu-c0929e.o:(errorss)                                                                           >>> defined at excludes.c                                                                                              >>>            /tmp/excludes-2a14e1.o:(.bss+0x10)                                                                      

ld: error: duplicate symbol: svalue  
>>> defined at nagnu.c                                                                                                 
>>>            /tmp/nagnu-c0929e.o:(svalue)                                                                            
>>> defined at arguments.c                                                                                             
>>>            /tmp/arguments-a16f29.o:(.data+0x0)                                                                     cc: error: linker command failed with exit code 1 (use -v to see invocation)

To fix this problem, either pass -fcommon explicitly in CFLAGS or better ensure that each variable is defined in exactly one source file with header files only holding declarations.