From d39c4187fb9872b51fb779f258cb09c231c56250 Mon Sep 17 00:00:00 2001 From: Akos Kiss Date: Tue, 9 Aug 2016 23:56:02 +0200 Subject: [PATCH] Fix the OSX build Apple does not support staticaly built applications on OSX, and all dynamically built apps have to be linked against the System lib (i.e., `-static` should not be used and `-lSystem` is a must). As System contains all libc and libm functions, building (and linking) the minimal jerry-libc and jerry-libm libs makes no sense. Moreover, if JERRY_LIBC is ON, the compiler will use the jerry-libc headers but will link the libc functions from System, which causes heavy confusion and segfaults at run time. Thus, this patch changes the build system to disable the building of jerry-libc and jerry-libm, and enables the use of system libraries when building on OSX. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu --- CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 618301d77..e90df6cb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,13 @@ endif() if("${PLATFORM}" STREQUAL "DARWIN") set(ENABLE_LTO "OFF") set(ENABLE_ALL_IN_ONE "ON") + set(JERRY_LIBC "OFF") + set(JERRY_LIBM "OFF") + set(COMPILER_DEFAULT_LIBC "ON") +endif() + +if(JERRY_LIBC AND COMPILER_DEFAULT_LIBC) + message(FATAL_ERROR "JERRY_LIBC and COMPILER_DEFAULT_LIBC is enabled at the same time!") endif() # Status messages @@ -106,11 +113,6 @@ set(CMAKE_C_FLAGS_RELEASE "-Os") jerry_add_compile_flags(${FLAGS_COMMON_ARCH}) jerry_add_flags(CMAKE_EXE_LINKER_FLAGS ${FLAGS_COMMON_ARCH}) -# Use jerry libc -if(JERRY_LIBC AND COMPILER_DEFAULT_LIBC) - message(FATAL_ERROR "JERRY_LIBC and COMPILER_DEFAULT_LIBC is enabled at the same time!") -endif() - # LTO if(ENABLE_LTO) jerry_add_compile_flags(-flto)