Bug #314
offenGwenhywfar 5.12.0 fails to build on macOS
Beschreibung
In file included from /Users/john/Development/Gnucash-git-11-arm64/src/gwenhywfar-5.12.0/src/msgio/msg.c:22:
../../gwenhywfar5/gwenhywfar/endianfns.h:43:12: fatal error: 'endian.h' file not found
43 | # include <endian.h>
| ^~~~~~~~
Because on macOS it's <machine/endian.h>. But that's not good enough because macOS doesn't provide the functions you want from it. With the include patched:
/Users/john/Development/Gnucash-git-11-arm64/src/gwenhywfar-5.12.0/src/msgio/msg.c:227:12: error: call to undeclared function 'htole64'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
227 | *ptr=GWEN_ENDIAN_HTOLE64(v);
| ^
../../gwenhywfar5/gwenhywfar/endianfns.h:55:34: note: expanded from macro 'GWEN_ENDIAN_HTOLE64'
55 | # define GWEN_ENDIAN_HTOLE64(x) htole64(x)
| ^
/Users/john/Development/Gnucash-git-11-arm64/src/gwenhywfar-5.12.0/src/msgio/msg.c:248:12: error: call to undeclared function 'htole32'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
248 | *ptr=GWEN_ENDIAN_HTOLE32(v);
| ^
../../gwenhywfar5/gwenhywfar/endianfns.h:52:34: note: expanded from macro 'GWEN_ENDIAN_HTOLE32'
52 | # define GWEN_ENDIAN_HTOLE32(x) htole32(x)
| ^
/Users/john/Development/Gnucash-git-11-arm64/src/gwenhywfar-5.12.0/src/msgio/msg.c:269:12: error: call to undeclared function 'htole16'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
269 | *ptr=GWEN_ENDIAN_HTOLE16(v);
| ^
../../gwenhywfar5/gwenhywfar/endianfns.h:49:34: note: expanded from macro 'GWEN_ENDIAN_HTOLE16'
49 | # define GWEN_ENDIAN_HTOLE16(x) htole16(x)
| ^
/Users/john/Development/Gnucash-git-11-arm64/src/gwenhywfar-5.12.0/src/msgio/msg.c:595:14: error: call to undeclared function 'le64toh'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
595 | return GWEN_ENDIAN_LE64TOH(*ptr);
| ^
../../gwenhywfar5/gwenhywfar/endianfns.h:54:34: note: expanded from macro 'GWEN_ENDIAN_LE64TOH'
54 | # define GWEN_ENDIAN_LE64TOH(x) le64toh(x)
| ^
/Users/john/Development/Gnucash-git-11-arm64/src/gwenhywfar-5.12.0/src/msgio/msg.c:609:14: error: call to undeclared function 'le32toh'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
609 | return GWEN_ENDIAN_LE32TOH(*ptr);
| ^
../../gwenhywfar5/gwenhywfar/endianfns.h:51:34: note: expanded from macro 'GWEN_ENDIAN_LE32TOH'
51 | # define GWEN_ENDIAN_LE32TOH(x) le32toh(x)
| ^
/Users/john/Development/Gnucash-git-11-arm64/src/gwenhywfar-5.12.0/src/msgio/msg.c:623:14: error: call to undeclared function 'le16toh'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
623 | return GWEN_ENDIAN_LE16TOH(*ptr);
| ^
../../gwenhywfar5/gwenhywfar/endianfns.h:48:34: note: expanded from macro 'GWEN_ENDIAN_LE16TOH'
/*
Von jralls@ceridwen.us vor 7 Monaten aktualisiert
- Thema wurde von Gwenhywfar 5.6.0 fails to build on macOS zu Gwenhywfar 5.12.0 fails to build on macOS geändert
- AqBanking-Version wurde von 6.12.0 zu 6.6.0 geändert
The simplest fix is
--- src/base/endianfns.h~ 2017-08-07 12:02:11
+++ src/base/endianfns.h 2024-12-29 11:32:35@ -28,7 +28,7
@
#include <gwenhywfar/gwenhywfarapi.h>
-#if GWENHYWFAR_SYS_IS_WINDOWS
+#if GWENHYWFAR_SYS_IS_WINDOWS || defined APPLE
/* assume little endian for now (is there any big endian Windows system??) */
# define GWEN_ENDIAN_LE16TOH(x) (x)
# define GWEN_ENDIAN_HTOLE16(x) (x)
The very old PowerPC architecture was big endian but I don't think you need to worry about that, the last one shipped almost 15 years ago.
You might consider this Stack Overflow recommendation to use htonl/ntoh1 etc. instead: https://stackoverflow.com/a/12648491 as those are more widely supported and you wouldn't need the #if at all.
Von ipwizard vor 7 Monaten aktualisiert
- Status wurde von New zu Resolved geändert
This is already fixed in the git repo (master branch).
commit 55d4b7b526df30e4003c92e2f504f480c01021f0 (HEAD -> master, origin/master, origin/HEAD)
Author: Thomas Baumgart <thb@net-bembel.de>
Date: Wed Dec 25 15:43:00 2024 +0100
Fix compilation under MacOS