Skip to content

Commit

Permalink
Revert "Build improvements (cmu-db#1026)" (cmu-db#1036)
Browse files Browse the repository at this point in the history
This reverts commit d31d08e
  • Loading branch information
mbutrovich authored Jul 29, 2020
1 parent d31d08e commit de55bfe
Show file tree
Hide file tree
Showing 86 changed files with 14,291 additions and 103 deletions.
18 changes: 2 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules")

include(CMakeParseArguments)
include(ExternalProject)
include(FetchContent)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -379,7 +378,6 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif ()

set(TERRIER_LINK_LIBS
terrier_static
gflags
${TERRIER_LINK_LIBS}
pg_query)
Expand All @@ -389,6 +387,7 @@ set(TERRIER_DEPENDENCIES

set(TERRIER_TEST_LINK_LIBS
test_util
terrier_static
gtest
gmock_main
gflags
Expand All @@ -397,26 +396,13 @@ set(TERRIER_TEST_LINK_LIBS
set(TERRIER_BENCHMARK_LINK_LIBS
benchmark_util
test_util
terrier_static
benchmark
gtest
gmock_main
gflags
${CMAKE_DL_LIBS})

# Mandate static linking on mac OS
if (APPLE)
list(APPEND TERRIER_TEST_LINK_LIBS terrier_static)
if (TERRIER_BUILD_SHARED)
set(TERRIER_BUILD_SHARED OFF CACHE BOOL "Build the libterrier shared libraries" FORCE)
message("Disabling TERRIER_BUILD_SHARED due to lack of support on mac OS.")
endif ()
else ()
list(APPEND TERRIER_TEST_LINK_LIBS terrier_shared)
endif ()

# Mandate static linking of the benchmark
list(APPEND TERRIER_BENCHMARK_LINK_LIBS terrier_static)

# configure settings for ctest
configure_file(
"test/CTestCustom.cmake"
Expand Down
18 changes: 4 additions & 14 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
def macOS_LLVM_path = "/usr/local/Cellar/llvm@8/8.0.1_1"

pipeline {
agent none
options {
Expand All @@ -13,9 +11,7 @@ pipeline {
stage('macos-10.14/AppleClang-1001.0.46.4 (Debug/format/lint/censored)') {
agent { label 'macos' }
environment {
LLVM_DIR="${macOS_LLVM_path}"
CC="${macOS_LLVM_path}/bin/clang-8"
CXX="${macOS_LLVM_path}/bin/clang++-8"
LLVM_DIR="/usr/local/Cellar/llvm@8/8.0.1_1"
}
steps {
sh 'echo $NODE_NAME'
Expand Down Expand Up @@ -92,9 +88,7 @@ pipeline {
agent { label 'macos' }
environment {
ASAN_OPTIONS="detect_container_overflow=0"
LLVM_DIR="${macOS_LLVM_path}"
CC="${macOS_LLVM_path}/bin/clang-8"
CXX="${macOS_LLVM_path}/bin/clang++-8"
LLVM_DIR="/usr/local/Cellar/llvm@8/8.0.1_1"
}
steps {
sh 'echo $NODE_NAME'
Expand Down Expand Up @@ -227,9 +221,7 @@ pipeline {
agent { label 'macos' }
environment {
ASAN_OPTIONS="detect_container_overflow=0"
LLVM_DIR="${macOS_LLVM_path}"
CC="${macOS_LLVM_path}/bin/clang-8"
CXX="${macOS_LLVM_path}/bin/clang++-8"
LLVM_DIR="/usr/local/Cellar/llvm@8/8.0.1_1"
}
steps {
sh 'echo $NODE_NAME'
Expand Down Expand Up @@ -320,9 +312,7 @@ pipeline {
agent { label 'macos' }
environment {
ASAN_OPTIONS="detect_container_overflow=0"
LLVM_DIR="${macOS_LLVM_path}"
CC="${macOS_LLVM_path}/bin/clang-8"
CXX="${macOS_LLVM_path}/bin/clang++-8"
LLVM_DIR="/usr/local/Cellar/llvm@8/8.0.1_1"
}
steps {
sh 'echo $NODE_NAME'
Expand Down
3 changes: 1 addition & 2 deletions build-support/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,10 @@ function setup_sanitizers() {
TSAN_OPTIONS="$TSAN_OPTIONS history_size=7"
export TSAN_OPTIONS

ASAN_OPTIONS="$ASAN_OPTIONS detect_odr_violation=0"
# Enable leak detection even under LLVM 3.4, where it was disabled by default.
# This flag only takes effect when running an ASAN build.
# ASAN_OPTIONS="$ASAN_OPTIONS detect_leaks=1"
export ASAN_OPTIONS
# export ASAN_OPTIONS

# Set up suppressions for LeakSanitizer
LSAN_OPTIONS="$LSAN_OPTIONS suppressions=$ROOT/build-support/data/lsan_suppressions.txt"
Expand Down
2 changes: 0 additions & 2 deletions cmake_modules/FindClangTools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ endif()
if (CLANG_TOOLS_VERSION)
find_program(CLANG_TIDY_BIN
NAMES clang-tidy-${CLANG_TOOLS_VERSION}
clang-tidy
PATHS
${ClangTools_PATH}
$ENV{CLANG_TOOLS_PATH}
Expand Down Expand Up @@ -98,7 +97,6 @@ endif()
if (CLANG_TOOLS_VERSION)
find_program(CLANG_FORMAT_BIN
NAMES clang-format-${CLANG_TOOLS_VERSION}
clang-format
PATHS
${ClangTools_PATH}
$ENV{CLANG_TOOLS_PATH}
Expand Down
12 changes: 3 additions & 9 deletions cmake_modules/SetupCxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,10 @@ include(CheckCXXCompilerFlag)

# compiler flags that are common across debug/release builds
set(CXX_COMMON_FLAGS "-Wall -Werror -Wno-c++98-compat -Wno-c++98-compat-pedantic")
set(CXX_ONLY_FLAGS "-std=c++17 -fPIC -mcx16 -march=native")
if (APPLE)
# Use -fvisibility=hidden since mac OS builds are statically linked
set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -fvisibility=hidden")
# AppleClang needs this while upstream Clang and GCC are reasonable
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-braced-scalar-init")
else ()
# Get some of the benefits of fvisibility=hidden
set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -fvisibility-inlines-hidden")
endif ()
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-braced-scalar-init") # AppleClang needs this while upstream Clang and GCC are reasonable
endif()
set(CXX_ONLY_FLAGS "-std=c++17 -fPIC -mcx16 -march=native -fvisibility=hidden")

# if no build build type is specified, default to debug builds
if (NOT CMAKE_BUILD_TYPE)
Expand Down
23 changes: 2 additions & 21 deletions cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ else ()
set(GBENCHMARK_SOURCE_URL "https://github.com/google/benchmark/archive/v${GBENCHMARK_VERSION}.tar.gz")
endif ()

if (DEFINED ENV{TERRIER_SPDLOG_URL})
set(SPDLOG_SOURCE_URL "$ENV{TERRIER_SPDLOG_URL}")
else ()
set(SPDLOG_SOURCE_URL "https://github.com/gabime/spdlog/archive/v${SPDLOG_VERSION}.tar.gz")
endif ()

# ----------------------------------------------------------------------
# ExternalProject options

Expand Down Expand Up @@ -242,19 +236,6 @@ if (TERRIER_BUILD_BENCHMARKS)
endif ()
endif ()

# spdlog
if ("${SPDLOG_HOME}" STREQUAL "")
FetchContent_Declare(SPDLOG
URL ${SPDLOG_SOURCE_URL})
FetchContent_MakeAvailable(SPDLOG)

include_directories(SYSTEM "${spdlog_SOURCE_DIR}/include")
list(APPEND TERRIER_LINK_LIBS spdlog::spdlog)
else ()
set(SPDLOG_VENDORED 0)
find_package(spdlog REQUIRED)
endif ()

#----------------------------------------------------------------------

set(TERRIER_LINK_LIBS "")
Expand Down Expand Up @@ -297,5 +278,5 @@ llvm_map_components_to_libnames(LLVM_LIBRARIES core mcjit nativecodegen native i
include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})
list(APPEND TERRIER_LINK_LIBS ${LLVM_LIBRARIES})

# flatbuffers
include_directories(SYSTEM "${THIRDPARTY_DIR}/flatbuffers/include")
#flatbuffers
include_directories(SYSTEM "${THIRDPARTY_DIR}/flatbuffers/include")
2 changes: 1 addition & 1 deletion script/installation/packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ LINUX_BUILD_PACKAGES=(\
"clang-8" \
"clang-format-8" \
"clang-tidy-8" \
"cmake" \
"doxygen" \
"git" \
"g++-7" \
Expand Down Expand Up @@ -66,7 +67,6 @@ LINUX_TEST_PACKAGES=(\
PYTHON_PACKAGES=(\
"pyarrow" \
"pandas" \
"cmake" \
)


Expand Down
8 changes: 7 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ list(REMOVE_ITEM TERRIER_SRCS ${PROJECT_SOURCE_DIR}/src/main/terrier.cpp)
# Third party sources
###############################################

# spdlog
file(GLOB_RECURSE SPDLOG_SOURCES
${PROJECT_SOURCE_DIR}/third_party/spdlog/*.h
)
list(APPEND TERRIER_SRCS ${SPDLOG_SOURCES})

# libpg_query
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/libpg_query/ libpg_query.a)

Expand Down Expand Up @@ -71,4 +77,4 @@ ADD_TERRIER_LIB(terrier
###############################################
add_executable(terrier main/terrier.cpp)
set_target_properties(terrier PROPERTIES ENABLE_EXPORTS 1)
target_link_libraries(terrier ${TERRIER_LINK_LIBS})
target_link_libraries(terrier terrier_static ${TERRIER_LINK_LIBS})
42 changes: 35 additions & 7 deletions src/include/loggers/loggers_util.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,48 @@
#pragma once

#include <memory>
#include <string>
#include <string_view>

#include "spdlog/logger.h"

// flush the debug logs, every <n> seconds
#define DEBUG_LOG_FLUSH_INTERVAL 3

// clang-format off
// The order of these headers matters. clang-format will try to sort them.
#include "spdlog/spdlog.h"
#include "spdlog/fmt/ostr.h"
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/stdout_sinks.h"
// clang-format on
namespace spdlog::details {
struct console_stdout;
struct console_mutex;
} // namespace spdlog::details

namespace spdlog::sinks {
template <typename TargetStream, typename ConsoleMutex>
class stdout_sink;

using stdout_sink_mt = stdout_sink<details::console_stdout, details::console_mutex>;
} // namespace spdlog::sinks

extern std::shared_ptr<spdlog::sinks::stdout_sink_mt> default_sink; // NOLINT

/// @cond DOXYGEN_IGNORE
extern template void spdlog::logger::trace<std::string>(const std::string &);
extern template void spdlog::logger::debug<std::string>(const std::string &);
extern template void spdlog::logger::info<std::string>(const std::string &);
extern template void spdlog::logger::warn<std::string>(const std::string &);
extern template void spdlog::logger::error<std::string>(const std::string &);

extern template void spdlog::logger::trace<>(const char *fmt);
extern template void spdlog::logger::debug<>(const char *fmt);
extern template void spdlog::logger::info<>(const char *fmt);
extern template void spdlog::logger::warn<>(const char *fmt);
extern template void spdlog::logger::error<>(const char *fmt);

extern template void spdlog::logger::trace<std::string_view>(const std::string_view &);
extern template void spdlog::logger::debug<std::string_view>(const std::string_view &);
extern template void spdlog::logger::info<std::string_view>(const std::string_view &);
extern template void spdlog::logger::warn<std::string_view>(const std::string_view &);
extern template void spdlog::logger::error<std::string_view>(const std::string_view &);
/// @endcond

namespace terrier {

/**
Expand Down
1 change: 1 addition & 0 deletions src/include/network/terrier_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <pthread.h>
#include <sys/file.h>

#include <condition_variable> // NOLINT
#include <csignal>
#include <cstdio>
#include <cstdlib>
Expand Down
3 changes: 1 addition & 2 deletions src/include/optimizer/binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <vector>

#include "loggers/optimizer_logger.h"

#include "optimizer/group.h"
#include "optimizer/memo.h"
#include "optimizer/operator_node.h"
Expand Down Expand Up @@ -74,7 +73,7 @@ class GroupBindingIterator : public BindingIterator {
num_group_items_(target_group_->GetLogicalExpressions().size()),
current_item_index_(0),
txn_(txn) {
OPTIMIZER_LOG_TRACE("Attempting to bind on group {0}", id);
OPTIMIZER_LOG_TRACE("Attempting to bind on group " + std::to_string(!id));
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/include/storage/write_ahead_log/disk_log_consumer_task.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#pragma once

#include <condition_variable> // NOLINT
#include <utility>
#include <vector>

#include "common/container/concurrent_blocking_queue.h"
#include "common/container/concurrent_queue.h"
#include "common/dedicated_thread_task.h"
Expand Down
1 change: 1 addition & 0 deletions src/include/storage/write_ahead_log/log_serializer_task.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <condition_variable> // NOLINT
#include <queue>
#include <tuple>
#include <unordered_map>
Expand Down
3 changes: 3 additions & 0 deletions src/loggers/binder_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#include <memory>

#include "spdlog/sinks/stdout_sinks.h"
#include "spdlog/spdlog.h"

namespace terrier::binder {

std::shared_ptr<spdlog::logger> binder_logger = nullptr; // NOLINT
Expand Down
3 changes: 3 additions & 0 deletions src/loggers/catalog_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#include <memory>

#include "spdlog/sinks/stdout_sinks.h"
#include "spdlog/spdlog.h"

namespace terrier::catalog {

std::shared_ptr<spdlog::logger> catalog_logger = nullptr; // NOLINT
Expand Down
3 changes: 3 additions & 0 deletions src/loggers/common_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#include <memory>

#include "spdlog/sinks/stdout_sinks.h"
#include "spdlog/spdlog.h"

namespace terrier::common {

std::shared_ptr<spdlog::logger> common_logger = nullptr; // NOLINT
Expand Down
3 changes: 3 additions & 0 deletions src/loggers/execution_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#include <memory>

#include "spdlog/sinks/stdout_sinks.h"
#include "spdlog/spdlog.h"

namespace terrier::execution {

std::shared_ptr<spdlog::logger> execution_logger = nullptr; // NOLINT
Expand Down
3 changes: 3 additions & 0 deletions src/loggers/index_logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#include <memory>

#include "spdlog/sinks/stdout_sinks.h"
#include "spdlog/spdlog.h"

namespace terrier::storage {

std::shared_ptr<spdlog::logger> index_logger = nullptr; // NOLINT
Expand Down
Loading

0 comments on commit de55bfe

Please sign in to comment.