diff --git a/file_ops.c b/file_ops.c
index 7f3b3183d0..12583cd695 100644
--- a/file_ops.c
+++ b/file_ops.c
@@ -37,6 +37,7 @@
 
 #include "file_ops.h"
 
+#ifdef HAVE_COMPRESSION
 #ifdef HAVE_7ZIP
 #include "deps/7zip/7z.h"
 #include "deps/7zip/7zAlloc.h"
@@ -616,6 +617,8 @@ error:
 }
 #endif
 
+#endif
+
 /**
  * write_file:
  * @path             : path to file.