Xonotic Forums
[SOLVED] Can't compile under OS X Yosemite - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Support (https://forums.xonotic.org/forumdisplay.php?fid=3)
+--- Forum: Xonotic - Help & Troubleshooting (https://forums.xonotic.org/forumdisplay.php?fid=4)
+--- Thread: [SOLVED] Can't compile under OS X Yosemite (/showthread.php?tid=5440)



Can't compile under OS X Yosemite - BuddyFriendGuy - 04-17-2015

I've been using Arch Linux to compile the code and everything work. Today I tried to compile on OS X Yosemite and failed. OS X isn't my primary dev platform so I'm likely to have something basic missing. Can somebody test this as well?

I tried two setups and neither works for me. I ran
Code:
$ ./all compile

1. In the Apple dev environment (XCode + Command Line Tools), I got this error:

Code:
clang: error: optimization flag '-fno-reorder-blocks' is not supported

2. With home brew's gcc, I got this error:

Code:
In file included from hash.c:23:0:
gmqcc.h:130:66: error: operator '==' has no right operand
#       elif defined (BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)


Any ideas?


RE: Can't compile under OS X Yosemite - BuddyFriendGuy - 04-23-2015

I managed to get home brew gcc to compile it. I had to do two things:

1. Remove the empty variable LITTLE_ENDIAN in gmqcc/gmqcc.h that caused the problem.

Code:
$ cd gmqcc
$ git diff gmqcc.h
diff --git a/gmqcc.h b/gmqcc.h
index 43153e9..4130307 100644
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -127,8 +127,6 @@ GMQCC_IND_STRING(GMQCC_VERSION_PATCH) \
#           define PLATFORM_BYTE_ORDER GMQCC_BYTE_ORDER_LITTLE
#       elif !defined (LITTLE_ENDIAN) && defined (BIG_ENDIAN)
#           define PLATFORM_BYTE_ORDER GMQCC_BYTE_ORDER_BIG
-#       elif defined (BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
-#           define PLATFORM_BYTE_ORDER GMQCC_BYTE_ORDER_LITTLE
#       elif defined (BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN)
#           define PLATFORM_BYTE_ORDER GMQCC_BYTE_ORDER_BIG
#       endif /*! defined (LITTLE_ENDIAN) && !defined(BIG_ENDIAN) */

2. Fix the dispatch library header (/usr/include/dispatch/object.h) to work with CLANG, according to this solution:

Code:
$ diff /usr/include/dispatch/object.h object.h.original
143d142
< #ifdef __clang__
145,147d143
< #else
< typedef void* dispatch_block_t;
< #endif