GNU bug report logs - #53424
tftp-hpa: Fails to build (multiple definition of 'toplevel' when linking)

Previous Next

Package: guix;

Reported by: Ivan Vilata i Balaguer <ivan <at> selidor.net>

Date: Fri, 21 Jan 2022 21:07:01 UTC

Severity: normal

Done: Tobias Geerinckx-Rice <me <at> tobias.gr>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53424 in the body.
You can then email your comments to 53424 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#53424; Package guix. (Fri, 21 Jan 2022 21:07:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ivan Vilata i Balaguer <ivan <at> selidor.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 21 Jan 2022 21:07:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ivan Vilata i Balaguer <ivan <at> selidor.net>
To: bug-guix <at> gnu.org
Subject: tftp-hpa: Fails to build (multiple definition of 'toplevel' when
 linking)
Date: Fri, 21 Jan 2022 22:06:08 +0100
[Message part 1 (text/plain, inline)]
Hi!  When trying to upgrade package `tftp-hpa 5.2` from Guix commit `404f6953`
to that of commit `4a943cfd`, the build fails showing these warnings and
error:

```
starting phase `build'
[…]
gcc -g -O2 -W -Wall -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wwrite-strings -Wundef -Wshadow -Wsign-compare -pipe -fno-strict-aliasing -I/tmp/guix-build-tftp-hpa-5.2.drv-0/tftp-hpa-5.2 -c main.c
tftp.c: In function ‘tftp_sendfile’:
tftp.c:88:5: warning: implicit declaration of function ‘bsd_signal’; did you mean ‘ssignal’? [-Wimplicit-function-declaration]
   88 |     bsd_signal(SIGALRM, timer);
      |     ^~~~~~~~~~
      |     ssignal
tftp.c:88:5: warning: nested extern declaration of ‘bsd_signal’ [-Wnested-externs]
main.c: In function ‘main’:
main.c:308:5: warning: implicit declaration of function ‘bsd_signal’; did you mean ‘ssignal’? [-Wimplicit-function-declaration]
  308 |     bsd_signal(SIGINT, intr);
      |     ^~~~~~~~~~
      |     ssignal
main.c:308:5: warning: nested extern declaration of ‘bsd_signal’ [-Wnested-externs]
gcc -g -O2 -W -Wall -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wwrite-strings -Wundef -Wshadow -Wsign-compare -pipe -fno-strict-aliasing -I/tmp/guix-build-tftp-hpa-5.2.drv-0/tftp-hpa-5.2 -c misc.c
sed -e 's/@@VERSION@@/5.2/g' < tftp.1.in > tftp.1
gcc -g -O2 -W -Wall -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -Wwrite-strings -Wundef -Wshadow -Wsign-compare -pipe -fno-strict-aliasing -I/tmp/guix-build-tftp-hpa-5.2.drv-0/tftp-hpa-5.2 -c remap.c
sed -e 's/@@VERSION@@/5.2/g' < tftpd.8.in > tftpd.8
tftpd.c: In function ‘tftp_recvfile’:
tftpd.c:1647:69: warning: argument ‘oap’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
 1647 | static void tftp_recvfile(const struct formats *pf, struct tftphdr *oap, int oacklen)
      |                                                     ~~~~~~~~~~~~~~~~^~~
main.c:191:20: warning: inlining failed in call to ‘usage’: call is unlikely and code size would grow [-Winline]
  191 | static inline void usage(int errcode)
      |                    ^~~~~
main.c:244:25: note: called from here
  244 |                         usage(EX_USAGE);
      |                         ^~~~~~~~~~~~~~~
main.c:191:20: warning: inlining failed in call to ‘usage’: call is unlikely and code size would grow [-Winline]
  191 | static inline void usage(int errcode)
      |                    ^~~~~
main.c:266:25: note: called from here
  266 |                         usage(EX_USAGE);
      |                         ^~~~~~~~~~~~~~~
main.c:191:20: warning: inlining failed in call to ‘usage’: call is unlikely and code size would grow [-Winline]
  191 | static inline void usage(int errcode)
      |                    ^~~~~
main.c:279:21: note: called from here
  279 |                     usage(*optx == 'h' ? 0 : EX_USAGE);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:191:20: warning: inlining failed in call to ‘usage’: call is unlikely and code size would grow [-Winline]
  191 | static inline void usage(int errcode)
      |                    ^~~~~
main.c:284:17: note: called from here
  284 |                 usage(EX_USAGE);
      |                 ^~~~~~~~~~~~~~~
gcc  tftp.o main.o ../common/libcommon.a  /tmp/guix-build-tftp-hpa-5.2.drv-0/tftp-hpa-5.2/lib/libxtra.a  -o tftp
ld: main.o:/tmp/guix-build-tftp-hpa-5.2.drv-0/tftp-hpa-5.2/tftp/main.c:98: multiple definition of `toplevel'; tftp.o:/tmp/guix-build-tftp-hpa-5.2.drv-0/tftp-hpa-5.2/tftp/tftp.c:51: first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:12: tftp] Error 1
make[1]: Leaving directory '/tmp/guix-build-tftp-hpa-5.2.drv-0/tftp-hpa-5.2/tftp'
make: *** [Makefile:7: tftp.build] Error 2
make: *** Waiting for unfinished jobs....
gcc  tftpd.o recvfrom.o misc.o remap.o ../common/libcommon.a  /tmp/guix-build-tftp-hpa-5.2.drv-0/tftp-hpa-5.2/lib/libxtra.a  -o tftpd
make[1]: Leaving directory '/tmp/guix-build-tftp-hpa-5.2.drv-0/tftp-hpa-5.2/tftpd'
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("-j" "4") exit-status: 2 term-signal: #f stop-signal: #f> 
phase `build' failed after 0.8 seconds
command "make" "-j" "4" failed with status 2
```

Maybe something changed with the compiler which causes `toplevel` to be
defined twice, not sure whether the warnings are relevant.  Attaching whole
`/var/log/guix/drvs/n7/mi9pqbpgad3gnz97s02zd056qnzcfg-tftp-hpa-5.2.drv.bz2`.

Thanks a lot!

-- 
Ivan Vilata i Balaguer -- https://elvil.net/
[mi9pqbpgad3gnz97s02zd056qnzcfg-tftp-hpa-5.2.drv.bz2 (application/octet-stream, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#53424; Package guix. (Fri, 21 Jan 2022 21:21:02 GMT) Full text and rfc822 format available.

Message #8 received at 53424 <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Ivan Vilata i Balaguer <ivan <at> selidor.net>
Cc: bug-guix <at> gnu.org, 53424 <at> debbugs.gnu.org
Subject: Re: bug#53424: tftp-hpa: Fails to build (multiple definition of
 'toplevel' when linking)
Date: Fri, 21 Jan 2022 22:20:15 +0100
[Message part 1 (text/plain, inline)]
Hullo Ivan,

At a glance, this *looks* like what is frequently fixed by adding 
‘-fcommon’ to CFLAGS[0].  Worth a try…

Kind regards,

T G-R

[0]: 
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=ab5d31c53eb06ced0873599a98c74dba80b46b1e
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#53424; Package guix. (Fri, 21 Jan 2022 21:22:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#53424; Package guix. (Fri, 21 Jan 2022 22:16:01 GMT) Full text and rfc822 format available.

Message #14 received at 53424 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Ivan Vilata i Balaguer <ivan <at> selidor.net>, 53424 <at> debbugs.gnu.org
Subject: Re: bug#53424: tftp-hpa: Fails to build (multiple definition of
 'toplevel' when linking)
Date: Fri, 21 Jan 2022 23:14:55 +0100
[Message part 1 (text/plain, inline)]
Ivan Vilata i Balaguer schreef op vr 21-01-2022 om 22:06 [+0100]:
> tftp.c:88:5: warning: implicit declaration of function ‘bsd_signal’;
> did you mean ‘ssignal’? [-Wimplicit-function-declaration]
>    88 |     bsd_signal(SIGALRM, timer);
>       |     ^~~~~~~~~~

This one looks like tftp.c forgot to include <signal.h> directly
and relied on another header to include <signal.h>.

It's a warning, not an error, but declarations of functions can
sometimes be important for ABI purposes.

Greetings,
Maxime
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#53424; Package guix. (Sat, 22 Jan 2022 21:09:02 GMT) Full text and rfc822 format available.

Message #17 received at 53424 <at> debbugs.gnu.org (full text, mbox):

From: Ivan Vilata i Balaguer <ivan <at> selidor.net>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: 53424 <at> debbugs.gnu.org
Subject: Re: bug#53424: tftp-hpa: Fails to build (multiple definition of
 'toplevel' when linking)
Date: Sat, 22 Jan 2022 22:08:22 +0100
[Message part 1 (text/plain, inline)]
Tobias Geerinckx-Rice (2022-01-21 22:20:15 +0100) wrote:

> Hullo Ivan,
> 
> At a glance, this *looks* like what is frequently fixed by adding ‘-fcommon’
> to CFLAGS[0].  Worth a try…
> 
> Kind regards,
> 
> T G-R
> 
> [0]: https://git.savannah.gnu.org/cgit/guix.git/commit/?id=ab5d31c53eb06ced0873599a98c74dba80b46b1e

(Please note that I know very little about the GNU Build System.)

I downloaded the sources with `guix build --source tftp-hpa`, extracted them,
ran `guix environment -C --pure tftp-hpa` and in the environment `./configure
CFLAGS=-fcommon`, then `make` was able to build everything without error,
though warnings were still there.

Cheers,

-- 
Ivan Vilata i Balaguer -- https://elvil.net/
[signature.asc (application/pgp-signature, inline)]

Reply sent to Tobias Geerinckx-Rice <me <at> tobias.gr>:
You have taken responsibility. (Sat, 22 Jan 2022 21:41:01 GMT) Full text and rfc822 format available.

Notification sent to Ivan Vilata i Balaguer <ivan <at> selidor.net>:
bug acknowledged by developer. (Sat, 22 Jan 2022 21:41:02 GMT) Full text and rfc822 format available.

Message #22 received at 53424-done <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Ivan Vilata i Balaguer <ivan <at> selidor.net>
Cc: 53424-done <at> debbugs.gnu.org
Subject: Re: bug#53424: tftp-hpa: Fails to build (multiple definition of
 'toplevel' when linking)
Date: Sat, 22 Jan 2022 22:39:13 +0100
[Message part 1 (text/plain, inline)]
Hullo again,

I had a minute to spare and pushed the fix to master.  Thanks for 
the report!

Ivan Vilata i Balaguer 写道:
> (Please note that I know very little about the GNU Build 
> System.)

See commit dfc32d8d997da74a6e838b450649bd89905ffdc3 ;-)

Closing,

T G-R
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 20 Feb 2022 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 58 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.