Cdefs.h not found during compile on some packages, but file exists on system

Hi

I have EOS on my Pinebook Pro. I’ve been having issues compiling some software from yay. Granted, these are packages which say “architecture not supported, try anyway?”, but this seems like possibly a fixable problem. The compiler pukes and says cdefs.h not found, but the file does exist on my system in multiple places. I believe it comes from the libbsd package, which is installed.

I’ve run into the issue with a few different packages now. I lost track of the others, but libretro-bnes is one that you can use to reproduce.

==> Making package: libretro-bnes 1:67-1 (Thu 21 Oct 2021 07:31:18 PM CDT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Starting pkgver()...
==> Removing existing $pkgdir/ directory...
==> Starting build()...
g++ -O3 -DNDEBUG -fomit-frame-pointer -fno-tree-vectorize -I. -fPIC -DGIT_VERSION=\"" 8e26e89"\" -c nes/interface/interface.cpp -o obj/nes-interface.o
In file included from /usr/include/c++/10.2.0/aarch64-unknown-linux-gnu/bits/os_defines.h:39,
                 from /usr/include/c++/10.2.0/aarch64-unknown-linux-gnu/bits/c++config.h:518,
                 from /usr/include/c++/10.2.0/limits:42,
                 from ./nall/platform.hpp:15,
                 from ./nes/nes.hpp:20,
                 from nes/interface/interface.cpp:1:
/usr/include/features.h:465:12: fatal error: sys/cdefs.h: No such file or directory
  465 | #  include <sys/cdefs.h>
      |            ^~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:128: obj/nes-interface.o] Error 1
==> ERROR: A failure occurred in build().
    Aborting...
 -> error making: libretro-bnes

cdefs.h exists

$ locate cdefs.h
/usr/include/ldap_cdefs.h
/usr/include/bsd/sys/cdefs.h
/usr/include/unistring/cdefs.h

Any idea if I can get around this issue?

It’s very interesting that your locate command did not find cdefs.h in /usr/include/sys (from the glibc package). What does find /usr -name cdefs.h return?

It’s in /usr/include/bsd/sys

$ sudo find /usr -name cdefs.h
/usr/include/unistring/cdefs.h
/usr/include/bsd/sys/cdefs.h

Out of curiosity, I symlinked cdefs.h in /usr/include/sys and that worked and printed the next error:

<a whole lot of errors>

/usr/include/bits/mathcalls.h:389:1: error: pasting ")" and "f64x" does not give a valid preprocessing token
  389 | __MATHCALL (getpayload,, (const _Mdouble_ *__x));
      | ^~~~~~~~~~
In file included from /usr/include/c++/10.2.0/bits/std_abs.h:38,
                 from /usr/include/c++/10.2.0/cmath:47,
                 from /usr/include/c++/10.2.0/math.h:36,
                 from ./nall/platform.hpp:19,
                 from ./nes/nes.hpp:20,
                 from nes/interface/interface.cpp:1:
/usr/include/stdlib.h:394:11: fatal error: sys/types.h: No such file or directory
  394 | # include <sys/types.h> /* we need int32_t... */
      |           ^~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:128: obj/nes-interface.o] Error 1
==> ERROR: A failure occurred in build().
    Aborting...
 -> error making: libretro-bnes

I have a feeling this package was never designed with ARM in mind. I would contact the dev and see if there’s a workaround.