Closed jimmy-ly00 closed 7 years ago
thanks for your report. i hope the commit i just made fixes it.
Unfortunately, I am still getting the same errors
that is weird, i developed the patch on a glibc system (albeit an ancient one) and it worked there. are you certain you pulled the patch ?
Yes positive, here is the error, they just shifted down some lines. What OS are you using?
root@kali:~/microsocks# make
cc -Wall -std=c99 -c -o server.o server.c
In file included from server.c:1:0:
server.h:26:59: warning: ‘struct addrinfo’ declared inside parameter list will not be visible outside of this definition or declaration
int resolve(const char *host, unsigned short port, struct addrinfo** addr);
^~~~~~~~
server.c:5:59: warning: ‘struct addrinfo’ declared inside parameter list will not be visible outside of this definition or declaration
int resolve(const char *host, unsigned short port, struct addrinfo** addr) {
^~~~~~~~
server.c:5:5: error: conflicting types for ‘resolve’
int resolve(const char *host, unsigned short port, struct addrinfo** addr) {
^~~~~~~
In file included from server.c:1:0:
server.h:26:5: note: previous declaration of ‘resolve’ was here
int resolve(const char *host, unsigned short port, struct addrinfo** addr);
^~~~~~~
server.c: In function ‘resolve’:
server.c:6:9: error: variable ‘hints’ has initializer but incomplete type
struct addrinfo hints = {
^~~~~~~~
server.c:7:3: error: unknown field ‘ai_family’ specified in initializer
.ai_family = AF_UNSPEC,
^
server.c:8:3: error: unknown field ‘ai_socktype’ specified in initializer
.ai_socktype = SOCK_STREAM,
^
server.c:9:3: error: unknown field ‘ai_flags’ specified in initializer
.ai_flags = AI_PASSIVE,
^
server.c:9:15: error: ‘AI_PASSIVE’ undeclared (first use in this function)
.ai_flags = AI_PASSIVE,
^~~~~~~~~~
server.c:9:15: note: each undeclared identifier is reported only once for each function it appears in
server.c:9:15: warning: excess elements in struct initializer
server.c:9:15: note: (near initialization for ‘hints’)
server.c:6:18: error: storage size of ‘hints’ isn’t known
struct addrinfo hints = {
^~~~~
server.c:13:9: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
return getaddrinfo(host, port_buf, &hints, addr);
^~~~~~~~~~~
server.c:6:18: warning: unused variable ‘hints’ [-Wunused-variable]
struct addrinfo hints = {
^~~~~
server.c: In function ‘server_setup’:
server.c:23:29: warning: passing argument 3 of ‘resolve’ from incompatible pointer type [-Wincompatible-pointer-types]
if(resolve(listenip, port, &ainfo)) return -1;
^
server.c:5:5: note: expected ‘struct addrinfo **’ but argument is of type ‘struct addrinfo **’
int resolve(const char *host, unsigned short port, struct addrinfo** addr) {
^~~~~~~
server.c:26:25: error: dereferencing pointer to incomplete type ‘struct addrinfo’
for(p = ainfo; p; p = p->ai_next) {
^~
server.c:39:2: warning: implicit declaration of function ‘freeaddrinfo’ [-Wimplicit-function-declaration]
freeaddrinfo(ainfo);
^~~~~~~~~~~~
server.c: In function ‘resolve’:
server.c:14:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
Makefile:28: recipe for target 'server.o' failed
make: *** [server.o] Error 1
i'm using sabotage linux based on musl libc.
to help getting this resolved, can you try the following?
echo "CPPFLAGS += -D_XOPEN_SOURCE=700" > config.mak
make
and if that doesn't work either:
echo "CPPFLAGS += -D_GNU_SOURCE" > config.mak
make
added another commit which should fix it for real (studied glibc git features.h) ^
and yet another one!
Hahaha, that seemed to have fixed it! thanks for fixing it so quickly
root@kali:~/microsocks# echo "CPPFLAGS += -D_XOPEN_SOURCE=700" > config.mak
root@kali:~/microsocks# make
cc -D_XOPEN_SOURCE=700 -Wall -std=c99 -c -o server.o server.c
cc -D_XOPEN_SOURCE=700 -Wall -std=c99 -c -o sblist.o sblist.c
sblist.c:8:2: warning: #warning "your C library sucks." [-Wcpp]
#warning "your C library sucks."
^~~~~~~
cc -D_XOPEN_SOURCE=700 -Wall -std=c99 -c -o sblist_delete.o sblist_delete.c
cc sockssrv.o server.o sblist.o sblist_delete.o -lpthread -o microsocks
Seem to be having trouble making the file, error warnings are in server.c. Error below is for Kali Linux 4.6.0-kali1-amd64, same with Ubuntu 4.4.0-78-generic.