PhirePhly / aprx

A highly configurable APRS I-gate/Digipeater Daemon
http://thelifeofkenneth.com/aprx/
BSD 3-Clause "New" or "Revised" License
153 stars 68 forks source link

Software not building #62

Open freaknils opened 3 years ago

freaknils commented 3 years ago

Hi,

is this software still under development/support?

I have got the following build error:

gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c aprx.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c ttyreader.c
In Datei, eingebunden von /usr/include/bits/libc-header-start.h:33,
                 von /usr/include/stdio.h:27,
                 von aprx.h:13,
                 von ttyreader.c:13:
/usr/include/features.h:187:3: Warnung: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  187 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
ttyreader.c: In Funktion »aprx_cfmakeraw«:
ttyreader.c:706:1: Warnung: Typ von »f« ist auf »int« voreingestellt [-Wimplicit-int]
  706 | aprx_cfmakeraw(t, f)
      | ^~~~~~~~~~~~~~
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c ax25.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c aprsis.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c beacon.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c config.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c netax25.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c erlang.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c aprxpolls.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c telemetry.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c igate.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c cellmalloc.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c historydb.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c keyhash.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c parse_aprs.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c dupecheck.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c kiss.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c interface.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c pbuf.c
In Datei, eingebunden von /usr/include/bits/libc-header-start.h:33,
                 von /usr/include/stdio.h:27,
                 von aprx.h:13,
                 von pbuf.c:13:
/usr/include/features.h:187:3: Warnung: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
  187 | # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
      |   ^~~~~~~
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c digipeater.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c valgrind.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c filter.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c dprsgw.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c crc.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c agwpesocket.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c netresolver.c
gcc -g -O2 -pthread   -DAPRXVERSION="\"2.9.0-28-g13c6e79\"" -DVARRUN="\"/var/run\"" -DVARLOG="\"/var/log/aprx\"" -DCFGFILE="\"/etc/aprx.conf\"" -c timercmp.c
gcc  -o aprx aprx.o ttyreader.o ax25.o aprsis.o beacon.o config.o netax25.o erlang.o aprxpolls.o telemetry.o igate.o cellmalloc.o historydb.o keyhash.o parse_aprs.o dupecheck.o  kiss.o interface.o pbuf.o digipeater.o valgrind.o filter.o dprsgw.o  crc.o  agwpesocket.o netresolver.o timercmp.o  -lutil    -lm -pthread  
/usr/bin/ld: ttyreader.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: ttyreader.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: ax25.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: ax25.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: aprsis.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: aprsis.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: beacon.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: beacon.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: config.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: config.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: netax25.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: netax25.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: erlang.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: erlang.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: aprxpolls.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: aprxpolls.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: telemetry.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: telemetry.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: igate.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: igate.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: historydb.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: historydb.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: parse_aprs.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: parse_aprs.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: dupecheck.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: dupecheck.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: kiss.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: kiss.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: interface.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: interface.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: pbuf.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: pbuf.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: digipeater.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: digipeater.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: filter.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: filter.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: dprsgw.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: dprsgw.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: crc.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: crc.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: agwpesocket.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: agwpesocket.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: netresolver.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: netresolver.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
/usr/bin/ld: timercmp.o:/home/dl1ue/aprx/aprx.h:45: multiple definition of `pthr_attrs'; aprx.o:/home/dl1ue/aprx/aprx.h:45: first defined here
/usr/bin/ld: timercmp.o:/home/dl1ue/aprx/aprx.h:44: multiple definition of `aprsis_thread'; aprx.o:/home/dl1ue/aprx/aprx.h:44: first defined here
collect2: Fehler: ld gab 1 als Ende-Status zurück
make: *** [Makefile:102: aprx] Fehler 1

GCC:

gcc --version
gcc (GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.

Is there a possible solution? Thanks!

thasti commented 3 years ago

GCC 10 uses -fno_common as a default, which causes problems with improperly declared externs. Try make CFLAGS=-fcommon when building.

Reference: https://gcc.gnu.org/gcc-10/porting_to.html

IZ7BOJ commented 2 years ago

Hi @thasti , I tried to compile on my raspberry Pi3 "bullseye" distro with -fno_common, but I got this result: /usr/bin/ld: cellmalloc.o: in function cellmalloc': cellmalloc.c:(.text+0x45c): undefined reference tocellhead_to_clientptr' /usr/bin/ld: cellmalloc.o: in function cellmallocmany': cellmalloc.c:(.text+0x53c): undefined reference tocellhead_to_clientptr' /usr/bin/ld: cellmalloc.o: in function cellfree': cellmalloc.c:(.text+0x5a0): undefined reference toclientptr_to_cellhead' /usr/bin/ld: cellmalloc.o: in function cellfreemany': cellmalloc.c:(.text+0x694): undefined reference toclientptr_to_cellhead' collect2: error: ld returned 1 exit status make: *** [Makefile:102: aprx] Errore 1

Any other suggestion? Thanks in advance Alfredo

IZ7BOJ commented 2 years ago

Hi, I fixed it with 'make CFLAGS="-fcommon -O2" ' I hope this helps Alfredo IZ7BOJ

PhirePhly commented 2 years ago

Yeah, something about the tool chain has changed in the last few years so the build config is badly broken.

I'm planning on jettisoning autoconf and going to a much simpler static Makefile based build system, because I'm not supporting all the optional code blocks for reducing binary size like Igate support anymore and not willing to entertain supporting any platforms which fail autoconf tests for a functional libc.

thasti commented 2 years ago

I'm not entirely convinced yet autoconf is the issue here (at least in the scope of the build issues reported above): From what I could make sense of back in the day, the new default in GCC 10 only exposed the presence of a number of improperly declared global symbols (see the link I posted above).

To me, these pointed more to deficiencies in the code than in the build system. Back then, I was simply too lazy to fix up all these issues in the code and instead went for -fcommon to retain the accepting behavior present in GCC 9 and earlier. I did not personally encounter any autoconf-related problems, and for portability across the more common OSes and architectures, keeping it might actually be a good idea?

PhirePhly commented 2 years ago

The legacy autoconf system is too complicated for me to be willing to try and figure out what the actual underlying issue is on this build failure; I've been tolerating it as well. And I don't see any portability advantages using autoconf since it isn't the 1980s anymore. I would rather just write unconditionally portable code.

daniel-ayers commented 1 year ago

Confirming that the build fails as above on Fedora 35 and the problem is resolved by using make CFLAGS="-fcommon -O2".

jmhayes-table commented 1 year ago

I fixed this by adding the keyword "extern" to the global variables aprsis_thread and pthr_attrs in aprx.h ... there's another example of this in netresolver.c once you get further in the build; it seems like a misunderstanding about the difference between defining and declaring variables. I'm not sure I understand why it's a global variable anyway, it doesn't get used in any other C file than aprsis.c so you can probably just remove it from the header file. This is on Ubuntu using gcc 11.4.0 under Ubuntu 22.0.4 ... it appears the compiler has gotten more strict about this kind of thing.