Skip to content

To determine GAP_SO sage.env looks for libgap.so but it should look for libgap.so* #33446

@tornaria

Description

@tornaria

My system (void linux) only has

$ ls -l /usr/lib/libgap.so*
lrwxrwxrwx 1 root root      15 Jan 14 11:14 /usr/lib/libgap.so.0 -> libgap.so.0.0.0
-rwxr-xr-x 1 root root 2080920 Jan 14 11:14 /usr/lib/libgap.so.0.0.0

installed. Indeed, the symlink /usr/lib/libgap.so -> libgap.so.0.0.0 is shipped in gap-devel which is not needed to run sagemath at all.

This is because the implementation of the function sage.env._get_shared_lib_path() will look for libgap.so instead of libgap.so*. The fix is trivial:

--- a/src/sage/env.py
+++ b/src/sage/env.py
@@ -293,7 +293,7 @@ def _get_shared_lib_path(*libnames: str) -> Optional[str]:
             if sys.platform == 'darwin':
                 ext = 'dylib'
             else:
-                ext = 'so'
+                ext = 'so*'
 
             if SAGE_LOCAL:
                 search_directories.append(Path(SAGE_LOCAL) / 'lib')

Note that this function is only used once in sage.env to set GAP_SO.

Without the fix above my GAP_SO is set to None and I get failures like

sage: libgap.eval("2+2")
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [1], in <module>
----> 1 libgap.eval("2+2")
...
TypeError: expected str, NoneType found

Depends on #34391

CC: @dimpase @orlitzky @williamstein

Component: packages: standard

Author: Gonzalo Tornaría

Branch/commit - see the corr. PR

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/33446

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions