Skip to content

MAC OS x compilation issues #4

@pfreixes

Description

@pfreixes

Ive got some issues compiling RedisSearch in my MAC OS X Yosemite, first issue with the header to import all definitions regarding the malloc.h file and the second o one related with the u_short symbol definition. Next snippet displays the silly modifications made to overcome this issues.

diff --git a/src/rmutil/sdsalloc.h b/src/rmutil/sdsalloc.h
index 33ee741..1538fdf 100644
--- a/src/rmutil/sdsalloc.h
+++ b/src/rmutil/sdsalloc.h
@@ -36,7 +36,11 @@
  * the include of your alternate allocator if needed (not needed in order
  * to use the default libc allocator). */

+#if defined(__MACH__)
+#include <stdlib.h>
+#else
 #include <malloc.h>
+#endif
 //#include "zmalloc.h"
 #define s_malloc malloc
 #define s_realloc realloc
diff --git a/src/types.h b/src/types.h
index 13cde82..9d5be91 100644
--- a/src/types.h
+++ b/src/types.h
@@ -2,8 +2,12 @@
 #define __MDMA_TYPES_H__
 #include <stdlib.h>

+#if defined(__MACH__)
+#include <sys/types.h>
+#endif
+
 typedef u_int32_t t_docId;
 typedef u_int32_t t_offset;


-#endif
\ No newline at end of file
+#endif

Aside of this issue, just worth mentioning that default linker in MAC does not recognize the -Bsymbolic option. To address this issue use the original gcc command rather than the default one shipped with the MAC

$ brew install gcc48
$ export CC=/usr/local/Cellar/gcc48/4.8.4/bin/gcc-4.8
$ export LD=/usr/local/Cellar/gcc48/4.8.4/bin/gcc-4.8
$ make all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions