build: onigmo: macos: Specify -isysroot on CC to tell C headers location
Also, CMake settings to build onigmo has missing standard library's
header issues.
This should be fixed by specifying -isysroot argument to tell C headers
location.
This fix is needed since macOS Mojave SDK.
@@ -17,6 +17,14 @@ else()
set(ONIGMO_ARCH "x86")
endif()
+if (CMAKE_OSX_SYSROOT)
+ # From macOS Mojave, /usr/include does not store C SDK headers.
+ # For libbacktrace building on macOS, we have to tell C headers where they are located.
+ set(DEPS_C_COMPILER "${CMAKE_C_COMPILER} -isysroot ${CMAKE_OSX_SYSROOT}")
+else()
+ set(DEPS_C_COMPILER "${CMAKE_C_COMPILER}")
+endif()
+
# Onigmo (UNIX)
# =============
if(FLB_SMALL)
@@ -27,7 +35,7 @@ ExternalProject_Add(onigmo
INSTALL_DIR ${ONIGMO_DEST}
CONFIGURE_COMMAND ./configure ${AUTOCONF_HOST_OPT} --host=${HOST} --with-pic --disable-shared --enable-static --prefix=${ONIGMO_DEST}
CFLAGS=-std=gnu99\ -Wall\ -pipe\ -Os\ -g0\ -s\ -fno-stack-protector\ -fomit-frame-pointer\ -DNDEBUG\ -U_FORTIFY_SOURCE
- BUILD_COMMAND $(MAKE) CC=${CMAKE_C_COMPILER}
+ BUILD_COMMAND $(MAKE) CC=${DEPS_C_COMPILER}
INSTALL_COMMAND $(MAKE) DESTDIR= install)
else()
ExternalProject_Add(onigmo
@@ -37,7 +45,7 @@ ExternalProject_Add(onigmo
INSTALL_DIR ${ONIGMO_DEST}
CONFIGURE_COMMAND ./configure ${AUTOCONF_HOST_OPT} --host=${HOST} --with-pic --disable-shared --enable-static --prefix=${ONIGMO_DEST}
CFLAGS=-std=gnu99\ -Wall\ -pipe\ -g3\ -O3\ -funroll-loops
- BUILD_COMMAND $(MAKE) CC=${CMAKE_C_COMPILER}
+ BUILD_COMMAND $(MAKE) CC=${DEPS_C_COMPILER}
INSTALL_COMMAND $(MAKE) DESTDIR= install)
endif()
