--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -159,7 +159,7 @@ static void _touch_memory(void *mem, siz
 
 static void _allocate_memory(void)
 {
-#ifndef VALGRIND_POOL
+#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
 	void *stack_mem;
 	struct rlimit limit;
 	int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -18,6 +18,7 @@
 #include "daemon-server.h"
 #include "daemon-log.h"
 
+#include <fcntl.h>
 #include <dlfcn.h>
 #include <errno.h>
 #include <pthread.h>
