1diff --git a/CMakeLists.txt b/CMakeLists.txt
2index a976a46d..408ac308 100644
3--- a/CMakeLists.txt
4+++ b/CMakeLists.txt
5@@ -125,14 +125,13 @@ else()
6 set(CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} -std=c++14 -stdlib=libc++")
7 else()
8 set(LINUX TRUE)
9- set(CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} -std=c++14 -stdlib=libstdc++")
10+ set(CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} -std=c++14")
11 endif()
12 set(POSIX TRUE)
13 endif()
14
15 if(POSIX)
16 add_compile_options(
17- -Qunused-arguments
18 -Wstrict-aliasing
19 -Wno-missing-field-initializers
20 -Wno-unused-local-typedef
21@@ -154,7 +153,6 @@ if(POSIX)
22 )
23 if(NOT FREEBSD)
24 add_compile_options(
25- -Werror=shadow
26 -fvisibility=hidden
27 -fvisibility-inlines-hidden
28 )
29@@ -372,12 +370,6 @@ elseif(NOT FREEBSD)
30 endif()
31 endif()
32
33-if(NOT IS_DIRECTORY "${CMAKE_SOURCE_DIR}/third-party/sqlite3")
34- WARNING_LOG("Cannot find git submodule third-party/sqlite3 directory")
35- WARNING_LOG("Please run: make deps or git submodule update --init")
36- message(FATAL_ERROR "No sqlite3 directory")
37-endif()
38-
39 # Make sure deps were built before compiling (else show warning).
40 execute_process(
41 COMMAND "${CMAKE_SOURCE_DIR}/tools/provision.sh" check "${CMAKE_BINARY_DIR}"
42@@ -439,6 +431,8 @@ endif()
43
44 if(APPLE)
45 LOG_PLATFORM("OS X")
46+elseif(OSQUERY_BUILD_PLATFORM STREQUAL "nixos")
47+ LOG_PLATFORM("NixOS")
48 elseif(OSQUERY_BUILD_PLATFORM STREQUAL "debian")
49 LOG_PLATFORM("Debian")
50 elseif(OSQUERY_BUILD_PLATFORM STREQUAL "ubuntu")
51@@ -477,7 +471,6 @@ if(POSIX)
52 include_directories("${BUILD_DEPS}/include/openssl")
53 endif()
54
55-include_directories("${CMAKE_SOURCE_DIR}/third-party/sqlite3")
56 include_directories("${CMAKE_SOURCE_DIR}/include")
57 include_directories("${CMAKE_SOURCE_DIR}")
58
59@@ -559,21 +552,10 @@ else()
60 set(GTEST_FLAGS "-DGTEST_USE_OWN_TR1_TUPLE=0")
61 endif()
62
63-set(GTEST_FLAGS
64- ${GTEST_FLAGS}
65- "-I${CMAKE_SOURCE_DIR}/third-party/googletest/googletest/include"
66- "-I${CMAKE_SOURCE_DIR}/third-party/googletest/googlemock/include"
67-)
68-join("${GTEST_FLAGS}" " " GTEST_FLAGS)
69-
70 set(BUILD_GTEST TRUE)
71
72-add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/googletest")
73-
74 include(Thrift)
75
76-add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/sqlite3")
77-
78 add_subdirectory(osquery)
79 add_subdirectory(tools/tests)
80
81diff --git a/include/osquery/core.h b/include/osquery/core.h
82index b597edee..b0628037 100644
83--- a/include/osquery/core.h
84+++ b/include/osquery/core.h
85@@ -15,8 +15,9 @@
86 #include <string>
87 #include <vector>
88
89-#if defined(__APPLE__) || defined(__FreeBSD__)
90+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__linux__)
91 #include <boost/thread/shared_mutex.hpp>
92+#include <boost/thread/recursive_mutex.hpp>
93 #else
94 #include <shared_mutex>
95 #endif
96@@ -188,7 +189,7 @@ inline bool isPlatform(PlatformType a, const PlatformType& t = kPlatformType) {
97 return (static_cast<int>(t) & static_cast<int>(a)) != 0;
98 }
99
100-#if defined(__APPLE__) || defined(__FreeBSD__)
101+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__linux__)
102 #define MUTEX_IMPL boost
103 #else
104 #define MUTEX_IMPL std
105@@ -204,10 +205,10 @@ using WriteLock = MUTEX_IMPL::unique_lock<Mutex>;
106 using ReadLock = MUTEX_IMPL::shared_lock<Mutex>;
107
108 /// Helper alias for defining recursive mutexes.
109-using RecursiveMutex = std::recursive_mutex;
110+using RecursiveMutex = MUTEX_IMPL::recursive_mutex;
111
112 /// Helper alias for write locking a recursive mutex.
113-using RecursiveLock = std::lock_guard<std::recursive_mutex>;
114+using RecursiveLock = MUTEX_IMPL::lock_guard<MUTEX_IMPL::recursive_mutex>;
115 }
116
117 /**
118diff --git a/osquery/CMakeLists.txt b/osquery/CMakeLists.txt
119index 77913d31..671b20d4 100644
120--- a/osquery/CMakeLists.txt
121+++ b/osquery/CMakeLists.txt
122@@ -57,7 +57,7 @@ endif()
123
124 # Construct a set of all object files, starting with third-party and all
125 # of the osquery core objects (sources from ADD_CORE_LIBRARY macros).
126-set(OSQUERY_OBJECTS $<TARGET_OBJECTS:osquery_sqlite>)
127+set(OSQUERY_OBJECTS "")
128
129 # Add subdirectories
130 add_subdirectory(config)
131@@ -138,6 +138,8 @@ elseif(FREEBSD)
132 ADD_OSQUERY_LINK_ADDITIONAL("rocksdb-lite")
133 endif()
134
135+ADD_OSQUERY_LINK_CORE("sqlite3")
136+
137 if(POSIX)
138 ADD_OSQUERY_LINK_CORE("boost_system")
139 ADD_OSQUERY_LINK_CORE("boost_filesystem")
140@@ -157,6 +159,7 @@ ADD_OSQUERY_LINK_ADDITIONAL("cppnetlib-client-connections${WO_KEY}")
141 ADD_OSQUERY_LINK_CORE("glog${WO_KEY}")
142
143 if(POSIX)
144+ ADD_OSQUERY_LINK_ADDITIONAL("benchmark")
145 ADD_OSQUERY_LINK_ADDITIONAL("snappy")
146 ADD_OSQUERY_LINK_ADDITIONAL("ssl")
147 ADD_OSQUERY_LINK_ADDITIONAL("crypto")
148@@ -336,13 +339,6 @@ if(NOT OSQUERY_BUILD_SDK_ONLY)
149
150 install(DIRECTORY "${CMAKE_SOURCE_DIR}/packs/"
151 DESTINATION "${CMAKE_INSTALL_PREFIX}/share/osquery/packs" COMPONENT main)
152- if(APPLE)
153- install(FILES "${CMAKE_SOURCE_DIR}/tools/deployment/com.facebook.osqueryd.plist"
154- DESTINATION "${CMAKE_INSTALL_PREFIX}/share/osquery/" COMPONENT main)
155- else()
156- install(PROGRAMS "${CMAKE_SOURCE_DIR}/tools/deployment/osqueryd.initd"
157- DESTINATION "/etc/init.d/" RENAME "osqueryd" COMPONENT main)
158- endif()
159 endif()
160
161 if(NOT SKIP_TESTS)
162diff --git a/osquery/tables/system/linux/tests/md_tables_tests.cpp b/osquery/tables/system/linux/tests/md_tables_tests.cpp
163index 126be362..119d361d 100644
164--- a/osquery/tables/system/linux/tests/md_tables_tests.cpp
165+++ b/osquery/tables/system/linux/tests/md_tables_tests.cpp
166@@ -72,7 +72,7 @@ void GetDrivesForArrayTestHarness(std::string arrayName,
167 EXPECT_CALL(md, getArrayInfo(arrayDevPath, _))
168 .WillOnce(DoAll(SetArgReferee<1>(arrayInfo), Return(true)));
169
170- Sequence::Sequence s1;
171+ Sequence s1;
172 for (int i = 0; i < MD_SB_DISKS; i++) {
173 mdu_disk_info_t diskInfo;
174 diskInfo.number = i;
175diff --git a/specs/windows/services.table b/specs/windows/services.table
176index 4ac24ee9..657d8b99 100644
177--- a/specs/windows/services.table
178+++ b/specs/windows/services.table
179@@ -12,7 +12,7 @@ schema([
180 Column("path", TEXT, "Path to Service Executable"),
181 Column("module_path", TEXT, "Path to ServiceDll"),
182 Column("description", TEXT, "Service Description"),
183- Column("user_account", TEXT, "The name of the account that the service process will be logged on as when it runs. This name can be of the form Domain\UserName. If the account belongs to the built-in domain, the name can be of the form .\UserName."),
184+ Column("user_account", TEXT, "The name of the account that the service process will be logged on as when it runs. This name can be of the form Domain\\UserName. If the account belongs to the built-in domain, the name can be of the form .\\UserName."),
185 ])
186 implementation("system/windows/services@genServices")
187 examples([