google/cpu-check

make fails with linker errors in abseil package

Opened this issue · 0 comments

I am trying to compile this on Centos 8 machine. I had to install abseil-cpp-devel, zlib-devel, zlib-static and openssl-devel packages via dnf command. The cmake step passes but the make step fails -

/home/$ cmake -DOPENSSL_ROOT_DIR=/usr/local/ssl/ -DOPENSSL_INCLUDE_DIR=/usr/local/ssl/include/openssl  ..
-- The C compiler identification is GNU 8.5.0
-- The CXX compiler identification is GNU 8.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test ARCH_SANDYBRIDGE
-- Performing Test ARCH_SANDYBRIDGE - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found ZLIB: /usr/lib64/libz.a (found version "1.2.11")
-- Found OpenSSL: /usr/local/ssl/lib/libcrypto.a
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cpu-check/build

make step fails with linker errors for undefined references to absl package -

/home/$ make
...
[ 84%] Built target silkscreen
[ 88%] Building CXX object CMakeFiles/cpu_check.dir/cpu_check.cc.o
[ 92%] Linking CXX executable cpu_check
CMakeFiles/cpu_check.dir/cpu_check.cc.o: In function `Worker::DoComputations(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Worker::Choices const&, Worker::BufferSet*)':
cpu_check.cc:(.text+0x123d): undefined reference to `absl::lts_2020_09_23::Status::Status(absl::lts_2020_09_23::StatusCode, std::basic_string_view<char, std::char_traits<char> >)'
cpu_check.cc:(.text+0x13b0): undefined reference to `absl::lts_2020_09_23::Status::Status(absl::lts_2020_09_23::StatusCode, std::basic_string_view<char, std::char_traits<char> >)'
cpu_check.cc:(.text+0x144e): undefined reference to `absl::lts_2020_09_23::Status::Status(absl::lts_2020_09_23::StatusCode, std::basic_string_view<char, std::char_traits<char> >)'
cpu_check.cc:(.text+0x1553): undefined reference to `absl::lts_2020_09_23::Status::Status(absl::lts_2020_09_23::StatusCode, std::basic_string_view<char, std::char_traits<char> >)'
cpu_check.cc:(.text+0x1a10): undefined reference to `absl::lts_2020_09_23::Status::Status(absl::lts_2020_09_23::StatusCode, std::basic_string_view<char, std::char_traits<char> >)'
CMakeFiles/cpu_check.dir/cpu_check.cc.o:cpu_check.cc:(.text+0x1c8d): more undefined references to `absl::lts_2020_09_23::Status::Status(absl::lts_2020_09_23::StatusCode, std::basic_string_view<char, std::char_traits<char> >)' follow
CMakeFiles/cpu_check.dir/cpu_check.cc.o: In function `Worker::Run()':
...
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)

My doubts are on the abseil-cpp package. The README mentions -
Note that Abseil must be built with the C++17 standard and include the StatusOr package (release 2020_09_23 or later).
I see that in CMakeLists.txt, we already set the C++ version to 17 - https://github.com/google/cpu-check/blob/master/CMakeLists.txt#L52.
The installed abseil-cpp shows that the version is indeed 2020-09-23 -

Installed Packages
Name         : abseil-cpp
Version      : 20200923.3
Release      : 1.el8
Architecture : x86_64
Size         : 1.5 M
Source       : abseil-cpp-20200923.3-1.el8.src.rpm

Could someone please help with this? Any reference to existing documentation for generating the cpu-check binary would be great. Thanks.