abseil-cpp icon indicating copy to clipboard operation
abseil-cpp copied to clipboard

[Bug]: build failure on redhat/ubi8

Open lewijw opened this issue 1 year ago • 3 comments

Describe the issue

The build fails on redhat/ubi8 with:

122.5 [ 35%] Building CXX object absl/container/CMakeFiles/absl_btree_test.dir/btree_test.cc.o 171.2 /tmp/ccXC28tB.s: Assembler messages: 171.2 /tmp/ccXC28tB.s:305105: Error: symbol `_ZSt7forwardIRKaEOT_RNSt16remove_referenceIS2_E4typeE' is already defined 174.0 gmake[2]: *** [absl/container/CMakeFiles/absl_btree_test.dir/build.make:76: absl/container/CMakeFiles/absl_btree_test.dir/btree_test.cc.o] Error 1 174.0 gmake[1]: *** [CMakeFiles/Makefile2:3322: absl/container/CMakeFiles/absl_btree_test.dir/all] Error 2 174.0 gmake: *** [Makefile:146: all] Error 2

Dockerfile:9

7 | WORKDIR /abseil-cpp-20240116.2/build 8 | RUN cmake -DABSL_BUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON -DCMAKE_CXX_STANDARD=14 .. 9 | >>> RUN cmake --build . --target all 10 |

ERROR: failed to solve: process "/bin/sh -c cmake --build . --target all" did not complete successfully: exit code: 2

Steps to reproduce the problem

Attempt a build with the following Dockerfile (docker build .):

FROM redhat/ubi8

RUN dnf -y install gcc-c++ wget cmake RUN wget https://github.com/abseil/abseil-cpp/releases/download/20240116.2/abseil-cpp-20240116.2.tar.gz RUN tar -xf abseil-cpp-20240116.2.tar.gz RUN mkdir /abseil-cpp-20240116.2/build WORKDIR /abseil-cpp-20240116.2/build RUN cmake -DABSL_BUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON -DCMAKE_CXX_STANDARD=14 .. RUN cmake --build . --target all

Note: A similar Dockerfile passes with debian:

FROM debian:bullseye

RUN apt-get update && apt install -y g++ wget cmake RUN wget https://github.com/abseil/abseil-cpp/releases/download/20240116.2/abseil-cpp-20240116.2.tar.gz RUN tar -xf abseil-cpp-20240116.2.tar.gz RUN mkdir /abseil-cpp-20240116.2/build WORKDIR /abseil-cpp-20240116.2/build RUN cmake -DABSL_BUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON -DCMAKE_CXX_STANDARD=14 .. RUN cmake --build . --target all

What version of Abseil are you using?

20240116.2

What operating system and version are you using?

redhat/ubi8

[root@1152827655ea build]# uname -srm Linux 5.14.0-362.13.1.el9_3.x86_64 x86_64

[root@1152827655ea build]# cat /etc/os-release NAME="Red Hat Enterprise Linux" VERSION="8.10 (Ootpa)" ID="rhel" ID_LIKE="fedora" VERSION_ID="8.10" PLATFORM_ID="platform:el8" PRETTY_NAME="Red Hat Enterprise Linux 8.10 (Ootpa)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos" HOME_URL="https://www.redhat.com/" DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8" BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8" REDHAT_BUGZILLA_PRODUCT_VERSION=8.10 REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux" REDHAT_SUPPORT_PRODUCT_VERSION="8.10"

What compiler and version are you using?

[root@1152827655ea build]# gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux Thread model: posix gcc version 8.5.0 20210514 (Red Hat 8.5.0-22) (GCC)

What build system are you using?

[root@1152827655ea build]# cmake --version cmake version 3.26.5

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Additional context

No response

lewijw avatar May 24 '24 20:05 lewijw

I met same problem in building on MIPS platform

lams2135 avatar Jun 19 '24 07:06 lams2135

I met same problem in building on debian 10

hyojoonlee04 avatar Jul 05 '24 08:07 hyojoonlee04

The same issue occurred when I used the default C++ compiler (g++ 8.5.0) on Red Hat Enterprise Linux 8.10 to compile the abseil-cpp code.

To solve the compilation crash, you should rely on a newer version of the GCC. Here's a solution that might work. It is based on the installation of the gcc-toolset-14 meta package. The GCC toolset packages introduces to the system a different version of the GCC compiler collection and runtime libraries, which is newer than the baseline one and has up-to-date C++ support, which is a crucial point here. First, install the necessary package(s):

$ sudo dnf install gcc-toolset-14

Afterwards, before running the CMake configuration, run this as the user appointed to run the compilation:

$ scl enable gcc-toolset-14 bash

It loads the necessary environment components that will allow you to switch from the baseline GCC compiler collection to the one installed with the GCC toolset.

Note that it is mandatory to run the CMake configuration process within the same Bash session invoked through scl tool (that kind of invoking Bash is shown above):

$ cmake -B build-gcc -DABSL_PROPAGATE_CXX_STD=ON -DABSL_BUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++

The configuration process, generally, goes smoothly (at least in my case).

Building (compilation) comes next:

$ cmake --build build-gcc -j 4

See the attached log file cmake-build-abseil-cpp-20240722.0.log to catch with the messages emitted by cmake during the compilation. Once the compilation is successfully completed, start with the build tests:

$ ctest --test-dir build-gcc

I have attached here the outcome of the test process. It is stored in the log file ctest-abseil-cpp-20240722.0.log.

vessokolev avatar Dec 07 '24 11:12 vessokolev