Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-44384: [C++] Use CMAKE_LIBTOOL on macOS #44385

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions cpp/cmake_modules/BuildUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,27 @@ function(arrow_create_merged_static_lib output_target)
endforeach()

if(APPLE)
# The apple-distributed libtool is what we want for bundling, but there is
# a GNU libtool that has a namecollision (and happens to be bundled with R, too).
# We are not compatible with GNU libtool, so we need to avoid it.

# check in the obvious places first to find Apple's libtool
# HINTS is used before system paths and before PATHS, so we use that
# even though hard coded paths should go in PATHS
# TODO: use a VALIDATOR when we require cmake >= 3.25
find_program(LIBTOOL_MACOS libtool HINTS /usr/bin
/Library/Developer/CommandLineTools/usr/bin)

# confirm that the libtool we found is not GNU libtool
if(CMAKE_LIBTOOL)
set(LIBTOOL_MACOS ${CMAKE_LIBTOOL})
else()
# The apple-distributed libtool is what we want for bundling, but there is
# a GNU libtool that has a namecollision (and happens to be bundled with R, too).
# We are not compatible with GNU libtool, so we need to avoid it.

# check in the obvious places first to find Apple's libtool
# HINTS is used before system paths and before PATHS, so we use that
# even though hard coded paths should go in PATHS
# TODO: use a VALIDATOR when we require cmake >= 3.25
find_program(LIBTOOL_MACOS libtool
HINTS /usr/bin /Library/Developer/CommandLineTools/usr/bin)
endif()

# confirm that the libtool we found is Apple's libtool
execute_process(COMMAND ${LIBTOOL_MACOS} -V
OUTPUT_VARIABLE LIBTOOL_V_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT "${LIBTOOL_V_OUTPUT}" MATCHES ".*cctools-([0-9.]+).*")
message(FATAL_ERROR "libtool found appears to be the incompatible GNU libtool: ${LIBTOOL_MACOS}"
message(FATAL_ERROR "libtool found appears not to be Apple's libtool: ${LIBTOOL_MACOS}"
)
endif()

Expand Down
Loading