Wrong headers in `libqcdm` for macOS
Neither endian.h
nor malloc.h
exist on macOS, so build fails on those:
../ModemManager-1.22.0/libqcdm/src/commands.c:20:10: fatal error: 'endian.h' file not found
#include <endian.h>
^~~~~~~~~~
1 error generated.
. . .
../ModemManager-1.22.0/libqcdm/src/utils.c:21:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
^~~~~~~~~~
1 error generated.
While there is machine/endian.h
, it does not really serve the purpose here, since needed macros are not defined there.
Instead, libkern
macros can be used, like in: https://gist.github.com/yinyin/2027912
BTW, here even Linux header is forgotten:
../ModemManager-1.22.0/src/mm-port-serial-qcdm.c:327:34: error: implicit declaration of function 'le16toh' [-Werror,-Wimplicit-function-declaration]
if (handler->log_code != le16toh (log_cmd->log_code))
^
../ModemManager-1.22.0/src/mm-port-serial-qcdm.c:327:31: warning: comparison of integers of different signs: 'guint' (aka 'unsigned int') and 'int' [-Wsign-compare]
if (handler->log_code != le16toh (log_cmd->log_code))
~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
Correct include for malloc
is malloc/malloc.h
.
Elsewhere Linux-only headers are included unconditionally:
../ModemManager-1.22.0/src/mm-netlink.c:20:10: fatal error: 'linux/netlink.h' file not found
#include <linux/netlink.h>
^~~~~~~~~~~~~~~~~
1 error generated.
. . .
../ModemManager-1.22.0/src/mm-port-serial.c:29:10: fatal error: 'linux/serial.h' file not found
#include <linux/serial.h>
^~~~~~~~~~~~~~~~
1 error generated.