diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index fe663ec..4174a79 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -32,6 +32,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
+#include <libgen.h>
 
 #include <glib.h>
 
diff --git a/src/log.c b/src/log.c
index b33a7d2..e9784eb 100644
--- a/src/log.c
+++ b/src/log.c
@@ -34,6 +34,7 @@
 #include <execinfo.h>
 #endif
 #include <dlfcn.h>
+#include <libgen.h>
 
 #include "ofono.h"
 
