seznam / elasticlient

C++ Elasticsearch client library
https://seznam.github.io/elasticlient/
MIT License
133 stars 67 forks source link

failed to build on opensuse 15.2 (leap) with clang #12

Closed trel closed 3 years ago

trel commented 4 years ago

at current tip of master

externals/elasticlient0.1.0-1_src/elasticlient $ git rev-parse HEAD
3adb172a26baae1a995e810e49fee1688ea44df5

a duplicate case statement...

-- The CXX compiler identification is Clang 6.0.1
-- Check for working CXX compiler: /externals/clang6.0-0/bin/clang++
-- Check for working CXX compiler: /externals/clang6.0-0/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking compiler C++11 support.
--   ELASTICLIENT_VERSION_MAJOR: 2
--   ELASTICLIENT_VERSION_MINOR: 1
--   ELASTICLIENT_VERSION_PATCH: 0
--   BUILD_ELASTICLIENT_TESTS: ON
--   BUILD_ELASTICLIENT_EXAMPLE: ON
--   USE_ALL_SYSTEM_LIBS: OFF
--   USE_SYSTEM_JSONCPP: OFF
--   USE_SYSTEM_CPR: OFF
--   USE_SYSTEM_HTTPMOCKSERVER: OFF
--   USE_SYSTEM_GTEST: OFF
-- CMAKE_MODULE_PATH: /externals/elasticlient0.1.0-1_src/elasticlient/cmake/Modules/
-- Checking compiler C++11 support.
-- httpmockserver CMake Options
-- =======================================================
--   USE_ALL_SYSTEM_LIBS: OFF
--   USE_SYSTEM_CPR: OFF
--   USE_SYSTEM_GTEST: OFF
-- =======================================================
-- Found mhd: /usr/include  
-- Found CURL: /usr/lib64/libcurl.so (found version "7.66.0") 
-- Checking compiler flags for C++11 support.
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- C++11 is supported.
-- C++ Requests CMake Options
-- =======================================================
--   USE_SYSTEM_CURL: YES
--   BUILD_CPR_TESTS: NO
--   GENERATE_COVERAGE: OFF
--   CPR_CURL_NOSIGNAL: OFF
--   USE_SYSTEM_GTEST: OFF
--   CMAKE_USE_OPENSSL: ON
-- =======================================================
-- Set CURL_FOUND to TRUE.
-- Set CURL_LIBRARIES to /usr/lib64/libcurl.so.
-- Set CURL_INCLUDE_DIRS to /usr/include.
-- Using CURL_INCLUDE_DIRS: /usr/include.
-- Using CURL_LIBRARIES: /usr/lib64/libcurl.so.
-- The C compiler identification is Clang 6.0.1
-- Check for working C compiler: /externals/clang6.0-0/bin/clang
-- Check for working C compiler: /externals/clang6.0-0/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.17") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- JsonCpp Version: 1.8.4
-- Looking for C++ include clocale
-- Looking for C++ include clocale - found
-- Looking for localeconv
-- Looking for localeconv - found
-- Looking for C++ include sys/types.h
-- Looking for C++ include sys/types.h - found
-- Looking for C++ include stdint.h
-- Looking for C++ include stdint.h - found
-- Looking for C++ include stddef.h
-- Looking for C++ include stddef.h - found
-- Check size of lconv
-- Check size of lconv - done
-- Performing Test HAVE_DECIMAL_POINT
-- Performing Test HAVE_DECIMAL_POINT - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /externals/elasticlient0.1.0-1_src/elasticlient/build
INFO -   stderr: CMake Warning:
  Manually-specified variables were not used by the project:

    BOOST_ROOT
INFO - 
DEBUG - 32 processor(s) detected, using -j31
DEBUG - run_env: {'TERM': 'xterm', 'SHLVL': '2', 'OLDPWD': '/', 'HOSTNAME': '1fdf0a7a43b6', 'MAKELEVEL': '1', 'PWD': '/externals', 'MAKE_TERMERR': '/dev/pts/0', '_': './build.py', 'HOME': '/root', 'PATH': '/usr/local/rvm/rubies/ruby-2.6.5/bin:/usr
/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'GPG_TTY': '/dev/pts/0', 'MFLAGS': '', 'GEM_HOME': '/usr/local/rvm/rubies/ruby-2.6.5', 'MAKEFLAGS': '', 'MAKE_TERMOUT': '/dev/pts/0'}
INFO - running: cd build && make, unsafe_shell=True, check_rc=build failed, retries=0
INFO -   stdout: make[1]: Entering directory '/externals/elasticlient0.1.0-1_src/elasticlient/build'
make[2]: Entering directory '/externals/elasticlient0.1.0-1_src/elasticlient/build'
make[3]: Entering directory '/externals/elasticlient0.1.0-1_src/elasticlient/build'
make[3]: Leaving directory '/externals/elasticlient0.1.0-1_src/elasticlient/build'
make[3]: Entering directory '/externals/elasticlient0.1.0-1_src/elasticlient/build'
[  2%] Building CXX object external/httpmockserver/external/cpr/cpr/CMakeFiles/cpr.dir/error.cpp.o
make[3]: Leaving directory '/externals/elasticlient0.1.0-1_src/elasticlient/build'
make[2]: Leaving directory '/externals/elasticlient0.1.0-1_src/elasticlient/build'
make[1]: Leaving directory '/externals/elasticlient0.1.0-1_src/elasticlient/build'
INFO -   stderr: /externals/elasticlient0.1.0-1_src/elasticlient/external/httpmockserver/external/cpr/cpr/error.cpp:41:14: fatal error: duplicate case value 'CURLE_PEER_FAILED_VERIFICATION'
        case CURLE_SSL_CACERT:
             ^
/usr/include/curl/curl.h:623:26: note: expanded from macro 'CURLE_SSL_CACERT'
#define CURLE_SSL_CACERT CURLE_PEER_FAILED_VERIFICATION
/externals/elasticlient0.1.0-1_src/elasticlient/external/httpmockserver/external/cpr/cpr/error.cpp:25:14: note: previous case defined here
        case CURLE_PEER_FAILED_VERIFICATION:
             ^
1 error generated.
make[3]: *** [external/httpmockserver/external/cpr/cpr/CMakeFiles/cpr.dir/build.make:115: external/httpmockserver/external/cpr/cpr/CMakeFiles/cpr.dir/error.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:191: external/httpmockserver/external/cpr/cpr/CMakeFiles/cpr.dir/all] Error 2
make[1]: *** [Makefile:141: all] Error 2
INFO - 
ERROR - build failed

fixed in the meantime with this local edit... but i'm sure there's a better way

externals/elasticlient0.1.0-1_src/elasticlient/external/httpmockserver/external/cpr/cpr $ git describe --tags
1.3.0-57-g3d14e61

externals/elasticlient0.1.0-1_src/elasticlient/external/httpmockserver/external/cpr/cpr $ git diff
diff --git a/cpr/error.cpp b/cpr/error.cpp
index 713cb10..7a7f9d6 100644
--- a/cpr/error.cpp
+++ b/cpr/error.cpp
@@ -38,8 +38,8 @@ ErrorCode Error::getErrorCodeForCurlError(std::int32_t curl_code) {
             return ErrorCode::SSL_LOCAL_CERTIFICATE_ERROR;
         case CURLE_SSL_CIPHER:
             return ErrorCode::GENERIC_SSL_ERROR;
-        case CURLE_SSL_CACERT:
-            return ErrorCode::SSL_CACERT_ERROR;
+//        case CURLE_SSL_CACERT:
+//            return ErrorCode::SSL_CACERT_ERROR;
         case CURLE_USE_SSL_FAILED:
             return ErrorCode::GENERIC_SSL_ERROR;
         case CURLE_SSL_ENGINE_INITFAILED:
sprinkjm commented 4 years ago

Having the same problem here on a Ubuntu 20 build with clang 6.0 on an rpi. Is there a branch with this local patch available? I am running into the problem while trying to use a docker container to automate the build process for distributable debs.

johniez commented 4 years ago

Hi. The problem is in external library referred in git submodules - where we are currently referring an old version without fix. We will update submodules to latest versions of external dependencies...

johniez commented 4 years ago

It should be fixed in master branch.