Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2019-02-14 00:00:00Z and 2019-02-15 00:00:00Z
Avatar
I really cant understand your question
00:14
Can you maybe record a gif/video
00:14
i mean i probably cant help but i want to understand it
Avatar
867facf Forgot str_tokenize is not used now - Learath2 37c67c0 Style - Learath2 a46c31f Add a couple tests, fix #1457 - Learath2 e87681c Merge #1458 - bors[bot]
09:27
3f9d30a Sync weapon input with other inputs - trml b9f3010 Remove nesting - trml 6f3d261 Merge pull request #1441 from trml/pr_sync_weapon_input - def-
Avatar
I wanna use a statically linked server binary to reduce the image size of my containers. So I tried to link the DDNet-Server executable with the options -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS="-static". It compiled with the following warning: CMakeFiles/engine-shared.dir/src/base/system.c.o: In function `net_host_lookup': system.c:(.text+0x3a92): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking The server crashes when trying to resolve DNS names of the masters. This seems to be an issue with glibc, so I tried compiling against Musl, with the following result: In file included from /src/src/base/hash.c:4:0: /src/src/base/system.h:767:17: error: array type has incomplete element type 'struct mmsghdr' struct mmsghdr msgs[VLEN]; ^~~~ make[3]: *** [CMakeFiles/engine-shared.dir/build.make:558: CMakeFiles/engine-shared.dir/src/base/hash.c.o] Error 1 make[2]: *** [CMakeFiles/Makefile2:929: CMakeFiles/engine-shared.dir/all] Error 2 make[1]: *** [CMakeFiles/Makefile2:1254: CMakeFiles/DDNet-Server.dir/rule] Error 2 make: *** [Makefile:589: DDNet-Server] Error 2 Any ideas on how to procede, or which error is the easier one to fix?
Avatar
Wouldn't your container still contain the shared libs?
12:18
Why would it reduce size to link statically?
12:18
I'd rather guess that you should link dynamically to save size
12:19
not sure about the DNS resolving problem, run it with a Debug build in gdb and check out the backtrace
12:20
Sounds like musl doesn't implement mmsghdr, we have them surrounded with CONF_PLATFORM_LINUX ifdefs, you could make a PR to make that #if SUPPORT_MMSG and #define SUPPORT_MMSG when CONF_PLATFORM_LINUX is defined and some MUSL define isn't
12:20
@Wollwolke ^
Avatar
I don't really see linking statically helping with binary size, even if you link with musl it'd still be a bigger binary
Avatar
It doesn't help with binary size, but with the container size. You could then use a base image like gcr.io/distroless/static which only is a few MB in size
Avatar
well you'll need to disable the mmsg stuff like deen said to get it compiling with musl
Avatar
what are the drawbacks of disabling mmsg?
Avatar
lower performance when you receive a DoS attack
14:26
it allows the kernel to pass us multiple packets per recvmmsg syscall instead of just one in the recvfrom
14:26
but musl generally is probably not as optimized as glibc
Avatar
Ok, thank you for the explanation, I settled with Alpine Linux with glibc and dynamic linking. That results in an image size of ~14 MB.
Avatar
That sounds good enough 😃
Exported 24 message(s)