Skip to content

Compiling Bear on RHEL 8 Centos 8 - updated solution #615

@lukashino

Description

@lukashino

Hello, just wanted to drop a note for RHEL8 builds since the git diff patch provided in #305 does not work anymore. Following https://support.scitools.com/support/solutions/articles/70000647772-installing-rizsotto-bear-on-centos-rhel-8 helped me to get going.

Related but not useful: #352

Environment:

OS name: Linux
OS version: Oracle Linux Server release 8.10
OS architecture: x86_64
gcc version: gcc (GCC) 9.2.1 - installed with dnf -y install gcc-toolset-9-gcc gcc-toolset-9-gcc-c++ && source /opt/rh/gcc-toolset-9/enable
Bear version: 3.1.5
Bear install method: from sources

Here is the updated patch that worked for me on Bear 3.1.5:

diff --git a/source/bear/CMakeLists.txt b/source/bear/CMakeLists.txt
index ad0b114..e4c30c6 100644
--- a/source/bear/CMakeLists.txt
+++ b/source/bear/CMakeLists.txt
@@ -14,7 +14,8 @@ target_link_libraries(bear_a PUBLIC
         fmt::fmt
         citnames_a
         intercept_a
-        spdlog::spdlog)
+        spdlog::spdlog
+        stdc++fs)
 
 # Create an executable from the sub projects.
 add_executable(bear
diff --git a/source/citnames/CMakeLists.txt b/source/citnames/CMakeLists.txt
index 789ca50..c80ff8d 100644
--- a/source/citnames/CMakeLists.txt
+++ b/source/citnames/CMakeLists.txt
@@ -13,7 +13,8 @@ target_link_libraries(citnames_json_a PUBLIC
         sys_a
         fmt::fmt
         spdlog::spdlog
-        nlohmann_json::nlohmann_json)
+        nlohmann_json::nlohmann_json
+        stdc++fs)
 target_compile_options(citnames_json_a PRIVATE -fexceptions)
 
 # Create a static library, which is used for unit tests and the final shared library.
@@ -46,7 +47,8 @@ target_link_libraries(citnames_a PUBLIC
         sys_a
         exec_a
         fmt::fmt
-        spdlog::spdlog)
+        spdlog::spdlog
+        stdc++fs)
 
 include(GNUInstallDirs)
 
diff --git a/source/intercept/CMakeLists.txt b/source/intercept/CMakeLists.txt
index 99a897e..4e757ab 100644
--- a/source/intercept/CMakeLists.txt
+++ b/source/intercept/CMakeLists.txt
@@ -51,7 +51,8 @@ target_link_libraries(intercept_a PUBLIC
         rpc_a
         sys_a
         result_a
-        spdlog::spdlog)
+        spdlog::spdlog
+        stdc++fs)
 
 # Markdown file is the source to the man file. Please modify that and generate
 # the man file from it with pandoc.
@@ -82,7 +83,8 @@ target_link_libraries(wrapper_a PUBLIC
         result_a
         sys_a
         rpc_a
-        spdlog::spdlog)
+        spdlog::spdlog
+        stdc++fs)
 
 
 # Intercept report sender executable.
@@ -152,6 +154,7 @@ target_sources(exec_a PRIVATE
         source/report/libexec/Session.cc
         INTERFACE $<TARGET_OBJECTS:exec_a>)
 target_link_libraries(exec_a PUBLIC ${CMAKE_DL_LIBS} result_a)
+target_link_libraries(exec_a PUBLIC stdc++fs)
 set_target_properties(exec_a PROPERTIES
         LINKER_LANGUAGE "C"
         POSITION_INDEPENDENT_CODE 1)

Applying the patch:
Store it to a file and then do git apply

And then you do the usual:

cmake -DCMAKE_CXX_FLAGS=-std=c++17 -DENABLE_UNIT_TESTS=OFF -DENABLE_FUNC_TESTS=OFF $BEAR_SOURCE_DIR
make all -j10
sudo make install

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions