Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile failed on CentOS7 machine #1493

Open
atari83 opened this issue Sep 1, 2020 · 2 comments
Open

Compile failed on CentOS7 machine #1493

atari83 opened this issue Sep 1, 2020 · 2 comments

Comments

@atari83
Copy link

@atari83 atari83 commented Sep 1, 2020

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,

@atari83
Copy link
Author

@atari83 atari83 commented Sep 1, 2020

I used proposed patch: https://github.com/microsoft/cpprestsdk/pull/1462/files
and http_helpers.cpp compiled with no issue.

@barcharcraz
Copy link
Contributor

@barcharcraz barcharcraz commented Sep 16, 2020

is this just because bytes_read is a long int or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.