-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve ability to use system packages for GMP/RE2 (#25184)
Improves Chapels ability to use system packages for GMP and RE2. This PR adds some `pkg-config`/`brew` logic to use CHPL_GMP=true when GMP is not in the library path. It also adds some extra detection for GMP. This means that if a user has GMP installed, `CHPL_GMP` will default to `system` This PR makes CHPL_RE2=system a config time error, because Chapel relies on a special version of RE2 that is not available in any package manager. This should improve errors if a user tries to use a system install of RE2 This PR also puts some utils in place to check if GMP is installed on the system, but it does not switch the default for CHPL_GMP This PR also now requires `pkg-config` on systems with homebrew, and makes the necessary adjustments to hwloc, jemalloc, gmp, and the homebrew formula Testing: - ran `start_test test/library/standard/BigInteger/apiTest.chpl` with CHPL_GMP=system - tested that CHPL_RE2=system is a config time error - tested various error conditions (e.g. "pkg-config" not installed, packages missing) [Reviewed by @jhh67]
- Loading branch information
Showing
12 changed files
with
113 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import sys | ||
|
||
from utils import error, memoize, try_run_command | ||
|
||
@memoize | ||
def get_homebrew_prefix(pkg=None): | ||
""" | ||
If running on a system with Homebrew, return the Homebrew prefix. | ||
If not, return None. | ||
If pkg is provided, return the Homebrew prefix for that package. | ||
""" | ||
cmd = ['brew', '--prefix'] | ||
if pkg is not None: | ||
cmd.append(str(pkg)) | ||
exists, retcode, my_out, _ = try_run_command(cmd) | ||
if exists and retcode == 0: | ||
# Make sure to include homebrew search path | ||
homebrew_prefix = my_out.strip() | ||
return homebrew_prefix | ||
|
||
return None | ||
|
||
@memoize | ||
def homebrew_exists(): | ||
"""Check if Homebrew is installed on the system.""" | ||
return get_homebrew_prefix() is not None | ||
|
||
@memoize | ||
def homebrew_pkg_exists(pkg): | ||
"""Check if a Homebrew package is installed on the system.""" | ||
cmd = ['brew', 'list', pkg] | ||
exists, retcode, _, _ = try_run_command(cmd) | ||
return exists and retcode == 0 | ||
|
||
def _main(): | ||
sys.stdout.write("{0}\n".format(get_homebrew_prefix())) | ||
|
||
|
||
if __name__ == '__main__': | ||
_main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ class Chapel < Formula | |
depends_on "jemalloc" | ||
depends_on "llvm@17" | ||
depends_on "[email protected]" | ||
depends_on "pkg-config" => :build | ||
|
||
# LLVM is built with gcc11 and we will fail on linux with gcc version 5.xx | ||
fails_with gcc: "5" | ||
|