0

I wanna compiling tftp-hpa from source code but i get following error:

gcc  tftp.o main.o ../common/libcommon.a -lreadline -ltermcap  /home/ali/programming/c/opensource/tftp-hpa/lib/libxtra.a  -o tftp
/usr/bin/ld: main.o:/home/ali/programming/c/opensource/tftp-hpa/tftp/main.c:98: multiple definition of `toplevel'; tftp.o:/home/ali/programming/c/opensource/tftp-hpa/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 '/home/ali/programming/c/opensource/tftp-hpa/tftp'
make: *** [Makefile:7: tftp.build] Error 2

And many warnings.

I tried to compile several source code from several resources like :

Linux.org

here

Debian

here

But every source code throw this compile error. Why ?

All of my commands for compiling tftp :

autoreconf -i

./configure

make

And error ...

alirezaarzehgar
  • 171
  • 1
  • 8

1 Answers1

0

I fixed its source code on this repository based on this source code.

In this case we should remove toplevel variable from all .c files on tftp folder.

Write following line on common/tftpsubs.h:

#ifndef _TOP_LEVEL_
#define _TOP_LEVEL_
static sigjmp_buf toplevel;
#endif
alirezaarzehgar
  • 171
  • 1
  • 8