Skip to content

Commit fda4ce3

Browse files
author
Release Manager
committed
sagemathgh-41186: Fix meson build on Ubuntu 24.04 <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Fix the meson build on Ubuntu 24.04 by: - Changing the flint subproject to use cmake (which is offically only supported on windows, but seems to work well also on Ubuntu) - Add a check for the pari version (because the older ubuntu only comes with 2.15.4, against which sage doesn't actually compile) ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] 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 <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#41186 Reported by: Tobias Diez Reviewer(s):
2 parents f98f46a + 6fe0569 commit fda4ce3

File tree

6 files changed

+52
-5
lines changed

6 files changed

+52
-5
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
- debian:forky
2828
- ghcr.io/void-linux/void-glibc-full
2929
- archlinux
30-
#- ubuntu:22.04 - fails due to issue with cypari2
31-
#- ubuntu:24.04 - fails due to issue with cypari2
30+
#- ubuntu:22.04 - gap is outdated there (only 4.11)
31+
- ubuntu:24.04
3232
- ubuntu:25.04
3333
container:
3434
image: ${{ matrix.container }}
@@ -47,6 +47,10 @@ jobs:
4747
# but we need the maxima help to be in place
4848
sed -i '/^NoExtract/d' /etc/pacman.conf
4949
fi
50+
if [ "${{ matrix.container }}" = "ubuntu:22.04" ]; then
51+
apt-get update
52+
apt-get install -y git
53+
fi
5054
5155
- name: Checkout code
5256
# cannot use v4 yet because of https://github.com/actions/checkout/issues/1487

build/bin/sage-print-system-package-command

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ case $system:$command in
153153
fi
154154
;;
155155
@(fedora*|redhat*|centos*):install)
156-
[ "$YES" = yes ] && options="$options -y"
156+
[ "$YES" = yes ] && options="$options -y --allowerasing"
157157
[ "$IGNORE_MISSING" = yes ] && options="$options --skip-unavailable"
158158
[ -n "$system_packages" ] && print_shell_command ${SUDO}dnf install $options $system_packages
159159
;;

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ project(
44
version: files('VERSION.txt'),
55
license: 'GPL v3',
66
default_options: ['c_std=c17', 'cpp_std=c++17', 'python.install_env=auto'],
7-
meson_version: '>=1.2',
7+
meson_version: '>=1.5',
88
)
99

1010
# Python module

src/meson.build

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,32 @@ except Exception:
8787
endif
8888
# Cannot be found via pkg-config
8989
pari = cc.find_library('pari', required: not is_windows, disabler: true)
90+
if pari.found() and not meson.is_cross_build()
91+
# Verify PARI version
92+
pari_version_code = '''
93+
#include <stdio.h>
94+
#include <pari/pari.h>
95+
int main(void) {
96+
pari_init(1000000, 2);
97+
GEN v = pari_version(), M = gel(v,1), m = gel(v,2), p = gel(v,3);
98+
printf("%ld.%ld.%ld", itos(M), itos(m), itos(p));
99+
pari_close();
100+
return 0;
101+
}
102+
'''
103+
pari_version = cc.run(
104+
pari_version_code,
105+
args: ['-v'],
106+
name: 'pari version',
107+
dependencies: [pari],
108+
required: true,
109+
).stdout().strip()
110+
if pari_version.version_compare('<=2.17.0')
111+
message('PARI version > 2.17.0 required, found ' + pari_version)
112+
pari = disabler()
113+
endif
114+
endif
115+
90116

91117
mpfr = dependency('mpfr')
92118

subprojects/flint.wrap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ url = https://github.com/flintlib/flint.git
33
revision = main
44
depth = 1
55
patch_directory = flint
6+
diff_files = flint/cmakelinux.patch
7+
method = cmake
68

79
[provide]
8-
dependency_names = flint
10+
flint = flint_dep
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 8d959fb..5dcbf6e 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -12,10 +12,6 @@
6+
7+
cmake_minimum_required(VERSION 3.22)
8+
9+
-if(NOT WIN32)
10+
- message(FATAL_ERROR "Detected system is not Windows. Please use the Autotools configuration along with the Makefile instead as it is more up-to-date. Read INSTALL.md.")
11+
-endif()
12+
-
13+
include(CheckCCompilerFlag)
14+
include(CheckCSourceRuns)
15+
include(CheckIPOSupported)

0 commit comments

Comments
 (0)