Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH v2] travis-ci: fixed Mojave mac build
@ 2019-03-12 14:40 Alexander V. Tikhonov
  2019-03-13 23:44 ` [tarantool-patches] " Alexander Turenko
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander V. Tikhonov @ 2019-03-12 14:40 UTC (permalink / raw)
  To: Alexander Turenko; +Cc: Alexander V. Tikhonov, tarantool-patches

Fixed Mojave Mac build with MACOSX_DEPLOYMENT_TARGET
environment setup. Specified the minimum version of OS X
on which the target binaries are to be deployed. CMake
uses this value for the make environment and the
-mmacosx-version-min flag to help choose the default SDK
Removed virtualenv for osx at all

Fixed #3797
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-3797-mojave-mac-build
Issue: https://github.com/tarantool/tarantool/issues/3797

 .travis.mk         | 10 +++-------
 .travis.yml        | 11 ++++++++---
 cmake/luajit.cmake | 15 ++++++++++++---
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/.travis.mk b/.travis.mk
index edd94cd7d..6e429735d 100644
--- a/.travis.mk
+++ b/.travis.mk
@@ -47,6 +47,8 @@ test_ubuntu: deps_ubuntu
 deps_osx:
 	brew update
 	brew install openssl readline curl icu4c --force
+	curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python
+	pip install -r test-run/requirements.txt
 
 test_osx: deps_osx
 	cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfoWError ${CMAKE_EXTRA_PARAMS}
@@ -57,13 +59,7 @@ test_osx: deps_osx
 	ulimit -S -n 20480 || :
 	ulimit -n
 	make -j8
-	virtualenv ./test-env && \
-	. ./test-env/bin/activate && \
-	curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python && \
-	pip --version && \
-	pip install -r test-run/requirements.txt && \
-	cd test && python test-run.py -j 1 unit/ app/ app-tap/ box/ box-tap/ && \
-	deactivate
+	cd test && python test-run.py -j 1 unit/ app/ app-tap/ box/ box-tap/
 
 coverage_ubuntu: deps_ubuntu
 	cmake . -DCMAKE_BUILD_TYPE=Debug -DENABLE_GCOV=ON
diff --git a/.travis.yml b/.travis.yml
index ffe2e8247..8a118a7f2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,7 @@ language: cpp
 os: linux
 compiler: gcc
 
-osx_image: xcode9
+osx_image: xcode10.2
 
 cache:
     directories:
@@ -24,11 +24,16 @@ jobs:
       - name: RelWithDebInfoWError build + test (Linux, clang)
         env: TARGET=test
         compiler: clang
-      - name: RelWithDebInfoWError build + test (OS X)
+      - name: RelWithDebInfoWError build + test (OS X Mojave 10.14)
         env: TARGET=test
         os: osx
       - name: Debug build + test + coverage (Linux, gcc)
         env: TARGET=coverage
+      - name: RelWithDebInfoWError build + test (OS X High Sierra 10.13)
+        env: TARGET=test
+        os: osx
+        osx_image: xcode9.4
+        if: branch = "2.1"
       - name: LTO build + test (Linux, gcc)
         env: TARGET=test CMAKE_EXTRA_PARAMS=-DENABLE_LTO=ON
         if: branch = "2.1"
@@ -36,7 +41,7 @@ jobs:
         env: TARGET=test CMAKE_EXTRA_PARAMS=-DENABLE_LTO=ON
         if: branch = "2.1"
         compiler: clang
-      - name: LTO build + test (OS X)
+      - name: LTO build + test (OS X Mojave 10.14)
         os: osx
         env: TARGET=test CMAKE_EXTRA_PARAMS=-DENABLE_LTO=ON
         if: branch = "2.1"
diff --git a/cmake/luajit.cmake b/cmake/luajit.cmake
index ea4878a93..e84fb21aa 100644
--- a/cmake/luajit.cmake
+++ b/cmake/luajit.cmake
@@ -196,10 +196,19 @@ macro(luajit_build)
         if ("${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "")
             # Default to 10.6 since @rpath support is NOT available in
             # earlier versions, needed by AddressSanitizer.
-            set (luajit_osx_deployment_target 10.6)
+            execute_process(COMMAND sw_vers -productVersion
+                OUTPUT_VARIABLE PRODUCT_VERSION)
+            message(STATUS "PRODUCT_VERSION=${PRODUCT_VERSION}")
+            if (${PRODUCT_VERSION} VERSION_LESS 10.14)
+                set (luajit_osx_deployment_target 10.6)
+            else ()
+                set (luajit_osx_deployment_target 10.14)
+            endif ()
         else()
             set (luajit_osx_deployment_target ${CMAKE_OSX_DEPLOYMENT_TARGET})
         endif()
+        set(macosx_deployment_target_env MACOSX_DEPLOYMENT_TARGET=${luajit_osx_deployment_target})
+        message(STATUS "${macosx_deployment_target_env}")
         set(luajit_ldflags
             ${luajit_ldflags} -Wl,-macosx_version_min,${luajit_osx_deployment_target})
     endif ()
@@ -238,7 +247,7 @@ macro(luajit_build)
         add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/third_party/luajit/src/libluajit.a
             WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/third_party/luajit
             COMMAND $(MAKE) ${luajit_buildoptions} clean
-            COMMAND $(MAKE) -C src ${luajit_buildoptions} jit/vmdef.lua libluajit.a
+            COMMAND ${macosx_deployment_target_env} $(MAKE) -C src ${luajit_buildoptions} jit/vmdef.lua libluajit.a
             DEPENDS ${CMAKE_SOURCE_DIR}/CMakeCache.txt
         )
     else()
@@ -249,7 +258,7 @@ macro(luajit_build)
             WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/third_party/luajit
             COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/third_party/luajit ${PROJECT_BINARY_DIR}/third_party/luajit
             COMMAND $(MAKE) ${luajit_buildoptions} clean
-            COMMAND $(MAKE) -C src ${luajit_buildoptions} jit/vmdef.lua libluajit.a
+            COMMAND ${macosx_deployment_target_env} $(MAKE) -C src ${luajit_buildoptions} jit/vmdef.lua libluajit.a
             DEPENDS ${PROJECT_BINARY_DIR}/CMakeCache.txt ${PROJECT_BINARY_DIR}/third_party/luajit
         )
     endif()
-- 
2.17.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tarantool-patches] Re: [PATCH v2] travis-ci: fixed Mojave mac build
  2019-03-12 14:40 [tarantool-patches] [PATCH v2] travis-ci: fixed Mojave mac build Alexander V. Tikhonov
@ 2019-03-13 23:44 ` Alexander Turenko
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Turenko @ 2019-03-13 23:44 UTC (permalink / raw)
  To: Alexander V. Tikhonov; +Cc: tarantool-patches

> travis-ci: fixed Mojave mac build

Nit: Use imperative mood in a commit header. See
https://tarantool.io/en/doc/1.10/dev_guide/developer_guidelines/#how-to-write-a-commit-message

The Travis-CI changes looks okay for me.

I have comments re CMake changes, see below. I added proposed changes on
top of your commit. Please, if you are agree, test them and squash.

Then, please, send the next version of the patch to one of maintainers.

WBR, Alexander Turenko.

> Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-3797-mojave-mac-build
> Issue: https://github.com/tarantool/tarantool/issues/3797
 
> --- a/cmake/luajit.cmake
> +++ b/cmake/luajit.cmake
> @@ -196,10 +196,19 @@ macro(luajit_build)
>          if ("${CMAKE_OSX_DEPLOYMENT_TARGET}" STREQUAL "")
>              # Default to 10.6 since @rpath support is NOT available in
>              # earlier versions, needed by AddressSanitizer.
> -            set (luajit_osx_deployment_target 10.6)
> +            execute_process(COMMAND sw_vers -productVersion
> +                OUTPUT_VARIABLE PRODUCT_VERSION)
> +            message(STATUS "PRODUCT_VERSION=${PRODUCT_VERSION}")
> +            if (${PRODUCT_VERSION} VERSION_LESS 10.14)
> +                set (luajit_osx_deployment_target 10.6)
> +            else ()
> +                set (luajit_osx_deployment_target 10.14)
> +            endif ()

According to [1] `make MACOSX_DEPLOYMENT_TARGET=10.6` is enough, so we
can get rid of this `if` and just set it always to 10.6.

[1]: https://github.com/LuaJIT/LuaJIT/issues/484

>          else()
>              set (luajit_osx_deployment_target ${CMAKE_OSX_DEPLOYMENT_TARGET})
>          endif()
> +        set(macosx_deployment_target_env MACOSX_DEPLOYMENT_TARGET=${luajit_osx_deployment_target})

We can add MACOSX_DEPLOYMENT_TARGET="${luajit_osx_deployment_target}" into
set(luajit_buildoptions ...) below instead.

> +        message(STATUS "${macosx_deployment_target_env}")
>          set(luajit_ldflags
>              ${luajit_ldflags} -Wl,-macosx_version_min,${luajit_osx_deployment_target})
>      endif ()
> @@ -238,7 +247,7 @@ macro(luajit_build)
>          add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/third_party/luajit/src/libluajit.a
>              WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/third_party/luajit
>              COMMAND $(MAKE) ${luajit_buildoptions} clean
> -            COMMAND $(MAKE) -C src ${luajit_buildoptions} jit/vmdef.lua libluajit.a
> +            COMMAND ${macosx_deployment_target_env} $(MAKE) -C src ${luajit_buildoptions} jit/vmdef.lua libluajit.a

No need to set provide env if we'll add it MACOSX_DEPLOYMENT_TARGET to
${luajit_buildoptions}. It looks simpler.

>              DEPENDS ${CMAKE_SOURCE_DIR}/CMakeCache.txt
>          )
>      else()
> @@ -249,7 +258,7 @@ macro(luajit_build)
>              WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/third_party/luajit
>              COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/third_party/luajit ${PROJECT_BINARY_DIR}/third_party/luajit
>              COMMAND $(MAKE) ${luajit_buildoptions} clean
> -            COMMAND $(MAKE) -C src ${luajit_buildoptions} jit/vmdef.lua libluajit.a
> +            COMMAND ${macosx_deployment_target_env} $(MAKE) -C src ${luajit_buildoptions} jit/vmdef.lua libluajit.a

The same.

>              DEPENDS ${PROJECT_BINARY_DIR}/CMakeCache.txt ${PROJECT_BINARY_DIR}/third_party/luajit
>          )
>      endif()
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-13 23:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12 14:40 [tarantool-patches] [PATCH v2] travis-ci: fixed Mojave mac build Alexander V. Tikhonov
2019-03-13 23:44 ` [tarantool-patches] " Alexander Turenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox