Skip to content

Compile failed on CentOS7 machine #1493

Closed
@atari83

Description

@atari83

I built the cpprestsdk on FreeBSD 12.1 (Clang 8, Boost 1.72) with no issue, However when i tried to build it on my CentOS machine (GCC 10 / Boost 1.74) the compilation failed with this error:

[4/160] Building CXX object Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o
FAILED: Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o 
/usr/local/bin/g++  -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_CHRONO_DYN_LINK -DBOOST_DATE_TIME_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_RANDOM_DYN_LINK -DBOOST_REGEX_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK -DCPPREST_EXCLUDE_BROTLI=1 -DCPPREST_FORCE_HTTP_CLIENT_ASIO -DCPPREST_FORCE_HTTP_LISTENER_ASIO -Dcpprest_EXPORTS -I../Release/include -I../Release/src/pch -I../Release/libs/websocketpp -std=c++11 -fno-strict-aliasing -O2 -DNDEBUG -fPIC   -Werror -pedantic -Wall -Wextra -Wunused-parameter -Wcast-align -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls -Wunreachable-code -MD -MT Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o -MF Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o.d -o Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o -c ../Release/src/http/common/http_helpers.cpp
../Release/src/http/common/http_helpers.cpp: In function ‘size_t web::http::details::chunked_encoding::add_chunked_delimiters(uint8_t*, size_t, size_t)’:
../Release/src/http/common/http_helpers.cpp:91:43: error: ‘%8zX’ directive output may be truncated writing between 8 and 16 bytes into a region of size 9 [-Werror=format-truncation=]
   91 |         snprintf(buffer, sizeof(buffer), "%8zX", bytes_read);
      |                                           ^~~~
../Release/src/http/common/http_helpers.cpp:91:42: note: directive argument in the range [1, 18446744073709551615]
   91 |         snprintf(buffer, sizeof(buffer), "%8zX", bytes_read);
      |                                          ^~~~~~
../Release/src/http/common/http_helpers.cpp:91:17: note: ‘snprintf’ output between 9 and 17 bytes into a destination of size 9
   91 |         snprintf(buffer, sizeof(buffer), "%8zX", bytes_read);
      |         ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Is there anything wrong with my setup on Linux machine ? and how can i resolve it ?

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions