envoyproxy/envoy-openssl

[s390x] Build failed on s390x for envoy-openssl when building bssl-compat library

Opened this issue · 0 comments

Hi All,

We are facing issue while building bssl-compat library using envoy-openssl branch v1.28 on RHEL9.2 with clang-14. When we are building the standalone build of bssl-compat library we are able to build it without any issues. We are having issue only when built in bazel environment. Please assist me in resolving this issue.

[errorlog.txt](https://github.com/user-attachments/files/15991153/errorlog.txt)
[root@bd13abfc20e8 envoy-openssl]# bazel build -c opt //source/exe:envoy-static --sandbox_debug --verbose_failures --//source/extensions/filters/common/lua:luajit2=1  --linkopt=-fuse-ld=gold --copt="-Wno-deprecated-declarations" --local_cpu_resources=30 --local_ram_resources=61440 --jobs=30
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Analyzed target //source/exe:envoy-static (1001 packages loaded, 67645 targets configured).
INFO: Found 1 target...
ERROR: /root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/external/envoy/bssl-compat/BUILD:10:6: Foreign Cc - CMake: Building bssl-compat failed: (Exit 2): process-wrapper failed: error executing command 
  (cd /root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy && \
  exec env - \
    BAZEL_LINKLIBS=-l%:libstdc++.a \
    BAZEL_LINKOPTS=-lm \
    CC=/usr/bin/clang \
    CXX=/usr/bin/clang++ \
    PATH=/bin:/usr/bin:/usr/local/bin \
    TMPDIR=/tmp \
  /root/.cache/bazel/_bazel_root/install/dfe56ac81989e2f23685b56640195107/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/stats.out' /bin/bash -c bazel-out/s390x-opt/bin/external/envoy/bssl-compat/bssl-compat_foreign_cc/wrapper_build_script.sh)
rules_foreign_cc: Build failed!
rules_foreign_cc: Keeping temp build directory and dependencies directory for debug.
rules_foreign_cc: Please note that the directories inside a sandbox are still cleaned unless you specify --sandbox_debug Bazel command line flag.
rules_foreign_cc: Printing build logs:
_____ BEGIN BUILD LOGS _____

Bazel external C/C++ Rules. Building library bssl-compat

Environment:______________
BUILD_SCRIPT=bazel-out/s390x-opt/bin/external/envoy/bssl-compat/bssl-compat_foreign_cc/build_script.sh
EXT_BUILD_ROOT=/root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy
BUILD_LOG=bazel-out/s390x-opt/bin/external/envoy/bssl-compat/bssl-compat_foreign_cc/CMake.log
PWD=/root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy
CXX=/usr/bin/clang++
BUILD_WRAPPER_SCRIPT=bazel-out/s390x-opt/bin/external/envoy/bssl-compat/bssl-compat_foreign_cc/wrapper_build_script.sh
BAZEL_LINKOPTS=-lm
TMPDIR=/tmp
EXT_BUILD_DEPS=/root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy/bazel-out/s390x-opt/bin/external/envoy/bssl-compat/bssl-compat.ext_build_deps
Clang_ROOT=/usr/lib/llvm
BAZEL_LINKLIBS=-l%:libstdc++.a
BUILD_TMPDIR=/root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy/bazel-out/s390x-opt/bin/external/envoy/bssl-compat/bssl-compat.build_tmpdir
SHLVL=2
INSTALLDIR=/root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy/bazel-out/s390x-opt/bin/external/envoy/bssl-compat/bssl-compat
PATH=/root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy:/bin:/usr/bin:/usr/local/bin
CC=/usr/bin/clang
_=/bin/env
__________________________
+ /root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy/bazel-out/s390x-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/copy_cmake_tool.build/cmake_tool.build/bin/cmake -DCMAKE_AR=/usr/bin/ar '-DCMAKE_CXX_LINK_EXECUTABLE=/usr/bin/clang-14 <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>' '-DCMAKE_SHARED_LINKER_FLAGS=-shared -Wl,--gdb-index -fuse-ld=/usr/bin/ld.gold -Wl,-no-as-needed -Wl,-z,relro,-z,now -B/usr/bin -lm -Wl,--gc-sections -l:libstdc++.a -fuse-ld=gold' '-DCMAKE_EXE_LINKER_FLAGS=-Wl,--gdb-index -fuse-ld=/usr/bin/ld.gold -Wl,-no-as-needed -Wl,-z,relro,-z,now -B/usr/bin -lm -Wl,--gc-sections -l:libstdc++.a -fuse-ld=gold' -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy/bazel-out/s390x-opt/bin/external/envoy/bssl-compat/bssl-compat -DCMAKE_PREFIX_PATH=/root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy/bazel-out/s390x-opt/bin/external/envoy/bssl-compat/bssl-compat.ext_build_deps -DCMAKE_RANLIB= -DCMAKE_MAKE_PROGRAM=/root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy/bazel-out/s390x-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make -G 'Unix Makefiles' /root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy/external/envoy/bssl-compat
-- The C compiler identification is Clang 14.0.6
-- The CXX compiler identification is Clang 14.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang-14 - 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/clang++-14 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenSSL: /usr/lib64/libcrypto.so (found suitable version "3.0.7", minimum required is "3.0") found components: Crypto SSL 
-- Found OpenSSL 3.0.7 (/usr/lib64)
-- Performing Test HAVE_FFI_CALL
-- Performing Test HAVE_FFI_CALL - Success
-- Found FFI: /usr/lib64/libffi.so  
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib64/libtinfo.so  
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11") 
-- Found LLVM 14.0.6 (/,OFF,ON,ON)
-- Linker detection: GNU Gold
-- Found Python: /bin/python3.9 (found version "3.9.16") found components: Interpreter 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy/bazel-out/s390x-opt/bin/external/envoy/bssl-compat/bssl-compat.build_tmpdir
+ /root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy/bazel-out/s390x-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/copy_cmake_tool.build/cmake_tool.build/bin/cmake --build . --config Release -j
[  0%] Building CXX object prefixer/CMakeFiles/prefixer.dir/prefixer.cpp.o
[  0%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[  0%] Built target OpenSSL
/root/.cache/bazel/_bazel_root/e708ec56094462adb2c47f36d6f86338/sandbox/processwrapper-sandbox/3633/execroot/envoy/external/envoy/bssl-compat/prefixer/prefixer.cpp:767:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    std::system((std::string("sed -i ") + subts.str() + files.str()).c_str());
    ^~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[  0%] Linking CXX static library ../../../lib/libgtest.a
[  0%] Built target gtest
[  0%] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[  0%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
[  0%] Linking CXX static library ../../../lib/libgtest_main.a
[  0%] Built target gtest_main
[  0%] Linking CXX static library ../../../lib/libgmock.a
[  0%] Built target gmock
[  0%] Building CXX object _deps/googletest-build/googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o
[  0%] Linking CXX static library ../../../lib/libgmock_main.a
[  0%] Built target gmock_main
1 warning generated.
[  0%] Linking CXX executable prefixer
CMakeFiles/prefixer.dir/prefixer.cpp.o:prefixer.cpp:function std::filesystem::__cxx11::path::~path(): error: undefined reference to 'std::filesystem::__cxx11::path::_List::_Impl_deleter::operator()(std::filesystem::__cxx11::path::_List::_Impl*) const'
CMakeFiles/prefixer.dir/prefixer.cpp.o:prefixer.cpp:function std::filesystem::__cxx11::path::~path(): error: undefined reference to 'operator delete(void*)'
CMakeFiles/prefixer.dir/prefixer.cpp.o:prefixer.cpp:function std::__cxx11::basic_regex<char, std::__cxx11::regex_traits<char> >::basic_regex(char const*, std::regex_constants::syntax_option_type): error: undefined reference to 'std::locale::locale()'