Skip to content

Commit

Permalink
Trac #30559: Refine python3's SAGE_SPKG_DEPCHECK: Remove sqlite
Browse files Browse the repository at this point in the history
Currently we have `SAGE_SPKG_DEPCHECK([sqlite libpng bzip2 xz libffi],
...)`, which causes system python3 to be rejected on many systems.

We should review whether this can be made more fine-grained.

`SAGE_SPKG_DEPCHECK` is specifically for checking whether we are going
to install a shared library that may interfere with a system-provided
version of the same shared library that the package is linked against.

'''Package `sqlite`'''....
{{{
$ grep sqlite build/pkgs/*/dependencies
build/pkgs/cryptominisat/dependencies:$(PYTHON) m4ri zlib libpng | cmake
sqlite boost_cropped
build/pkgs/elliptic_curves/dependencies:| sqlite $(PYTHON)
build/pkgs/python3/dependencies:zlib readline sqlite libpng bzip2 xz
libffi
}}}

`elliptic_curves` only seems to use the Python module sqlite - it does
not depend on sqlite itself.

`cryptominisat` does not seem to depend on sqlite at all.

In this ticket, we remove these unnecessary dependencies and the sqlite
depcheck for python3; and set `sqlite` as "not required" if system
python3 will be used.

--------

Follow-up tickets may address the following dependencies:
 - #30949 Refine python3's `SAGE_SPKG_DEPCHECK`: libpng, bzip2, xz,
libffi
 - #30948 Package `xz` represents both the shared library `liblzma` and
the `xz` binary.

See also:
 - #28019 If system mpir is found, yasm should not be built

URL: https://trac.sagemath.org/30559
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): John Palmieri
  • Loading branch information
Release Manager committed Nov 24, 2020
2 parents 020bd59 + 4731840 commit 97c6b93
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/pkgs/cryptominisat/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(PYTHON) m4ri zlib libpng | cmake sqlite boost_cropped
$(PYTHON) m4ri zlib libpng | cmake boost_cropped

----------
All lines of this file are ignored except the first.
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/elliptic_curves/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
| sqlite $(PYTHON)
| $(PYTHON)

----------
All lines of this file are ignored except the first.
Expand Down
7 changes: 6 additions & 1 deletion build/pkgs/python3/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ SAGE_SPKG_CONFIGURE([python3], [
[AC_MSG_ERROR([building Sage --without-python is not supported])])
ac_path_PYTHON3="$with_python"
SAGE_SPKG_DEPCHECK([sqlite libpng bzip2 xz libffi], [
dnl Trac #30559: Removed the DEPCHECK for sqlite. We never use libsqlite3 from SPKG for anything
dnl other than building the python3 SPKG; so our libsqlite3 cannot create shared library conflicts.
dnl
dnl However, if we add another package (providing a shared library linked into a Python module)
dnl that also uses libsqlite3, then we will have to put the DEPCHECK back in.
SAGE_SPKG_DEPCHECK([libpng bzip2 xz libffi], [
dnl Check if we can do venv with a system python3
dnl instead of building our own copy.
check_modules="sqlite3, ctypes, math, hashlib, crypt, readline, socket, zlib, distutils.core"
Expand Down
14 changes: 13 additions & 1 deletion build/pkgs/sqlite/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,16 @@ SAGE_SPKG_CONFIGURE([sqlite], [
m4_popdef([SAGE_SQLITE3_MIN_VERSION_MINOR])
m4_popdef([SAGE_SQLITE3_MIN_VERSION_MICRO])
m4_popdef([SAGE_SQLITE3_MIN_VERSION])
])
], [dnl REQUIRED-CHECK
AS_CASE([$host],
[*-*-cygwin*], [
dnl sqlite SetDllDirectory in sage_ostools.pyx
sage_require_sqlite=yes
], [
AC_REQUIRE([SAGE_SPKG_CONFIGURE_PYTHON3])
AS_IF([test x$sage_spkg_install_python3 = xno], [
sage_require_sqlite=no
])
])
]
)
2 changes: 2 additions & 0 deletions src/sage/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ def uname_specific(name, value, alternative):

aliases["LINUX_NOEXECSTACK"] = uname_specific("Linux", ["-Wl,-z,noexecstack"],
[])
aliases["CYGWIN_SQLITE3_LIBS"] = uname_specific("CYGWIN", ["sqlite3"],
[])

# LinBox needs special care because it actually requires C++11 with
# GNU extensions: -std=c++11 does not work, you need -std=gnu++11
Expand Down
2 changes: 1 addition & 1 deletion src/sage/misc/sage_ostools.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# distutils: libraries = sqlite3
# distutils: libraries = CYGWIN_SQLITE3_LIBS
"""
Miscellaneous operating system functions
"""
Expand Down

0 comments on commit 97c6b93

Please sign in to comment.