Redefined "_POSIX_C_SOURCE" Error
jcharlong opened this issue · 1 comments
jcharlong commented
I've ran into the following error when compiling the project from source:
In file included from /tmp/hlappimageci/appdirs/hl1001.AppDir/usr/include/python3.7m/Python.h:8:0,
from cbitstruct/_cbitstruct.c:8:
/tmp/hlappimageci/appdirs/hl1001.AppDir/usr/include/python3.7m/pyconfig.h:1522:0: error: "_POSIX_C_SOURCE" redefined [-Werror]
#define _POSIX_C_SOURCE 200809L
In file included from /usr/include/aarch64-linux-gnu/bits/libc-header-start.h:33:0,
from /usr/include/limits.h:26,
from /usr/lib/gcc/aarch64-linux-gnu/7/include-fixed/limits.h:194,
from /usr/lib/gcc/aarch64-linux-gnu/7/include-fixed/syslimits.h:7,
from /usr/lib/gcc/aarch64-linux-gnu/7/include-fixed/limits.h:34,
from cbitstruct/_cbitstruct.c:1:
/usr/include/features.h:294:0: note: this is the location of the previous definition
# define _POSIX_C_SOURCE 199506L
The error can be resolved by shifting the order of the headers in cbitstruct/_cbitstruct.c
, so that #include <Python.h>
appears before #include <limits.h>
.
limits.h
will define _POSIX_C_SOURCE
if it is left undefined, but will instead use the pre-defined value if there is one. A quick search about this leads me to believe it's a fairly common occurrence & that re-organizing the headers is the correct solution.