Cannot compile on non-glibc POSIX systems: sys/cdefs.h is a glibc-specific header
vidraj opened this issue · comments
The file fc-solve/source/sys/tree.h
contains an include of sys/cdefs.h
, which is a GNU-C-library-internal header that should not be used in external code:
fc-solve/fc-solve/source/sys/tree.h
Line 33 in 90163fe
Because of this, fc-solve cannot be compiled e.g. on systems using the musl libc, which doesn't expose this header. Compilation fails with the following error:
FAILED: CMakeFiles/split_fcc_fc_solver.dir/split_fcc_solver.c.o
/usr/bin/powerpc-gentoo-linux-musl-gcc -DFCS_COMPILE_DEBUG_FUNCTIONS=1 -DFCS_DBM_RECORD_POINTER_REPR=1 -DFCS_DBM_USE_LIBAVL=1 -DFCS_DBM_WITHOUT_CACHES=1 -DFCS_DBM__VAL_IS_ANCESTOR=1 -DFCS_DEBONDT_DELTA_STATES=1 -DFCS_LIBAVL_STORE_WHOLE_KEYS=1 -DFCS_SPLIT_FCC_SOLVER=1 -DXXH_CPU_LITTLE_ENDIAN=0 -D_GNU_SOURCE="1 -D_PO
SIX_C_SOURCE=200809L" -I/var/tmp/portage/dev-games/freecell-solver-6.8.0/work/freecell-solver-6.8.0/fcs-libavl -I/var/tmp/portage/dev-games/freecell-solver-6.8.0/work/freecell-solver-6.8.0_build -I/var/tmp/portage/dev-games/freecell-solver-6.8.0/work/freecell-solver-6.8.0_build/include -I/var/tmp/portage/dev-games/
freecell-solver-6.8.0/work/freecell-solver-6.8.0 -I/var/tmp/portage/dev-games/freecell-solver-6.8.0/work/freecell-solver-6.8.0/include -I/var/tmp/portage/dev-games/freecell-solver-6.8.0/work/freecell-solver-6.8.0/patsolve/patsolve/include -I/var/tmp/portage/dev-games/freecell-solver-6.8.0/work/freecell-solver-6.8.0
/patsolve/patsolve -I/var/tmp/portage/dev-games/freecell-solver-6.8.0/work/freecell-solver-6.8.0/xxHash-wrapper -I/var/tmp/portage/dev-games/freecell-solver-6.8.0/work/freecell-solver-6.8.0/xxHash-wrapper/xxHash-0.8.1 -O2 -ggdb -mcpu=7450 -mvrsave -pipe -std=gnu11 -Wall -Werror=implicit-function-declaration -Wol
d-style-declaration -Wmissing-prototypes -Wformat-nonliteral -Wcast-align -Wpointer-arith -Wbad-function-cast -Wstrict-prototypes -Wmissing-declarations -Wundef -Wnested-externs -Wcast-qual -Wshadow -Wwrite-strings -Wunused -Wold-style-definition -fvisibility=hidden -MD -MT CMakeFiles/split_fcc_fc_solver.dir/split_
fcc_solver.c.o -MF CMakeFiles/split_fcc_fc_solver.dir/split_fcc_solver.c.o.d -o CMakeFiles/split_fcc_fc_solver.dir/split_fcc_solver.c.o -c /var/tmp/portage/dev-games/freecell-solver-6.8.0/work/freecell-solver-6.8.0/split_fcc_solver.c
In file included from /var/tmp/portage/dev-games/freecell-solver-6.8.0/work/freecell-solver-6.8.0/split_fcc_solver.c:18:
/var/tmp/portage/dev-games/freecell-solver-6.8.0/work/freecell-solver-6.8.0/sys/tree.h:33:10: fatal error: sys/cdefs.h: No such file or directory
33 | #include <sys/cdefs.h>
| ^~~~~~~~~~~~~
compilation terminated.
As far as I can see, the header is unused and removing the include allows the program to compile successfully.