-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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-40248: [R] fallback to the correct libtool when we find a GNU one #40259
Changes from 5 commits
50a64a7
77188a0
87fa3b7
19461ca
a62b889
bbd9959
150deb0
e1cac51
ee8e590
a98893a
97bd2aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -97,7 +97,30 @@ function(arrow_create_merged_static_lib output_target) | |||||||||||||||||
endforeach() | ||||||||||||||||||
|
||||||||||||||||||
if(APPLE) | ||||||||||||||||||
set(BUNDLE_COMMAND "libtool" "-no_warning_for_no_symbols" "-static" "-o" | ||||||||||||||||||
# 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. | ||||||||||||||||||
# TODO: use a VALIDATOR when we require cmake >= 3.25 | ||||||||||||||||||
|
||||||||||||||||||
# check in the obvious places first to find Apple's libtool | ||||||||||||||||||
find_program(LIBTOOL_MACOS libtool | ||||||||||||||||||
PATHS /usr/bin /Library/Developer/CommandLineTools/usr/bin | ||||||||||||||||||
NO_DEFAULT_PATH) | ||||||||||||||||||
|
||||||||||||||||||
# if it's not found in obvious places, check on the standard path | ||||||||||||||||||
if(LIBTOOL_MACOS-NOTFOUND) | ||||||||||||||||||
set(LIBTOOL_MACOS "libtool") | ||||||||||||||||||
endif() | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about just using default paths?
Suggested change
https://cmake.org/cmake/help/latest/command/find_program.html
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can try this. I will admit I read that list in the find docs a few times and was not 100% certain it would follow the path I was hoping it would (use our provided paths first, then project paths, then system paths). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, this works though I had to switch from
But it does seem to work! |
||||||||||||||||||
|
||||||||||||||||||
# confirm that the libtool we found is not GNU 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") | ||||||||||||||||||
jonkeane marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
endif() | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might consider raising this as a warning and proceeding anyway. If it is GNU libtool, it fails pretty clearly next. That would insulate us incase Apple's libtool has a slightly different version string or something (although with a spurious error). I'm split on if this is better or not. |
||||||||||||||||||
|
||||||||||||||||||
set(BUNDLE_COMMAND ${LIBTOOL_MACOS} "-no_warning_for_no_symbols" "-static" "-o" | ||||||||||||||||||
${output_lib_path} ${all_library_paths}) | ||||||||||||||||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|GNU|Intel|IntelLLVM)$") | ||||||||||||||||||
set(ar_script_path ${CMAKE_BINARY_DIR}/${ARG_NAME}.ar) | ||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this could technically be
find_program(LIBTOOL_MACOS libtool)
and that would find libtool along the search path, but be a no-op if line 106 above it found libtool.Does that look better? Or just an obfuscated version of this?