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

sage-env: identify the version of command-line tools (OS X) and set LDFLAGS accordingly #36599

Merged
merged 4 commits into from
Nov 10, 2023

Conversation

jhpalmieri
Copy link
Member

@jhpalmieri jhpalmieri commented Oct 30, 2023

Identify the version of command-line tools in use (OS X), and use the version to set LDFLAGS.

In sage-env, save the version of command-line tools being used in XCLT_VERSION. If it's too recent, we set LDFLAGS to solve some problems:

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

@jhpalmieri
Copy link
Member Author

In a perfect world, we would document variables like this somewhere in the developer's guide...

@jhpalmieri
Copy link
Member Author

We could also set LDFLAGS depending on XCLT_VERSION, either here or on another PR. (See #36337 (comment).)

@jhpalmieri
Copy link
Member Author

With this change, scipy builds and I don't get the "ignoring duplicate libraries" messages in the sagelib log or in doctests.

@jhpalmieri
Copy link
Member Author

I only have access to OS X machines with the latest command-line tools, so I can't test as thoroughly as I would like.

@jhpalmieri jhpalmieri changed the title sage-env: identify the version of command-line tools (OS X) sage-env: identify the version of command-line tools (OS X) and set LDFLAGS accordingly Nov 2, 2023
src/bin/sage-env Outdated
@@ -277,6 +277,15 @@ export UNAME=`uname | sed 's/CYGWIN.*/CYGWIN/' `
# Mac OS X-specific setup
if [ "$UNAME" = "Darwin" ]; then
export MACOSX_VERSION=`uname -r | awk -F. '{print $1}'`
# Try to identify command-line tools version.
# See https://apple.stackexchange.com/q/180957/351985.
XCLT_VERSION=`pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | awk '/version: / { print $NF }' | cut -d. -f-1`
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if querying with pkgutil is the right approach.
I think on a system several versions of CLT (and separately several versions of Xcode) can be installed.

@mkoeppe
Copy link
Contributor

mkoeppe commented Nov 4, 2023

I think it may be better to just check whether $(xcode-select -p)/usr/bin/ld-classic exists.

@jhpalmieri
Copy link
Member Author

I think it may be better to just check whether $(xcode-select -p)/usr/bin/ld-classic exists.

Like this?

    if [ -x "$(xcode-select -p)/usr/bin/ld-classic" ] ; then
        CLT_LD_CLASSIC=yes
    else
        CLT_LD_CLASSIC=no
    fi
    export CLT_LD_CLASSIC

(Might as well test whether it's executable, right?)

@jhpalmieri
Copy link
Member Author

I think it may be better to just check whether $(xcode-select -p)/usr/bin/ld-classic exists.

Like this?

    if [ -x "$(xcode-select -p)/usr/bin/ld-classic" ] ; then
        CLT_LD_CLASSIC=yes
    else
        CLT_LD_CLASSIC=no
    fi
    export CLT_LD_CLASSIC

(Might as well test whether it's executable, right?)

(Or move this check later when setting LD_FLAGS, and don't define a variable to track it — that's a little cleaner, if we're just using this to set LD_FLAGS.)

@mkoeppe
Copy link
Contributor

mkoeppe commented Nov 4, 2023

Yes, looks good to me

@jhpalmieri
Copy link
Member Author

Okay, here's a new version.

Copy link

github-actions bot commented Nov 5, 2023

Documentation preview for this PR (built with commit 543cd2d; changes) is ready! 🎉

@jhpalmieri
Copy link
Member Author

Thanks!

@mkoeppe mkoeppe added this to the sage-10.2 milestone Nov 5, 2023
vbraun pushed a commit to vbraun/sage that referenced this pull request Nov 6, 2023
…s (OS X) and set LDFLAGS accordingly

    
Identify the version of command-line tools in use (OS X), and use the
version to set LDFLAGS.

<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

In sage-env, save the version of command-line tools being used in
XCLT_VERSION. If it's too recent, we set LDFLAGS to solve some problems:
- Fixes sagemath#36337 (doctest failures)
- Fixes sagemath#36342 (scipy building,
replacing sagemath#36523).

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [X] The title is concise, informative, and self-explanatory.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36599
Reported by: John H. Palmieri
Reviewer(s): Matthias Köppe
vbraun pushed a commit to vbraun/sage that referenced this pull request Nov 7, 2023
…s (OS X) and set LDFLAGS accordingly

    
Identify the version of command-line tools in use (OS X), and use the
version to set LDFLAGS.

<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

In sage-env, save the version of command-line tools being used in
XCLT_VERSION. If it's too recent, we set LDFLAGS to solve some problems:
- Fixes sagemath#36337 (doctest failures)
- Fixes sagemath#36342 (scipy building,
replacing sagemath#36523).

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [X] The title is concise, informative, and self-explanatory.
- [X] The description explains in detail what this PR is about.
- [X] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36599
Reported by: John H. Palmieri
Reviewer(s): Matthias Köppe
@vbraun vbraun merged commit 8898473 into sagemath:develop Nov 10, 2023
22 checks passed
vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 25, 2024
…ests on M1 runners, add timeouts

<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

- Fixing the failure with `macos-13-homebrew`, as seen in
https://github.com/sagemath/sage/actions/runs/7761817710/job/21171032513
and upstream uses of macos.yml
dimpase/primecountpy#11 (comment),
sagemath/cypari2#152
- Generalizing the `ld_classic` workaround from sagemath#36599 for the case of
full XCode.
  - This is to fix the failure seen on `homebrew-macos-13-usrlocal-
standard-xcode_15.0`, e.g. in https://github.com/scipopt/SCIP-
SDP/actions/runs/7793548242/job/21253452882?pr=9#step:10:2766
- Deactivating the `ld_classic` workaround when `LD` is set, as is in a
conda environment; as seen e.g. in https://groups.google.com/g/sage-
devel/c/1viBzw-ZaoQ/m/S_u9K20xAAAJ
- [Apple Silicon runners recently became
available](https://github.blog/changelog/2024-01-30-github-actions-
introducing-the-new-m1-macos-runner-available-to-open-source/); we add
some tests (example run:
https://github.com/mkoeppe/sage/actions/runs/7772086965/job/21194110510)
- On Apple Silicon, `tox -e local-conda-forge` now uses the correct
installer
- Intel runners were recently upgraded too, increase parallelism.
- Add self-destruct sequence to cancel workflows before the 6h limit
(catches linbox-related build hang)
- Actually handle the input `extra_sage_packages` (for
scipopt/PySCIPOpt#630)

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

Follow-ups, not addressed here:
- conda-forge-macos-latest-minimal tachyon build failure - needs sagemath#36969
- adding a config that tests arm64 conda-forge-minimal - would need
config.guess updates in numerous packages
- arm64 conda-forge-standard - matplotlib build failure (https://github.
com/mkoeppe/sage/actions/runs/7810111886/job/21313997438#step:10:2749)
- hangs or excessive build time that lead to timeouts, probably from
linbox

### :memo: Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### :hourglass: Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

URL: sagemath#37237
Reported by: Matthias Köppe
Reviewer(s): Matthias Köppe, Tobias Diez
vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 26, 2024
…ests on M1 runners, add timeouts

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

- Fixing the failure with `macos-13-homebrew`, as seen in
https://github.com/sagemath/sage/actions/runs/7761817710/job/21171032513
and upstream uses of macos.yml
dimpase/primecountpy#11 (comment),
sagemath/cypari2#152
- Generalizing the `ld_classic` workaround from sagemath#36599 for the case of
full XCode.
  - This is to fix the failure seen on `homebrew-macos-13-usrlocal-
standard-xcode_15.0`, e.g. in https://github.com/scipopt/SCIP-
SDP/actions/runs/7793548242/job/21253452882?pr=9#step:10:2766
- Deactivating the `ld_classic` workaround when `LD` is set, as is in a
conda environment; as seen e.g. in https://groups.google.com/g/sage-
devel/c/1viBzw-ZaoQ/m/S_u9K20xAAAJ
- [Apple Silicon runners recently became
available](https://github.blog/changelog/2024-01-30-github-actions-
introducing-the-new-m1-macos-runner-available-to-open-source/); we add
some tests (example run:
https://github.com/mkoeppe/sage/actions/runs/7772086965/job/21194110510)
- On Apple Silicon, `tox -e local-conda-forge` now uses the correct
installer
- Intel runners were recently upgraded too, increase parallelism.
- Add self-destruct sequence to cancel workflows before the 6h limit
(catches linbox-related build hang)
- Actually handle the input `extra_sage_packages` (for
scipopt/PySCIPOpt#630)

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

Follow-ups, not addressed here:
- conda-forge-macos-latest-minimal tachyon build failure - needs sagemath#36969
- adding a config that tests arm64 conda-forge-minimal - would need
config.guess updates in numerous packages
- arm64 conda-forge-standard - matplotlib build failure (https://github.
com/mkoeppe/sage/actions/runs/7810111886/job/21313997438#step:10:2749)
- hangs or excessive build time that lead to timeouts, probably from
linbox

### :memo: Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### :hourglass: Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#37237
Reported by: Matthias Köppe
Reviewer(s): Matthias Köppe, Tobias Diez
vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 28, 2024
…ests on M1 runners, add timeouts

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

- Fixing the failure with `macos-13-homebrew`, as seen in
https://github.com/sagemath/sage/actions/runs/7761817710/job/21171032513
and upstream uses of macos.yml
dimpase/primecountpy#11 (comment),
sagemath/cypari2#152
- Generalizing the `ld_classic` workaround from sagemath#36599 for the case of
full XCode.
  - This is to fix the failure seen on `homebrew-macos-13-usrlocal-
standard-xcode_15.0`, e.g. in https://github.com/scipopt/SCIP-
SDP/actions/runs/7793548242/job/21253452882?pr=9#step:10:2766
- Deactivating the `ld_classic` workaround when `LD` is set, as is in a
conda environment; as seen e.g. in https://groups.google.com/g/sage-
devel/c/1viBzw-ZaoQ/m/S_u9K20xAAAJ
- [Apple Silicon runners recently became
available](https://github.blog/changelog/2024-01-30-github-actions-
introducing-the-new-m1-macos-runner-available-to-open-source/); we add
some tests (example run:
https://github.com/mkoeppe/sage/actions/runs/7772086965/job/21194110510)
- On Apple Silicon, `tox -e local-conda-forge` now uses the correct
installer
- Intel runners were recently upgraded too, increase parallelism.
- Add self-destruct sequence to cancel workflows before the 6h limit
(catches linbox-related build hang)
- Actually handle the input `extra_sage_packages` (for
scipopt/PySCIPOpt#630)

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

Follow-ups, not addressed here:
- conda-forge-macos-latest-minimal tachyon build failure - needs sagemath#36969
- adding a config that tests arm64 conda-forge-minimal - would need
config.guess updates in numerous packages
- arm64 conda-forge-standard - matplotlib build failure (https://github.
com/mkoeppe/sage/actions/runs/7810111886/job/21313997438#step:10:2749)
- hangs or excessive build time that lead to timeouts, probably from
linbox

### :memo: Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### :hourglass: Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#37237
Reported by: Matthias Köppe
Reviewer(s): Matthias Köppe, Tobias Diez
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.

Build failures with Xcode CLT 15.0: scipy (via meson), ecm
3 participants