I discovered this some time ago with latest and greatest docker images for Alpine at the time, but procrastinated in resolving the issue, because of more pressing matters. But, I think more updates for distributions are now including cmake 3.26 and so the build errors need to be addressed:
Running cmake -S . -B build/cmake/
Running cmake --build build/cmake/
In file included from /usr/include/apr-1/apr_general.h:28,
from /afw/src/afw/include/afw_common.h:53,
from /afw/src/afw/version/afw_version.h:12,
from /afw/src/afw/include/afw_minimal.h:29,
from /afw/src/afw/include/afw.h:13,
from /afw/src/afw/include/afw_internal.h:23,
from /afw/src/afw/action/afw_action.c:14:
/usr/include/apr-1/apr.h:632:2: error: #error no decision has been made on APR_PATH_MAX for your platform
632 | #error no decision has been made on APR_PATH_MAX for your platform
| ^~~~~
In file included from /afw/src/afw/include/afw.h:76,
from /afw/src/afw/include/afw_internal.h:23,
from /afw/src/afw/action/afw_action.c:14:
/afw/src/afw/utf8/afw_utf8.h: In function ‘afw_utf8_z_equal_ignore_case’:
/afw/src/afw/utf8/afw_utf8.h:824:13: error: implicit declaration of function ‘strcasecmp’; did you mean ‘strncmp’? [-Werror=implicit-function-declaration]
824 | return (strcasecmp((const char *)s1, (const char *)s2) == 0) ? true : false;
| ^~~~~~~~~~
| strncmp
cc1: all warnings being treated as errors
When building applications using --std=c11, which we do in order to support atomics, there are many functions that are not included by default, as they may be a part of other standards, such as POSIX. One example of this is the strcasecmp function. A hello world example illustrates this:
To compile successfully, we can use cc -o test test.c.
However, if we specify the c11 standard, we get compile errors:
# cc --std=c11 -o test test.c
test.c: In function ‘main’:
test.c:9:29: error: ‘PATH_MAX’ undeclared (first use in this function)
9 | printf("PATH_MAX = %d\n", PATH_MAX);
| ^~~~~~~~
test.c:9:29: note: each undeclared identifier is reported only once for each function it appears in
test.c:11:3: warning: implicit declaration of function ‘strcasecmp’; did you mean ‘strncmp’? [-Wimplicit-function-declaration]
11 | strcasecmp("abc", "ABC");
| ^~~~~~~~~~
| strncmp
This can be fixed by declaring the C macro _DEFAULT_SOURCE:
It sets a few other macros, which allow system include headers to include other headers in order to provide some built-in "features" to be included in your compile.
CMake must have provided us some of these feature macros by default, prior to 3.26, but now no longer does.
I discovered this some time ago with latest and greatest docker images for Alpine at the time, but procrastinated in resolving the issue, because of more pressing matters. But, I think more updates for distributions are now including
cmake 3.26
and so the build errors need to be addressed:When building applications using
--std=c11
, which we do in order to support atomics, there are many functions that are not included by default, as they may be a part of other standards, such as POSIX. One example of this is thestrcasecmp
function. A hello world example illustrates this:To compile successfully, we can use
cc -o test test.c
.However, if we specify the
c11
standard, we get compile errors:This can be fixed by declaring the C macro
_DEFAULT_SOURCE
:The
_DEFAULT_SOURCE
is a super macro of sorts, described here: https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.htmlIt sets a few other macros, which allow system include headers to include other headers in order to provide some built-in "features" to be included in your compile.
CMake must have provided us some of these feature macros by default, prior to 3.26, but now no longer does.