iagox86 / dnscat2

BSD 3-Clause "New" or "Revised" License
3.43k stars 601 forks source link

Client compile error on Ubuntu1204 #61

Closed xia0pin9 closed 9 years ago

xia0pin9 commented 9 years ago

I got the following error message when trying to compile the client:

drivers/driver_exec.c: In function ‘driver_exec_close’:
drivers/driver_exec.c:207:3: error: implicit declaration of function ‘kill’ [-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors
make: *** [drivers/driver_exec.o] Error 1
iagox86 commented 9 years ago

Hey, that should be easy to fix! I'm out of town with no laptop right now, but I'll take of it early next week.

Thanks for the report! On 6 Aug 2015 7:41 pm, "Yuping Li" notifications@github.com wrote:

I got the following error message when trying to compile the client:

drivers/driver_exec.c: In function ‘driver_exec_close’: drivers/driver_exec.c:207:3: error: implicit declaration of function ‘kill’ [-Werror=implicit-function-declaration] cc1: all warnings being treated as errors make: *\ [drivers/driver_exec.o] Error 1

— Reply to this email directly or view it on GitHub https://github.com/iagox86/dnscat2/issues/61.

Retrospected commented 9 years ago

i'm getting the same compile error, any news on this one ? :)

iagox86 commented 9 years ago

Sorry, I just got back! :)

So, this is weird. It compiles on my Ubuntu machine, and I'm including the right headers. The only thing that might be causing it is a macro definition.. can one of you try this patch to see if it works?

diff --git a/client/Makefile b/client/Makefile
index 6a80616..9ba9d38 100644
--- a/client/Makefile
+++ b/client/Makefile
@@ -9,7 +9,7 @@
 CC?=gcc
 DEBUG_CFLAGS?=-g -DTESTMEMORY -Werror -O0
 RELEASE_CFLAGS?=-Os
-CFLAGS?=--std=c89 -I. -Wall -D_DEFAULT_SOURCE -fstack-protector-all -Wformat -Wformat-security
+CFLAGS?=--std=c89 -I. -Wall -D_DEFAULT_SOURCE -fstack-protector-all -Wformat -Wformat-security -D_POSIX_SOURCE
 LIBS=-pie -Wl,-z,relro,-z,now

 # Can't use a '#' in the shell command
alexwebr commented 9 years ago

The above patch fixes the build on my 12.04 machine!

iagox86 commented 9 years ago

Thanks Alex!

iagox86 commented 9 years ago

Hmm, it turns out this breaks compilation on Cygwin (hooray for git bisect!) - stupid *nix. :)