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

Build failed on Ubuntu #1796

Open
mkzz115 opened this issue Jun 26, 2024 · 2 comments
Open

Build failed on Ubuntu #1796

mkzz115 opened this issue Jun 26, 2024 · 2 comments

Comments

@mkzz115
Copy link

mkzz115 commented Jun 26, 2024

I build cpprestsdk in ubuntu 22.04, it occur error:
eps/cpprestsdk-2.10.19/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/mackie/deps/cpprestsdk-2.10.19/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); | ^~~~~~ In file included from /usr/include/stdio.h:894, from /usr/include/c++/11/cstdio:42, from /usr/include/c++/11/ext/string_conversions.h:43, from /usr/include/c++/11/bits/basic_string.h:6608, from /usr/include/c++/11/string:55, from /home/mackie/deps/cpprestsdk-2.10.19/Release/src/pch/stdafx.h:52, from /home/mackie/deps/cpprestsdk-2.10.19/Release/src/http/common/http_helpers.cpp:14: /usr/include/x86_64-linux-gnu/bits/stdio2.h:71:35: note: ‘__builtin___snprintf_chk’ output between 9 and 17 bytes into a destination of size 9 71 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 72 | __glibc_objsize (__s), __fmt, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 73 | __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~ 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[2]: *** Waiting for unfinished jobs....

gcc version: 11.4

op:
cmake .. -DCMAKE_BUILD_TYPE=Release make -j10

@mkzz115
Copy link
Author

mkzz115 commented Jun 26, 2024

probably my os is 64 bit, size_t is 16 bit, so I changed char buffer[9] to char buffer[17] = {0} , then build successful

@mkzz115 mkzz115 changed the title Build failed Build failed on Ubuntu Jun 26, 2024
@giorgiozoppi
Copy link

can you provide a patch ?

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

No branches or pull requests

2 participants