Open eugeniomiro opened 1 year ago
Same error with redhat 9 using llvm-toolset 15.0.7
FAILED: Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o
/usr/bin/c++ -DCPPREST_EXCLUDE_BROTLI=1 -DCPPREST_FORCE_HTTP_CLIENT_ASIO -DCPPREST_FORCE_HTTP_LISTENER_ASIO -DCPPREST_NO_SSL_LEAK_SUPPRESS -Dcpprest_EXPORTS -I../Release/include -I../Release/src/pch -std=c++11 -fno-strict-aliasing -O3 -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
Also same error when building on Debian 12 bookworm environment.
I'm evaluating using cpprestsdk in my projects and when I tried building it on a WSL box with Ubuntu 22.10 got the following output:
eugeniomiro@OPTIMUSPRIME:~/repos/cpprestsdk$ mkdir build eugeniomiro@OPTIMUSPRIME:~/repos/cpprestsdk$ cd build eugeniomiro@OPTIMUSPRIME:~/repos/cpprestsdk/build$ cmake -G "Unix Makefiles" .. -DCMAKE_BUILD_TYPE=Debug -- The C compiler identification is GNU 12.2.0 -- The CXX compiler identification is GNU 12.2.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - 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/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- 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 -- Looking for include file xlocale.h -- Looking for include file xlocale.h - not found -- Setting gcc options -- websocketpp not found, using the embedded version -- Found Boost: /usr/local/lib/cmake/Boost-1.78.0/BoostConfig.cmake (found version "1.78.0") found components: random system thread filesystem chrono atomic date_time regex -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) Reason given by package: The command "/mnt/c/Strawberry/perl/bin/pkg-config" --version failed with output: stderr: result: No such file or directory -- Checking for one of the modules 'openssl' -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found suitable version "3.0.5", minimum required is "1.0.0") -- Performing Test _SSL_LEAK_SUPPRESS_AVAILABLE -- Performing Test _SSL_LEAK_SUPPRESS_AVAILABLE - Failed -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") -- Added test library httpclient_test -- Added test library httplistener_test -- Added test library json_test -- Added test library pplx_test -- Added test library streams_test -- Added test library uri_test -- Added test library utils_test -- Added test library websocketsclient_test -- Configuring done -- Generating done -- Build files have been written to: /home/eugeniomiro/repos/cpprestsdk/build eugeniomiro@OPTIMUSPRIME:~/repos/cpprestsdk/build$ make [ 1%] Building CXX object Release/src/CMakeFiles/cpprest.dir/http/client/http_client.cpp.o [ 1%] Building CXX object Release/src/CMakeFiles/cpprest.dir/http/client/http_client_msg.cpp.o [ 2%] Building CXX object Release/src/CMakeFiles/cpprest.dir/http/common/http_compression.cpp.o [ 3%] Building CXX object Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o /home/eugeniomiro/repos/cpprestsdk/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)’: /home/eugeniomiro/repos/cpprestsdk/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); | ^~~~ /home/eugeniomiro/repos/cpprestsdk/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); | ^~~~~~ /home/eugeniomiro/repos/cpprestsdk/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 make[2]: *** [Release/src/CMakeFiles/cpprest.dir/build.make:118: Release/src/CMakeFiles/cpprest.dir/http/common/http_helpers.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:545: Release/src/CMakeFiles/cpprest.dir/all] Error 2 make: *** [Makefile:146: all] Error 2 eugeniomiro@OPTIMUSPRIME:~/repos/cpprestsdk/build$``` I have another WSL with Ubuntu 22.04 and it is built correctly there. I'm migrating my Linux servers to 22.10; sadly, this could be a deal breaker for me at this point.
Hello, how did you solve it? thx.
I didn't, I just moved on to Ubuntu 23.10 because 22.10 had ended its life in june 20th 2023. It compiled there so I stopped trying.
I'm evaluating using cpprestsdk in my projects and when I tried building it on a WSL box with Ubuntu 22.10 got the following output: