Skip to content

Use the configured PARI installation when building cypari2 - #42902

Merged
vbraun merged 2 commits into
sagemath:developfrom
dimpase:fix/cypari-pari-discovery
Oct 11, 2026
Merged

vbraun merged 2 commits into
sagemath:developfrom
dimpase:fix/cypari-pari-discovery

Conversation

@dimpase

@dimpase dimpase commented Oct 2, 2026

Copy link
Copy Markdown
Member

When Sage builds its own PARI on macOS while Homebrew PARI is installed, cypari2's Meson search can select Homebrew's headers, library, and function list instead. Its generator then uses Sage's gphelp with a different PARI function list. With Sage's PARI 2.17.1 and Homebrew's 2.19.0, this reproduces the failure no help found for 'algbasistoquat' reported in #42900.

Pass Sage's configured PARI prefix to cypari2 so the installation selected by configure is also used for the Python extension. This covers both Sage-built PARI and external installations outside Homebrew on macOS.

  • Record the external PARI prefix from the validated gp executable, using the same prefix inference as the existing gp2c check, including the /bin to /usr/bin case. Configure already checks that GP and libpari have matching versions and data directories.
  • Pass that prefix through meson-python's setup-args in the cypari installer.
  • Backport cypari2's pari_prefix Meson option from Fix PARI 2.19 precision handling for L-functions and eigenvectors cypari2#233 to Sage's current cypari2 2.2.4. Skip Homebrew discovery when an explicit prefix is supplied.
  • Bump the SPKG patch level to 2.2.4.p1 so existing installations rebuild.

The lcalc update discussed in #42900 is separate in #42881. This PR does not upgrade cypari2 or address its separate PARI 2.19 API compatibility changes.

Validation on macOS 27 / arm64 / Python 3.14.7:

  • Built Sage's exact PARI 2.17.1 source, with its Sage patch, using the PARI SPKG installation script in a temporary prefix.
  • Reproduced the issue with cypari2 commit 3357ea155053c964b6e2212292b377024814c664: without the prefix option, Meson selects Homebrew 2.19.0 while gphelp comes from 2.17.1, and generation fails on algbasistoquat; supplying the prefix makes configuration succeed.
  • Built and installed patched cypari2 2.2.4 using Sage's installer against the Sage-built PARI. Verified the linked library, version, and data directory; all 2,477 cypari2 doctests passed.
  • Ran a full Sage configure with --with-system-pari=force --with-system-cypari=no, selecting the temporary PARI 2.17.1 as an external installation while Homebrew 2.19.0 remained installed. Used the resulting build environment configuration with the cypari installer. The extension links to the selected external library and all 2,477 doctests passed.
  • A full configure with Homebrew PARI records /opt/homebrew as its prefix. Also verified the Sage-built prefix fallback and /bin to /usr handling with an Autoconf harness using the actual PARI post-check macro.
  • Patched cypari2 2.2.4 also builds against a separate external PARI 2.17.4 without a prefix option; all 2,477 doctests passed. The newer cypari2 source from the issue builds and passes smoke checks with Homebrew 2.19.0. Both unpatched and patched cypari2 2.2.4 fail identically against 2.19.0's changed initprimetable API, confirming that incompatibility is unrelated to this patch.
  • Shell syntax checks and git diff --check passed.

📝 Checklist

  • The title is concise and informative.
  • 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 and checked the documentation preview.

⌛ Dependencies

None.

@dimpase

dimpase commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

darwin-27 CI uses an incompatible with cypari 2.2.4 pari 2.19 from Homebrew. No wonder it failed

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

Documentation preview for this PR (built with commit 603c93d; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 4, 2026
Release Manager
sagemathgh-42902: Use the configured PARI installation when building cypari2
    
When Sage builds its own PARI on macOS while Homebrew PARI is installed,
cypari2's Meson search can select Homebrew's headers, library, and
function list instead. Its generator then uses Sage's `gphelp` with a
different PARI function list. With Sage's PARI 2.17.1 and Homebrew's
2.19.0, this reproduces the failure `no help found for 'algbasistoquat'`
reported in sagemath#42900.

Pass Sage's configured PARI prefix to cypari2 so the installation
selected by configure is also used for the Python extension. This covers
both Sage-built PARI and external installations outside Homebrew on
macOS.

- Record the external PARI prefix from the validated `gp` executable,
using the same prefix inference as the existing gp2c check, including
the `/bin` to `/usr/bin` case. Configure already checks that GP and
libpari have matching versions and data directories.
- Pass that prefix through meson-python's `setup-args` in the cypari
installer.
- Backport cypari2's `pari_prefix` Meson option from
sagemath/cypari2#233 to Sage's current cypari2 2.2.4. Skip Homebrew
discovery when an explicit prefix is supplied.
- Bump the SPKG patch level to `2.2.4.p1` so existing installations
rebuild.

The lcalc update discussed in sagemath#42900 is separate in sagemath#42881. This PR does
not upgrade cypari2 or address its separate PARI 2.19 API compatibility
changes.

Validation on macOS 27 / arm64 / Python 3.14.7:

- Built Sage's exact PARI 2.17.1 source, with its Sage patch, using the
PARI SPKG installation script in a temporary prefix.
- Reproduced the issue with cypari2 commit
`3357ea155053c964b6e2212292b377024814c664`: without the prefix option,
Meson selects Homebrew 2.19.0 while `gphelp` comes from 2.17.1, and
generation fails on `algbasistoquat`; supplying the prefix makes
configuration succeed.
- Built and installed patched cypari2 2.2.4 using Sage's installer
against the Sage-built PARI. Verified the linked library, version, and
data directory; all 2,477 cypari2 doctests passed.
- Ran a full Sage configure with `--with-system-pari=force --with-
system-cypari=no`, selecting the temporary PARI 2.17.1 as an external
installation while Homebrew 2.19.0 remained installed. Used the
resulting build environment configuration with the cypari installer. The
extension links to the selected external library and all 2,477 doctests
passed.
- A full configure with Homebrew PARI records `/opt/homebrew` as its
prefix. Also verified the Sage-built prefix fallback and `/bin` to
`/usr` handling with an Autoconf harness using the actual PARI post-
check macro.
- Patched cypari2 2.2.4 also builds against a separate external PARI
2.17.4 without a prefix option; all 2,477 doctests passed. The newer
cypari2 source from the issue builds and passes smoke checks with
Homebrew 2.19.0. Both unpatched and patched cypari2 2.2.4 fail
identically against 2.19.0's changed `initprimetable` API, confirming
that incompatibility is unrelated to this patch.
- Shell syntax checks and `git diff --check` passed.

### 📝 Checklist

- [x] The title is concise and informative.
- [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 and checked the documentation
preview.

### ⌛ Dependencies

None.
    
URL: sagemath#42902
Reported by: Dima Pasechnik
Reviewer(s):
vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 6, 2026
Release Manager
sagemathgh-42902: Use the configured PARI installation when building cypari2
    
When Sage builds its own PARI on macOS while Homebrew PARI is installed,
cypari2's Meson search can select Homebrew's headers, library, and
function list instead. Its generator then uses Sage's `gphelp` with a
different PARI function list. With Sage's PARI 2.17.1 and Homebrew's
2.19.0, this reproduces the failure `no help found for 'algbasistoquat'`
reported in sagemath#42900.

Pass Sage's configured PARI prefix to cypari2 so the installation
selected by configure is also used for the Python extension. This covers
both Sage-built PARI and external installations outside Homebrew on
macOS.

- Record the external PARI prefix from the validated `gp` executable,
using the same prefix inference as the existing gp2c check, including
the `/bin` to `/usr/bin` case. Configure already checks that GP and
libpari have matching versions and data directories.
- Pass that prefix through meson-python's `setup-args` in the cypari
installer.
- Backport cypari2's `pari_prefix` Meson option from
sagemath/cypari2#233 to Sage's current cypari2 2.2.4. Skip Homebrew
discovery when an explicit prefix is supplied.
- Bump the SPKG patch level to `2.2.4.p1` so existing installations
rebuild.

The lcalc update discussed in sagemath#42900 is separate in sagemath#42881. This PR does
not upgrade cypari2 or address its separate PARI 2.19 API compatibility
changes.

Validation on macOS 27 / arm64 / Python 3.14.7:

- Built Sage's exact PARI 2.17.1 source, with its Sage patch, using the
PARI SPKG installation script in a temporary prefix.
- Reproduced the issue with cypari2 commit
`3357ea155053c964b6e2212292b377024814c664`: without the prefix option,
Meson selects Homebrew 2.19.0 while `gphelp` comes from 2.17.1, and
generation fails on `algbasistoquat`; supplying the prefix makes
configuration succeed.
- Built and installed patched cypari2 2.2.4 using Sage's installer
against the Sage-built PARI. Verified the linked library, version, and
data directory; all 2,477 cypari2 doctests passed.
- Ran a full Sage configure with `--with-system-pari=force --with-
system-cypari=no`, selecting the temporary PARI 2.17.1 as an external
installation while Homebrew 2.19.0 remained installed. Used the
resulting build environment configuration with the cypari installer. The
extension links to the selected external library and all 2,477 doctests
passed.
- A full configure with Homebrew PARI records `/opt/homebrew` as its
prefix. Also verified the Sage-built prefix fallback and `/bin` to
`/usr` handling with an Autoconf harness using the actual PARI post-
check macro.
- Patched cypari2 2.2.4 also builds against a separate external PARI
2.17.4 without a prefix option; all 2,477 doctests passed. The newer
cypari2 source from the issue builds and passes smoke checks with
Homebrew 2.19.0. Both unpatched and patched cypari2 2.2.4 fail
identically against 2.19.0's changed `initprimetable` API, confirming
that incompatibility is unrelated to this patch.
- Shell syntax checks and `git diff --check` passed.

### 📝 Checklist

- [x] The title is concise and informative.
- [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 and checked the documentation
preview.

### ⌛ Dependencies

None.
    
URL: sagemath#42902
Reported by: Dima Pasechnik
Reviewer(s):
vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 8, 2026
Release Manager
sagemathgh-42902: Use the configured PARI installation when building cypari2
    
When Sage builds its own PARI on macOS while Homebrew PARI is installed,
cypari2's Meson search can select Homebrew's headers, library, and
function list instead. Its generator then uses Sage's `gphelp` with a
different PARI function list. With Sage's PARI 2.17.1 and Homebrew's
2.19.0, this reproduces the failure `no help found for 'algbasistoquat'`
reported in sagemath#42900.

Pass Sage's configured PARI prefix to cypari2 so the installation
selected by configure is also used for the Python extension. This covers
both Sage-built PARI and external installations outside Homebrew on
macOS.

- Record the external PARI prefix from the validated `gp` executable,
using the same prefix inference as the existing gp2c check, including
the `/bin` to `/usr/bin` case. Configure already checks that GP and
libpari have matching versions and data directories.
- Pass that prefix through meson-python's `setup-args` in the cypari
installer.
- Backport cypari2's `pari_prefix` Meson option from
sagemath/cypari2#233 to Sage's current cypari2 2.2.4. Skip Homebrew
discovery when an explicit prefix is supplied.
- Bump the SPKG patch level to `2.2.4.p1` so existing installations
rebuild.

The lcalc update discussed in sagemath#42900 is separate in sagemath#42881. This PR does
not upgrade cypari2 or address its separate PARI 2.19 API compatibility
changes.

Validation on macOS 27 / arm64 / Python 3.14.7:

- Built Sage's exact PARI 2.17.1 source, with its Sage patch, using the
PARI SPKG installation script in a temporary prefix.
- Reproduced the issue with cypari2 commit
`3357ea155053c964b6e2212292b377024814c664`: without the prefix option,
Meson selects Homebrew 2.19.0 while `gphelp` comes from 2.17.1, and
generation fails on `algbasistoquat`; supplying the prefix makes
configuration succeed.
- Built and installed patched cypari2 2.2.4 using Sage's installer
against the Sage-built PARI. Verified the linked library, version, and
data directory; all 2,477 cypari2 doctests passed.
- Ran a full Sage configure with `--with-system-pari=force --with-
system-cypari=no`, selecting the temporary PARI 2.17.1 as an external
installation while Homebrew 2.19.0 remained installed. Used the
resulting build environment configuration with the cypari installer. The
extension links to the selected external library and all 2,477 doctests
passed.
- A full configure with Homebrew PARI records `/opt/homebrew` as its
prefix. Also verified the Sage-built prefix fallback and `/bin` to
`/usr` handling with an Autoconf harness using the actual PARI post-
check macro.
- Patched cypari2 2.2.4 also builds against a separate external PARI
2.17.4 without a prefix option; all 2,477 doctests passed. The newer
cypari2 source from the issue builds and passes smoke checks with
Homebrew 2.19.0. Both unpatched and patched cypari2 2.2.4 fail
identically against 2.19.0's changed `initprimetable` API, confirming
that incompatibility is unrelated to this patch.
- Shell syntax checks and `git diff --check` passed.

### 📝 Checklist

- [x] The title is concise and informative.
- [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 and checked the documentation
preview.

### ⌛ Dependencies

None.
    
URL: sagemath#42902
Reported by: Dima Pasechnik
Reviewer(s):
@vbraun
vbraun merged commit bca4126 into sagemath:develop Oct 11, 2026
32 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants