diff --git a/Common/GmshMessage.cpp b/Common/GmshMessage.cpp
index 6fd7a9493f7a549789de7ae90a9076012dbcd6e9..437d9a5ec43afd1bacd7811323c2cf161faa4021 100644
--- a/Common/GmshMessage.cpp
+++ b/Common/GmshMessage.cpp
@@ -797,7 +797,7 @@ public:
 
 void Msg::InitializeOnelab(const std::string &name, const std::string &sockname)
 {
-if defined(HAVE_ONELAB)
+#if defined(HAVE_ONELAB)
   if(_onelabClient) delete _onelabClient;
   if(sockname.empty()){
     _onelabClient = new localGmsh();
diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp
index bd4754f2781eaa72931abffdac9cfaefcc4d691b..c8cba8e3f2b284f71bcbb89d264b0cc00f194056 100644
--- a/Fltk/Main.cpp
+++ b/Fltk/Main.cpp
@@ -11,6 +11,9 @@
 #include "Options.h"
 #include "PluginManager.h"
 #include "GModel.h"
+#if defined(__linux__) && !defined(BUILD_ANDROID)
+#include <X11/Xlib.h>
+#endif
 
 int main(int argc, char *argv[])
 {
@@ -38,5 +41,8 @@ int main(int argc, char *argv[])
   }
 
   // Interactive Gmsh with FLTK GUI
+#if defined(__linux__) && !defined(BUILD_ANDROID)
+  XInitThreads();
+#endif
   return GmshFLTK(argc, argv);
 }