diff --git a/codelitegcc/main.cpp b/codelitegcc/main.cpp
index 1b78e0825..a4ffdc3e7 100644
--- a/codelitegcc/main.cpp
+++ b/codelitegcc/main.cpp
@@ -33,6 +33,7 @@ extern int ExecuteProcessWIN(const std::string& commandline);
 #include <sys/file.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
+#include <fcntl.h>
 
 void WriteContent( const std::string& logfile, const std::string& filename, const std::string& flags )
 {
diff --git a/sdk/codelite_indexer/libctags/read.c b/sdk/codelite_indexer/libctags/read.c
index 144032de5..bfabf75d3 100644
--- a/sdk/codelite_indexer/libctags/read.c
+++ b/sdk/codelite_indexer/libctags/read.c
@@ -605,6 +605,9 @@ extern int readChars (char *buffer, size_t bufferSize, fpos_t location, fpos_t e
 #if defined(__WXMSW__) || defined(__APPLE__) || defined(__FreeBSD__)
 	if(location < 0)
 		return 0;
+#elif defined(__linux__) && !defined(__GLIBC__) /* musl */
+	if(location.__lldata < 0)
+		return 0;
 #elif defined(__NetBSD__)
 	if(location._pos < 0)
 		return 0;
@@ -622,6 +625,8 @@ extern int readChars (char *buffer, size_t bufferSize, fpos_t location, fpos_t e
 
 #if defined(__WXMSW__) || defined(__APPLE__) || defined(__FreeBSD__)
 	sizeToRead = endPos - location;
+#elif defined(__linux__) && !defined(__GLIBC__) /* musl */
+	sizeToRead = endPos.__lldata - location.__lldata;
 #elif defined(__NetBSD__)
 	sizeToRead = endPos._pos - location._pos;
 #else
diff --git a/sdk/codelite_indexer/network/named_pipe.cpp b/sdk/codelite_indexer/network/named_pipe.cpp
index 6e729946d..3e587a428 100644
--- a/sdk/codelite_indexer/network/named_pipe.cpp
+++ b/sdk/codelite_indexer/network/named_pipe.cpp
@@ -27,9 +27,9 @@
 
 #ifndef __WXMSW__
 #  include <sys/types.h>
-#  include <sys/unistd.h>
 #  include <sys/socket.h>
 #  include <sys/time.h>
+#  include <unistd.h>
 #endif
 
 #ifdef __WXMSW__
diff --git a/sdk/codelite_indexer/network/named_pipe_server.cpp b/sdk/codelite_indexer/network/named_pipe_server.cpp
index 708df483d..68d7e3958 100644
--- a/sdk/codelite_indexer/network/named_pipe_server.cpp
+++ b/sdk/codelite_indexer/network/named_pipe_server.cpp
@@ -26,8 +26,8 @@
 #include "named_pipe_server.h"
 #ifndef __WXMSW__
 # include <sys/types.h>
-# include <sys/unistd.h>
 # include <sys/socket.h>
+# include <unistd.h>
 #endif
 clNamedPipeServer::clNamedPipeServer(const char* pipePath)
 		: clNamedPipe(pipePath)
