Merge pull request #1902 from theopolis/remove_glog

Remove Glog from third-party build
This commit is contained in:
Teddy Reed 2016-03-07 14:53:32 -08:00
commit 53c108d02e
18 changed files with 40 additions and 60 deletions

View File

@ -162,7 +162,7 @@ endmacro(ADD_OSQUERY_LIBRARY_ADDITIONAL)
macro(ADD_OSQUERY_LIBRARY IS_CORE TARGET) macro(ADD_OSQUERY_LIBRARY IS_CORE TARGET)
if(${IS_CORE} OR NOT OSQUERY_BUILD_SDK_ONLY) if(${IS_CORE} OR NOT OSQUERY_BUILD_SDK_ONLY)
add_library(${TARGET} OBJECT ${ARGN}) add_library(${TARGET} OBJECT ${ARGN})
add_dependencies(${TARGET} libglog osquery_extensions) add_dependencies(${TARGET} osquery_extensions)
SET_OSQUERY_COMPILE(${TARGET} "${CXX_COMPILE_FLAGS} -static") SET_OSQUERY_COMPILE(${TARGET} "${CXX_COMPILE_FLAGS} -static")
if(${IS_CORE}) if(${IS_CORE})
list(APPEND OSQUERY_SOURCES $<TARGET_OBJECTS:${TARGET}>) list(APPEND OSQUERY_SOURCES $<TARGET_OBJECTS:${TARGET}>)
@ -188,7 +188,7 @@ endmacro(ADD_OSQUERY_OBJCXX_LIBRARY_ADDITIONAL)
macro(ADD_OSQUERY_OBJCXX_LIBRARY IS_CORE TARGET) macro(ADD_OSQUERY_OBJCXX_LIBRARY IS_CORE TARGET)
if(${IS_CORE} OR NOT OSQUERY_BUILD_SDK_ONLY) if(${IS_CORE} OR NOT OSQUERY_BUILD_SDK_ONLY)
add_library(${TARGET} OBJECT ${ARGN}) add_library(${TARGET} OBJECT ${ARGN})
add_dependencies(${TARGET} libglog osquery_extensions) add_dependencies(${TARGET} osquery_extensions)
SET_OSQUERY_COMPILE(${TARGET} "${CXX_COMPILE_FLAGS} ${OBJCXX_COMPILE_FLAGS} -static") SET_OSQUERY_COMPILE(${TARGET} "${CXX_COMPILE_FLAGS} ${OBJCXX_COMPILE_FLAGS} -static")
if(${IS_CORE}) if(${IS_CORE})
list(APPEND OSQUERY_SOURCES $<TARGET_OBJECTS:${TARGET}>) list(APPEND OSQUERY_SOURCES $<TARGET_OBJECTS:${TARGET}>)
@ -212,7 +212,7 @@ macro(ADD_OSQUERY_MODULE TARGET)
if(NOT FREEBSD) if(NOT FREEBSD)
target_link_libraries(${TARGET} dl) target_link_libraries(${TARGET} dl)
endif() endif()
add_dependencies(${TARGET} libglog libosquery) add_dependencies(${TARGET} libosquery)
if(APPLE) if(APPLE)
target_link_libraries(${TARGET} "-undefined dynamic_lookup") target_link_libraries(${TARGET} "-undefined dynamic_lookup")
endif() endif()

View File

@ -1,38 +0,0 @@
include(FindPackageHandleStandardArgs)
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
set(GLOG_ROOT_DIR "${CMAKE_BINARY_DIR}/third-party/glog")
set(GLOG_SOURCE_DIR "${CMAKE_SOURCE_DIR}/third-party/glog")
set(GLOG_C_FLAGS "${CMAKE_C_FLAGS} ${C_COMPILE_FLAGS}")
if(APPLE)
set(GLOG_C_FLAGS "${GLOG_C_FLAGS} -mmacosx-version-min=${OSX_VERSION_MIN}")
endif()
set(GLOG_CXX_FLAGS "${GLOG_C_FLAGS} ${CMAKE_CXX_FLAGS} ${CXX_COMPILE_FLAGS}")
set(GLOG_CXX_FLAGS "${GLOG_CXX_FLAGS} -Wno-deprecated-register -Wno-unnamed-type-template-args -Wno-deprecated -Wno-error")
set(GLOG_INCLUDE_DIR "${GLOG_ROOT_DIR}/include")
set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
set(GLOG_LIBRARY "${GLOG_ROOT_DIR}/lib/libglog.a")
set(GLOG_LIBRARIES ${GLOG_LIBRARY})
INCLUDE(ExternalProject)
ExternalProject_Add(
libglog
SOURCE_DIR ${GLOG_SOURCE_DIR}
INSTALL_DIR ${GLOG_ROOT_DIR}
CONFIGURE_COMMAND ${GLOG_SOURCE_DIR}/configure
CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
CFLAGS=${GLOG_C_FLAGS} CXXFLAGS=${GLOG_CXX_FLAGS}
--enable-frame-pointers --enable-shared=no --prefix=${GLOG_ROOT_DIR}
BUILD_COMMAND ${CMAKE_MAKE_PROGRAM}
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
LOG_CONFIGURE ON
LOG_INSTALL ON
LOG_BUILD ON
)
LOG_LIBRARY(glog "${GLOG_LIBRARY}")

View File

@ -354,7 +354,6 @@ endif()
if(NOT DEFINED ENV{BUILD_LINK_SHARED}) if(NOT DEFINED ENV{BUILD_LINK_SHARED})
set(CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib .so) set(CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib .so)
endif() endif()
find_package(Glog REQUIRED)
find_package(Gflags REQUIRED) find_package(Gflags REQUIRED)
find_package(Gtest REQUIRED) find_package(Gtest REQUIRED)
find_package(Thrift 0.9.3 REQUIRED) find_package(Thrift 0.9.3 REQUIRED)
@ -376,7 +375,6 @@ enable_testing()
include(Packages) include(Packages)
include(Thrift) include(Thrift)
include_directories("${GLOG_INCLUDE_DIRS}")
include_directories("${CMAKE_SOURCE_DIR}/third-party/sqlite3") include_directories("${CMAKE_SOURCE_DIR}/third-party/sqlite3")
include_directories("${CMAKE_SOURCE_DIR}/include") include_directories("${CMAKE_SOURCE_DIR}/include")
include_directories("${CMAKE_SOURCE_DIR}") include_directories("${CMAKE_SOURCE_DIR}")

View File

@ -25,7 +25,6 @@ add_compile_options(
set(OSQUERY_LIBS set(OSQUERY_LIBS
# This includes librocksdb[_lite] and libsnappy. # This includes librocksdb[_lite] and libsnappy.
${THRIFT_LIBRARY} ${THRIFT_LIBRARY}
${GLOG_LIBRARY}
${GFLAGS_LIBRARY} ${GFLAGS_LIBRARY}
${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}
${OPENSSL_SSL_LIBRARY} ${OPENSSL_SSL_LIBRARY}
@ -72,6 +71,7 @@ else()
endif() endif()
# The remaining boost libraries are discovered with find_library. # The remaining boost libraries are discovered with find_library.
ADD_OSQUERY_LINK_CORE("glog")
ADD_OSQUERY_LINK_CORE("boost_system") ADD_OSQUERY_LINK_CORE("boost_system")
ADD_OSQUERY_LINK_CORE("boost_filesystem") ADD_OSQUERY_LINK_CORE("boost_filesystem")
ADD_OSQUERY_LINK_CORE("boost_regex") ADD_OSQUERY_LINK_CORE("boost_regex")

View File

@ -1,8 +1,6 @@
file(GLOB OSQUERY_LOGGER "*.cpp") file(GLOB OSQUERY_LOGGER "*.cpp")
ADD_OSQUERY_LIBRARY(TRUE osquery_logger ${OSQUERY_LOGGER}) ADD_OSQUERY_LIBRARY(TRUE osquery_logger ${OSQUERY_LOGGER})
add_dependencies(osquery_logger libglog)
file(GLOB OSQUERY_LOGGER_PLUGINS "plugins/*.cpp") file(GLOB OSQUERY_LOGGER_PLUGINS "plugins/*.cpp")
ADD_OSQUERY_LIBRARY(FALSE osquery_logger_plugins ${OSQUERY_LOGGER_PLUGINS}) ADD_OSQUERY_LIBRARY(FALSE osquery_logger_plugins ${OSQUERY_LOGGER_PLUGINS})

View File

@ -73,7 +73,8 @@ Status FilesystemLoggerPlugin::setUp() {
log_path_ = fs::path(FLAGS_logger_path); log_path_ = fs::path(FLAGS_logger_path);
// Ensure that the glog status logs use the same mode as our results log. // Ensure that the glog status logs use the same mode as our results log.
FLAGS_logfile_mode = FLAGS_logger_mode; // Glog 0.3.4 does not support a logfile mode.
// FLAGS_logfile_mode = FLAGS_logger_mode;
// Ensure that we create the results log here. // Ensure that we create the results log here.
return logStringToFile("", kFilesystemLoggerFilename, true); return logStringToFile("", kFilesystemLoggerFilename, true);

@ -1 +1 @@
Subproject commit 467917469b31f567f5f6a755641cfe8179a68394 Subproject commit dcb73fe68dc7c114a71faf2c08465d63c4380bd8

View File

@ -50,6 +50,7 @@ function main_amazon() {
package cryptsetup-luks-devel package cryptsetup-luks-devel
install_gflags install_gflags
install_glog
install_iptables_dev install_iptables_dev
package doxygen package doxygen

View File

@ -70,6 +70,7 @@ function main_centos() {
fi fi
install_gflags install_gflags
install_glog
install_iptables_dev install_iptables_dev
package doxygen package doxygen

View File

@ -24,6 +24,7 @@ function main_darwin() {
package doxygen package doxygen
package boost package boost
package gflags package gflags
package glog
package lz4 package lz4
package snappy package snappy
package rocksdb package rocksdb

View File

@ -44,15 +44,9 @@ function main_debian() {
package libdpkg-dev package libdpkg-dev
package libudev-dev package libudev-dev
package libblkid-dev package libblkid-dev
package libbz2-dev package libbz2-dev
package libreadline-dev package libreadline-dev
package iptables-dev package iptables-dev
package libsnappy-dev
package libgflags-dev
package libaudit-dev package libaudit-dev
package libmagic-dev package libmagic-dev
@ -74,11 +68,13 @@ function main_debian() {
package rubygems package rubygems
gem_install fpm gem_install fpm
install_thrift install_gflags
install_glog
install_snappy
install_rocksdb install_rocksdb
install_thrift
install_yara install_yara
install_cppnetlib install_cppnetlib
install_gflags
install_sleuthkit install_sleuthkit
# Need headers and PC macros # Need headers and PC macros

View File

@ -67,6 +67,7 @@ function main_fedora() {
fi fi
install_gflags install_gflags
install_glog
install_rocksdb install_rocksdb
install_yara install_yara
install_cppnetlib install_cppnetlib

View File

@ -16,6 +16,7 @@ function main_freebsd() {
package git package git
package python package python
package py27-pip package py27-pip
package glog
package snappy package snappy
package rocksdb package rocksdb
package thrift package thrift

View File

@ -262,6 +262,21 @@ function install_boost() {
fi fi
} }
function install_glog() {
SOURCE=glog-0.3.4
TARBALL=$SOURCE.tar.gz
URL=$DEPS_URL/$TARBALL
if provision glog /usr/local/lib/libglog.a; then
pushd $SOURCE
./configure --disable-shared --prefix=/usr/local \
CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS"
CC="$CC" CXX="$CXX" make -j $THREADS
sudo make install
popd
fi
}
function install_gflags() { function install_gflags() {
TARBALL=v2.1.1.tar.gz TARBALL=v2.1.1.tar.gz
URL=$DEPS_URL/$TARBALL URL=$DEPS_URL/$TARBALL

View File

@ -84,6 +84,7 @@ function main_oracle() {
fi fi
install_gflags install_gflags
install_glog
install_iptables_dev install_iptables_dev
package doxygen package doxygen

View File

@ -108,6 +108,7 @@ function main_rhel() {
fi fi
install_gflags install_gflags
install_glog
install_iptables_dev install_iptables_dev
package doxygen package doxygen

View File

@ -117,6 +117,7 @@ function main_ubuntu() {
install_cmake install_cmake
install_gflags install_gflags
install_glog
install_iptables_dev install_iptables_dev
if [[ $DISTRO = "lucid" ]]; then if [[ $DISTRO = "lucid" ]]; then

View File

@ -119,14 +119,16 @@ class DaemonTests(test_base.ProcessGenerator, unittest.TestCase):
# Wait for the daemon to flush to GLOG. # Wait for the daemon to flush to GLOG.
test_base.expectTrue(info_exists) test_base.expectTrue(info_exists)
# Both log files should exist and have the given mode. # Both log files should exist, the results should have the given mode.
for fname in ['osqueryd.INFO', 'osqueryd.results.log']: for fname in ['osqueryd.INFO', 'osqueryd.results.log']:
pth = os.path.join(logger_path, fname) pth = os.path.join(logger_path, fname)
self.assertTrue(os.path.exists(pth)) self.assertTrue(os.path.exists(pth))
rpath = os.path.realpath(info_path) # Only apply the mode checks to .log files.
mode = os.stat(rpath).st_mode & 0777 if fname.find('.log') > 0:
self.assertEqual(mode, test_mode) rpath = os.path.realpath(pth)
mode = os.stat(rpath).st_mode & 0777
self.assertEqual(mode, test_mode)
daemon.kill() daemon.kill()