Lameguy64 / mkpsxiso

ISO disc image maker written specifically for PlayStation homebrew development
GNU General Public License v2.0
223 stars 36 forks source link

fix stat64 build errors on apple silicon #33

Closed retro-git closed 1 year ago

annestrand commented 1 year ago

Ha ran into this on my end too (glad I checked the PRs before pushing mine).

I found that this is intrinsic to ARM-based Macs only: https://github.com/apple/darwin-xnu/blob/xnu-7195.121.3/bsd/sys/cdefs.h#L613

So perhaps we want to also check for that? Here was what my PR would have been if I pushed.

#ifdef _WIN32
#define stat64 _stat64
#define PRFILESYSTEM_PATH "ls"
+#elif defined(__APPLE__) && defined(__arm64__)
+// __DARWIN_ONLY_64_BIT_INO_T is set on ARM-based Macs (which then sets __DARWIN_64_BIT_INO_T).
+// This sets the following in Apple SDK's stat.h: struct stat __DARWIN_STRUCT_STAT64;
+// So use stat over stat64 for ARM-based Macs
+#define stat64 stat
+#define PRFILESYSTEM_PATH "s"
#else
#define PRFILESYSTEM_PATH "s"
#endif

Can either use above or add a check for __arm64__ in your existing PR (fine with either) 👍

CookiePLMonster commented 1 year ago

Heads up, I'm going to merge it immediately after #40.