Ubuntu build error: cstring header missing
fabricatedmath opened this issue · comments
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp: In function ‘bool IsSpace(char)’:
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp:223:10: error: ‘strchr’ was not declared in this scope
223 | { return strchr(" \t\r\n", ch) != nullptr; }
| ^~~~~~
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp:49:1: note: ‘strchr’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
48 | #include <limits.h>
+++ |+#include <cstring>
49 | #endif
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp: In member function ‘bool Options::Parse(int32_t, const char**)’:
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp:582:9: error: ‘strlen’ was not declared in this scope
582 | if (strlen(shaderModel) != 3)
| ^~~~~~
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp:582:9: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp:592:14: error: ‘strcmp’ was not declared in this scope
592 | if (!strcmp(platformName, g_PlatformNames[i]))
| ^~~~~~
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp:592:14: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp: In function ‘void ExeCompile()’:
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp:1219:21: error: ‘strstr’ was not declared in this scope
1219 | if (strstr(buf, "compilation object save succeeded"))
| ^~~~~~
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp:1219:21: note: ‘strstr’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
/home/cdurham/RTXDI/donut/src/core/string_utils.cpp: In function ‘std::optional<_Tp> donut::string_utils::parse(std::string_view) [with T = float; std::string_view = std::basic_string_view<char>]’:
/home/cdurham/RTXDI/donut/src/core/string_utils.cpp:55:17: error: ‘strncpy’ was not declared in this scope
55 | strncpy(buf, s.data(), std::min(s.size(), sizeof(buf) - 1));
| ^~~~~~~
/home/cdurham/RTXDI/donut/src/core/string_utils.cpp:24:1: note: ‘strncpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
23 | #include <donut/core/string_utils.h>
+++ |+#include <cstring>
24 |
/home/cdurham/RTXDI/donut/src/core/string_utils.cpp: In function ‘std::optional<_Tp> donut::string_utils::parse(std::string_view) [with T = double; std::string_view = std::basic_string_view<char>]’:
/home/cdurham/RTXDI/donut/src/core/string_utils.cpp:72:17: error: ‘strncpy’ was not declared in this scope
72 | strncpy(buf, s.data(), std::min(s.size(), sizeof(buf) - 1));
| ^~~~~~~
/home/cdurham/RTXDI/donut/src/core/string_utils.cpp:72:17: note: ‘strncpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp: In function ‘bool ProcessConfigLine(uint32_t, const std::string&, const std::filesystem::file_time_type&)’:
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp:1351:9: error: ‘strcmp’ was not declared in this scope
1351 | if (strcmp(configLine.entryPoint, "main"))
| ^~~~~~
/home/cdurham/RTXDI/donut/ShaderMake/src/ShaderMake.cpp:1351:9: note: ‘strcmp’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
/home/cdurham/RTXDI/donut/src/core/vfs/TarFile.cpp: In constructor ‘donut::vfs::TarFile::TarFile(const std::filesystem::__cxx11::path&)’:
/home/cdurham/RTXDI/donut/src/core/vfs/TarFile.cpp:88:35: error: ‘strnlen’ was not declared in this scope
88 | size_t prefixLength = strnlen(header.prefix, sizeof(header.prefix));
| ^~~~~~~
/home/cdurham/RTXDI/donut/src/core/vfs/TarFile.cpp:92:17: error: ‘memcpy’ was not declared in this scope
92 | memcpy(fileName, header.prefix, prefixLength);
| ^~~~~~
/home/cdurham/RTXDI/donut/src/core/vfs/TarFile.cpp:27:1: note: ‘memcpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
26 | #include <regex>
+++ |+#include <cstring>
27 |
/home/cdurham/RTXDI/donut/src/core/vfs/TarFile.cpp:98:17: error: ‘memcpy’ was not declared in this scope
98 | memcpy(fileName + prefixLength, header.name, nameLength);
| ^~~~~~
/home/cdurham/RTXDI/donut/src/core/vfs/TarFile.cpp:98:17: note: ‘memcpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
make[2]: *** [donut/CMakeFiles/donut_core.dir/build.make:230: donut/CMakeFiles/donut_core.dir/src/core/vfs/TarFile.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [donut/ShaderMake/CMakeFiles/ShaderMake.dir/build.make:90: donut/ShaderMake/CMakeFiles/ShaderMake.dir/src/ShaderMake.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:693: donut/ShaderMake/CMakeFiles/ShaderMake.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: *** [donut/CMakeFiles/donut_core.dir/build.make:202: donut/CMakeFiles/donut_core.dir/src/core/string_utils.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:469: donut/CMakeFiles/donut_core.dir/all] Error 2
If I add #include <cstring>
in the right places this error goes away.
Which compiler (version) are you using?
GCC - version 12.2.0
This should be fixed in e1bd8b4
Thanks for reporting the issue!