When in my code i use gethostbyname for resolve hostname in a socket program and in the compilation i use -static, like this example
gcc -o example -static -ggdb -mpreferred-stack-boundary=2 -fno-stack-protector -z execstack example.c
The compilation return me this warning
Warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
and when I execute it, the program return me "gethostbyname failed". How can i resolve this problem?