Skip to content

Commit

Permalink
[lto] Make sure to use lipo from the toolchain ${SWIFT_DARWIN_XCRUN_T…
Browse files Browse the repository at this point in the history
…OOLCHAIN}.

Otherwise, we may get lipo from the wrong toolchain and it may not be
able to understand all of the architectures/bit code we are lipoing
together yielding an unknown architecture error.

rdar://24717107
  • Loading branch information
gottesmm committed May 1, 2016
1 parent 4613b17 commit e5ce27c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,10 @@ else()
endif()

# lipo is used to create universal binaries.
find_program(LIPO "lipo")
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
include(SwiftDarwin)
find_toolchain_tool(LIPO "${SWIFT_DARWIN_XCRUN_TOOLCHAIN}" lipo)
endif()

if("${SWIFT_NATIVE_LLVM_TOOLS_PATH}" STREQUAL "")
set(SWIFT_CROSS_COMPILING FALSE)
Expand Down
7 changes: 7 additions & 0 deletions cmake/modules/SwiftDarwin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@ function(get_default_toolchain_dir result_var_name)
set("${result_var_name}" "${toolchain_dir}" PARENT_SCOPE)
endfunction()

function(find_toolchain_tool result_var_name toolchain tool)
execute_process(
COMMAND "xcrun" "--toolchain" "${toolchain}" "--find" "${tool}"
OUTPUT_VARIABLE tool_path
OUTPUT_STRIP_TRAILING_WHITESPACE)
set("${result_var_name}" "${tool_path}" PARENT_SCOPE)
endfunction()

0 comments on commit e5ce27c

Please sign in to comment.