From e7977ad217d5b5d0c2b035eec89ba6632722b8eb Mon Sep 17 00:00:00 2001 From: Roman Tsisyk <roman@tsisyk.com> Date: Wed, 10 Apr 2013 18:22:24 +0400 Subject: [PATCH] Fixes for OS X --- CMakeLists.txt | 12 +++++++++--- README.MacOSX | 15 ++++----------- client/tarantool/tc_store.c | 2 ++ cmake/{cpack.cmake => package.cmake} | 0 connector/c/include/tp.h | 7 +++++++ connector/c/tnt/CMakeLists.txt | 4 +++- src/box/bitset_index.m | 2 +- src/box/box_lua.m | 2 +- src/box/index.m | 2 +- src/box/space.m | 3 +++ 10 files changed, 31 insertions(+), 18 deletions(-) rename cmake/{cpack.cmake => package.cmake} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 134cc78895..622b5d30b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,7 +185,9 @@ if (ENABLE_STATIC) endif() # Compile with builtin libgcc by default. -add_compile_flags("C;CXX;OBJC;OBJCXX" "-static-libgcc") +if (NOT TARGET_OS_DARWIN) + add_compile_flags("C;CXX;OBJC;OBJCXX" "-static-libgcc") +endif() ## ## Third-Party libraries @@ -209,7 +211,11 @@ include(luajit) # # LibOBJC # -option(ENABLE_BUNDLED_LIBOBJC "Enable building of the bundled libobjc" ON) +set (ENABLE_BUNDLED_LIBOBJC_DEFAULT ON) +if (TARGET_OS_DARWIN) +set (ENABLE_BUNDLED_LIBOBJC_DEFAULT OFF) +endif() +option(ENABLE_BUNDLED_LIBOBJC "Enable building of the bundled libobjc" ${ENABLE_BUNDLED_LIBOBJC_DEFAULT}) if (ENABLE_BUNDLED_LIBOBJC) include(BuildLibOBJC) @@ -309,7 +315,7 @@ add_subdirectory(doc) install (FILES README.md LICENSE doc/box-protocol.txt DESTINATION share/doc/tarantool) -include (cmake/cpack.cmake) +include (cmake/package.cmake) # tarantool info summary (used in server version output) # diff --git a/README.MacOSX b/README.MacOSX index b0c378b5b5..7a21424214 100644 --- a/README.MacOSX +++ b/README.MacOSX @@ -7,13 +7,7 @@ First of all, make sure mac ports are available (to install packages from). port install autoconf binutils cmake ncurses zlib readline -2. Install gcc 4.6.x and gcc infrastructure pre-requisites -------------- -(x) Install gcc/g++ 4.6.x from mac ports (port install gcc46); the respective compiler(s) will be named gcc-mp-4.6, g++-mp-4.6; -(x) Set up the environment to include the new GCC's libs: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/local/lib - - -3. Install necessary python modules: pexpect, pyYAML, daemon +2. Install necessary python modules: pexpect, pyYAML, daemon ------------- NB: it is recommended to install python modules through setup.py, using the default python (which should be >= 2.6.x and < 3.x); @@ -25,16 +19,15 @@ sudo python setup.py install where module is the name of the installed module and module-dir is the name of the directory the module's archive deflates into. -4. Download & build tarantool source code: +3. Download & build tarantool source code: ------------- git clone git://github.com/mailru/tarantool.git cd tarantool -CC=gcc-mp-4.6 CXX=g++-mp-4.6 cmake . -DCMAKE_BUILD_TYPE=RelWithDebugInfo -DENABLE_CLIENT=true -CC=gcc-mp-4.6 make +CC=clang CXX=clang++ cmake . -DCMAKE_BUILD_TYPE=RelWithDebugInfo -DENABLE_CLIENT=true -5. Run tarantool test suite +4. Run tarantool test suite ------------- NB: the following tests are not runnable on MacOS X at this point: diff --git a/client/tarantool/tc_store.c b/client/tarantool/tc_store.c index 93fb58abef..dd5a40563f 100644 --- a/client/tarantool/tc_store.c +++ b/client/tarantool/tc_store.c @@ -202,6 +202,8 @@ int tc_store_cat(void) case TNT_LOG_NONE: rc = 1; break; + default: + return -1; } if (rc == 0 && print_headers) { fwrite(&tnt_log_marker_eof_v11, diff --git a/cmake/cpack.cmake b/cmake/package.cmake similarity index 100% rename from cmake/cpack.cmake rename to cmake/package.cmake diff --git a/connector/c/include/tp.h b/connector/c/include/tp.h index ae573a1f01..3e43e34d9b 100644 --- a/connector/c/include/tp.h +++ b/connector/c/include/tp.h @@ -51,7 +51,14 @@ extern "C" { #define tp_packed __attribute__((packed)) #define tp_inline __attribute__((forceinline)) #define tp_noinline __attribute__((noinline)) +#if defined(__GNUC__) +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) #define tp_hot __attribute__((hot)) +#endif +#endif +#if !defined(tp_hot) +#define tp_hot +#endif #define tp_likely(expr) __builtin_expect(!! (expr), 1) #define tp_unlikely(expr) __builtin_expect(!! (expr), 0) diff --git a/connector/c/tnt/CMakeLists.txt b/connector/c/tnt/CMakeLists.txt index faa8d65cdd..a343915f1d 100644 --- a/connector/c/tnt/CMakeLists.txt +++ b/connector/c/tnt/CMakeLists.txt @@ -47,7 +47,9 @@ set (tnt_sources string(REPLACE "-static-libgcc" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") string(REPLACE "-static" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") -set (tnt_cflags "${tnt_cflags} -static-libgcc") +if (NOT TARGET_OS_DARWIN) + set (tnt_cflags "${tnt_cflags} -static-libgcc") +endif() # # Static library diff --git a/src/box/bitset_index.m b/src/box/bitset_index.m index 915fddf197..b4ee447234 100644 --- a/src/box/bitset_index.m +++ b/src/box/bitset_index.m @@ -199,7 +199,7 @@ bitset_index_iterator_next(struct iterator *iterator) - (struct tuple *) replace: (struct tuple *) old_tuple : (struct tuple *) new_tuple - : (u32) flags + : (enum dup_replace_mode) flags { assert(!key_def->is_unique); assert(old_tuple != NULL || new_tuple != NULL); diff --git a/src/box/box_lua.m b/src/box/box_lua.m index 2d7ec70466..212b6ccc57 100644 --- a/src/box/box_lua.m +++ b/src/box/box_lua.m @@ -1457,7 +1457,7 @@ luaL_packvalue(struct lua_State *L, luaL_Buffer *b, int index) } default: luaL_error(L, "box.pack: unsupported type"); - break; + return; } luaL_addvarint32(b, size); luaL_addlstring(b, str, size); diff --git a/src/box/index.m b/src/box/index.m index 1714daec4a..3e066376f2 100644 --- a/src/box/index.m +++ b/src/box/index.m @@ -221,7 +221,7 @@ replace_check_dup(struct tuple *old_tuple, - (void) initIterator: (struct iterator *) iterator :(enum iterator_type) type - :(void *) key :(u32) part_count + :(const void *) key :(u32) part_count { (void) iterator; (void) type; diff --git a/src/box/space.m b/src/box/space.m index 4716333b1b..ba19094523 100644 --- a/src/box/space.m +++ b/src/box/space.m @@ -154,6 +154,9 @@ space_replace(struct space *sp, struct tuple *old_tuple, } @throw; } + + assert(false); + return NULL; } void -- GitLab