napframework / nap

NAP Framework source code
https://nap-framework.tech
Mozilla Public License 2.0
404 stars 22 forks source link

Compile error with Clang 15 #19

Closed ceeac closed 9 months ago

ceeac commented 9 months ago

OS: Ubuntu 22.04 To reproduce, build with the following command:

mkdir build/ && cd build && cmake -GNinja -DCMAKE_C_COMPILER=clang-15 -DCMAKE_CXX_COMPILER=clang++-15 ..

This results in:

/home/ceeac/Projects/code/nap/utility/src/utility/stringutils.cpp:119:36: error: use of undeclared identifier 'strncmp'
                        compare_func = caseSensitive ? &strncmp : &strncasecmp;
                                                        ^
/home/ceeac/Projects/code/nap/utility/src/utility/stringutils.cpp:119:47: error: use of undeclared identifier 'strncasecmp'
                        compare_func = caseSensitive ? &strncmp : &strncasecmp;
                                                                   ^
/home/ceeac/Projects/code/nap/utility/src/utility/stringutils.cpp:121:63: error: use of undeclared identifier 'strlen'
                        return compare_func(inString.c_str(), inSubString.c_str(), strlen(inSubString.c_str())) == 0;
                                                                                   ^
/home/ceeac/Projects/code/nap/utility/src/utility/stringutils.cpp:136:36: error: use of undeclared identifier 'strncmp'
                        compare_func = caseSensitive ? &strncmp : &strncasecmp;
                                                        ^
/home/ceeac/Projects/code/nap/utility/src/utility/stringutils.cpp:136:47: error: use of undeclared identifier 'strncasecmp'
                        compare_func = caseSensitive ? &strncmp : &strncasecmp;
                                                                   ^
5 errors generated.
ninja: build stopped: subcommand failed.
cklosters commented 9 months ago

Hey, thanks for reporting this. We don't officially support Clang on Linux, only GCC. the fix looks rather straight forward though. If you get it to compile by including <cstring> and the fix passes build verification I am ok with merging it.

cklosters commented 9 months ago

I tried to reproduce your issue on Ubuntu 22.04 and 20.04 without success. I think this has to do with your installed version of stdc++, not Clang, GCC or Ubuntu. My steps:

Target compiles just fine. I am closing this because we don't support your target compiler and I can't reproduce the issue.