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-40248: [R] fallback to the correct libtool when we find a GNU one #40259

Merged
merged 11 commits into from Feb 28, 2024

Conversation

jonkeane
Copy link
Member

@jonkeane jonkeane commented Feb 27, 2024

Rationale for this change

On the CRAN build machines the GNU libtool is on the path in front of the macOS libtool. Though these are named the same thing, they are actually very different and don't actually appear to be substitutes

I checked on a non-developer's machine to see if /usr/bin/libtool exists, and it did. So I believe we should be ok with this even if xcode / command line tools haven't been installed.

One note: it's possible that we could get the GNU libtool in link mode to work with the right incantation (something like libtool --mode=link --tag=CXX ${cmake_compiler} -o ... but when I tried this I kept getting symbol not found errors. Ultimately, I think any mac that we are on will have the apple-provided libtool, so decided to go the route of finding it.

What changes are included in this PR?

When we detect we are on a GNU libtool, we look to /usr/bin/libtool instead.

Are these changes tested?

Yes. See a broken config failing at #40259 (comment) and then the next one passes

Are there any user-facing changes?

We will remain on CRAN

This PR contains a "Critical Fix".

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Feb 27, 2024
@jonkeane
Copy link
Member Author

@github-actions crossbow submit test-r-install-local

Copy link

Revision: 77188a0

Submitted crossbow builds: ursacomputing/crossbow @ actions-c1bc1ae976

Task Status
test-r-install-local GitHub Actions

@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Feb 27, 2024
@jonkeane
Copy link
Member Author

@github-actions crossbow submit test-r-install-local

This should fail because we find the GNU libtool in the R.Framework dir first

Copy link

Revision: 19461ca

Submitted crossbow builds: ursacomputing/crossbow @ actions-89df1d84e3

Task Status
test-r-install-local GitHub Actions

@jonkeane
Copy link
Member Author

@github-actions crossbow submit test-r-install-local

And now this should work because we find the apple-provided one first

Copy link

Revision: a62b889

Submitted crossbow builds: ursacomputing/crossbow @ actions-2975d7310c

Task Status
test-r-install-local GitHub Actions

Comment on lines 110 to 113
# if it's not found in obvious places, check on the standard path
if(LIBTOOL_MACOS-NOTFOUND)
set(LIBTOOL_MACOS "libtool")
endif()
Copy link
Member Author

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?

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Feb 27, 2024
Comment on lines 119 to 121
if(NOT "${LIBTOOL_V_OUTPUT}" MATCHES ".*cctools-([0-9.]+).*")
message(FATAL_ERROR "libtool found appears to be the incompatible GNU libtool")
endif()
Copy link
Member Author

Choose a reason for hiding this comment

The 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.

@jonkeane
Copy link
Member Author

This is ready for review. The CI failure (C++ / AMD64 macOS 12 C++) is the same on main so I believe unrelated to this change.

CC @kou

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

dev/tasks/r/github.macos-linux.local.yml Outdated Show resolved Hide resolved
Comment on lines 107 to 113
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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just using default paths? $PATH is used after PATHS.

Suggested change
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()
PATHS /usr/bin /Library/Developer/CommandLineTools/usr/bin)

https://cmake.org/cmake/help/latest/command/find_program.html

  1. Search the paths specified by the HINTS option. These should be paths computed by system introspection, such as a hint provided by the location of another item already found. Hard-coded guesses should be specified with the PATHS option.

  2. Search the standard system environment variables. This can be skipped if NO_SYSTEM_ENVIRONMENT_PATH is passed or by setting the CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH to FALSE.

    • The directories in PATH itself.

Copy link
Member Author

Choose a reason for hiding this comment

The 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).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this works though I had to switch from PATHS to HINTS since HINTS is higher in the search. This is a bit funny given the docs:

  1. Search the paths specified by the HINTS option. These should be paths computed by system introspection, such as a hint provided by the location of another item already found. Hard-coded guesses should be specified with the PATHS option.

But it does seem to work!

cpp/cmake_modules/BuildUtils.cmake Outdated Show resolved Hide resolved
dev/tasks/r/github.macos-linux.local.yml Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting changes Awaiting changes labels Feb 27, 2024
jonkeane and others added 2 commits February 27, 2024 17:47
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting merge Awaiting merge labels Feb 27, 2024
@kou kou mentioned this pull request Feb 28, 2024
@github-actions github-actions bot added awaiting change review Awaiting change review awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Feb 28, 2024
@jonkeane
Copy link
Member Author

@github-actions crossbow submit test-r-install-local

Copy link

Revision: e1cac51

Submitted crossbow builds: ursacomputing/crossbow @ actions-3f3456c02e

Task Status
test-r-install-local GitHub Actions

@jonkeane
Copy link
Member Author

@github-actions crossbow submit test-r-install-local

@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Feb 28, 2024
Copy link

Revision: ee8e590

Submitted crossbow builds: ursacomputing/crossbow @ actions-e25ea07ad4

Task Status
test-r-install-local GitHub Actions

@kou
Copy link
Member

kou commented Feb 28, 2024

Could you run archery lint --cmake-format --fix before we merge this?

@jonkeane
Copy link
Member Author

Could you run archery lint --cmake-format --fix before we merge this?

Yup, I should have done this before sending that last commit, sorry!

@jonkeane jonkeane merged commit 2fbf22a into apache:main Feb 28, 2024
29 of 31 checks passed
@jonkeane jonkeane removed the awaiting change review Awaiting change review label Feb 28, 2024
Copy link

After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 2fbf22a.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 4 possible false positives for unstable benchmarks that are known to sometimes produce them.

thisisnic pushed a commit that referenced this pull request Mar 1, 2024
…40259)

### Rationale for this change

On the CRAN build machines the GNU libtool is on the path in front of the macOS libtool. Though these are named the same thing, they are actually very different and don't actually appear to be substitutes

I checked on a non-developer's machine to see if `/usr/bin/libtool` exists, and it did. So I believe we _should_ be ok with this even if xcode / command line tools haven't been installed.

One note: it's possible that we could get the GNU libtool in link mode to work with the right incantation (something like `libtool --mode=link --tag=CXX ${cmake_compiler} -o ...` but when I tried this I kept getting symbol not found errors. Ultimately, I think any mac that we are on will have the apple-provided libtool, so decided to go the route of finding it. 

### What changes are included in this PR?

When we detect we are on a GNU libtool, we look to `/usr/bin/libtool` instead.

### Are these changes tested?

Yes. See a broken config failing at #40259 (comment) and then the next one passes

### Are there any user-facing changes?

We will remain on CRAN

**This PR contains a "Critical Fix".**
* GitHub Issue: #40248

Lead-authored-by: Jonathan Keane <jkeane@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Jonathan Keane <jkeane@gmail.com>
thisisnic pushed a commit to thisisnic/arrow that referenced this pull request Mar 8, 2024
…U one (apache#40259)

### Rationale for this change

On the CRAN build machines the GNU libtool is on the path in front of the macOS libtool. Though these are named the same thing, they are actually very different and don't actually appear to be substitutes

I checked on a non-developer's machine to see if `/usr/bin/libtool` exists, and it did. So I believe we _should_ be ok with this even if xcode / command line tools haven't been installed.

One note: it's possible that we could get the GNU libtool in link mode to work with the right incantation (something like `libtool --mode=link --tag=CXX ${cmake_compiler} -o ...` but when I tried this I kept getting symbol not found errors. Ultimately, I think any mac that we are on will have the apple-provided libtool, so decided to go the route of finding it. 

### What changes are included in this PR?

When we detect we are on a GNU libtool, we look to `/usr/bin/libtool` instead.

### Are these changes tested?

Yes. See a broken config failing at apache#40259 (comment) and then the next one passes

### Are there any user-facing changes?

We will remain on CRAN

**This PR contains a "Critical Fix".**
* GitHub Issue: apache#40248

Lead-authored-by: Jonathan Keane <jkeane@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Jonathan Keane <jkeane@gmail.com>
raulcd pushed a commit that referenced this pull request Mar 13, 2024
…40259)

### Rationale for this change

On the CRAN build machines the GNU libtool is on the path in front of the macOS libtool. Though these are named the same thing, they are actually very different and don't actually appear to be substitutes

I checked on a non-developer's machine to see if `/usr/bin/libtool` exists, and it did. So I believe we _should_ be ok with this even if xcode / command line tools haven't been installed.

One note: it's possible that we could get the GNU libtool in link mode to work with the right incantation (something like `libtool --mode=link --tag=CXX ${cmake_compiler} -o ...` but when I tried this I kept getting symbol not found errors. Ultimately, I think any mac that we are on will have the apple-provided libtool, so decided to go the route of finding it. 

### What changes are included in this PR?

When we detect we are on a GNU libtool, we look to `/usr/bin/libtool` instead.

### Are these changes tested?

Yes. See a broken config failing at #40259 (comment) and then the next one passes

### Are there any user-facing changes?

We will remain on CRAN

**This PR contains a "Critical Fix".**
* GitHub Issue: #40248

Lead-authored-by: Jonathan Keane <jkeane@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Jonathan Keane <jkeane@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants