build fixes for Alpine Linux with musl libc

fixes that should improve the general portability