Packetwatch.net

Compiling Netcat 1.10 for Linux


res_init error

There is a compiling error that some people run into when compiling Netcat for Linux. Here is what happens:

[ryan@localhost nc110]$ make linux
make -e nc  XFLAGS='-DLINUX' STATIC=-static
make[1]: Entering directory `/home/ryan/nc110'
cc -O -s         -DGAPING_SECURITY_HOLE -DTELNET -DLINUX -static -o nc netcat.c
/tmp/cc1xYlPL.o(.text+0x15f7): In function `main':
: undefined reference to `res_init'
collect2: ld returned 1 exit status
make[1]: *** [nc] Error 1
make[1]: Leaving directory `/home/ryan/nc110'
make: *** [linux] Error 2
[ryan@localhost nc110]$

This compilation error can be fixed by editing the netcat.c file. Locate the following section of code, and comment out the res_init line.

#ifdef HAVE_BIND
/* can *you* say "cc -yaddayadda netcat.c -lresolv -l44bsd" on SunLOSs? */
  res_init();
#endif

Now you will be able to make Netcat.

[ryan@localhost nc110]$ make linux
make -e nc  XFLAGS='-DLINUX' STATIC=-static
make[1]: Entering directory `/home/ryan/nc110'
cc -O -s         -DGAPING_SECURITY_HOLE -DTELNET -DLINUX -static -o nc netcat.c
make[1]: Leaving directory `/home/ryan/nc110'
[ryan@localhost nc110]$

Last modified: Thu Jan 1 00:00:00 1970 UTC
Packetwatch Research 2002-2024.