Skip to content

Commit d39c418

Browse files
committed
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 [email protected]
1 parent ae11182 commit d39c418

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ endif()
4444
if("${PLATFORM}" STREQUAL "DARWIN")
4545
set(ENABLE_LTO "OFF")
4646
set(ENABLE_ALL_IN_ONE "ON")
47+
set(JERRY_LIBC "OFF")
48+
set(JERRY_LIBM "OFF")
49+
set(COMPILER_DEFAULT_LIBC "ON")
50+
endif()
51+
52+
if(JERRY_LIBC AND COMPILER_DEFAULT_LIBC)
53+
message(FATAL_ERROR "JERRY_LIBC and COMPILER_DEFAULT_LIBC is enabled at the same time!")
4754
endif()
4855

4956
# Status messages
@@ -106,11 +113,6 @@ set(CMAKE_C_FLAGS_RELEASE "-Os")
106113
jerry_add_compile_flags(${FLAGS_COMMON_ARCH})
107114
jerry_add_flags(CMAKE_EXE_LINKER_FLAGS ${FLAGS_COMMON_ARCH})
108115

109-
# Use jerry libc
110-
if(JERRY_LIBC AND COMPILER_DEFAULT_LIBC)
111-
message(FATAL_ERROR "JERRY_LIBC and COMPILER_DEFAULT_LIBC is enabled at the same time!")
112-
endif()
113-
114116
# LTO
115117
if(ENABLE_LTO)
116118
jerry_add_compile_flags(-flto)

0 commit comments

Comments
 (0)