-
-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To determine GAP_SO
sage.env looks for libgap.so
but it should look for libgap.so*
#33446
Comments
Commit: |
New commits:
|
Author: Gonzalo Tornaría |
Branch: u/tornaria/33446/libgap.so |
comment:2
I'd guess there'a potential for a regression here on Linux systems that have multiple versions of the shared library installed. |
comment:3
Replying to @mkoeppe:
I don't understand why libgap needs to be In any case if there are multiple versions of the shared library installed, nothing guarantees that the correct one is loaded. It seems like a "more correct" way to find the shared library that is actually already loaded would be based on something like:
I'm not sure how portable is One possibility is to skip the hack altogether when |
comment:5
Why isn't |
comment:6
On some distributions, the |
comment:7
Replying to @mkoeppe:
I understand the problem, but the libtool version number is an implementation detail here. The user-facing library is The bottom line is that it's a lot of trouble to save however much space a symlink takes up. I'd change the distro package if it were up to me. Typically, a |
comment:8
Replying to @orlitzky:
Only at build time, not at runtime. |
comment:9
Replying to @orlitzky:
Beyond the scope of our project to change packaging practices of major distributions |
comment:10
Replying to @mkoeppe:
There is some subtler distinction to be made here, but my point is that the distro package in question isn't usable by anyone who wants to build software that links to libgap. I think that should be fixed, independent of this issue. And then as a side effect, this problem just happens to disappear. |
comment:11
Replying to @mkoeppe:
Given that most major distros have at least one developer with a presence here... if there's a solution that's better for everyone and requires only a minor tweak to a distro package rather than piling more hacks onto what's already a hack within sage, I think we should be thankful for our good luck. |
comment:12
Replying to @orlitzky:
I think you are missing that the point is that the runtime package of Sage does not have to depend on the dev package of gap, only on the runtime package gap. |
comment:13
Replying to @mkoeppe:
I'm not. I'm saying that the runtime package should include the symlink that makes libgap accessible via the expected name. That's all that's needed to fix this. |
comment:14
Replying to @orlitzky:
What you are dismissing here as an implementation detail is really at the core of how binary distributions work: Multiple versions of a shared library can be present on a system, and binaries shipped by package link to the correct version of the shared library; there cannot be a notion of "current version" at runtime. |
comment:15
Replying to @mkoeppe:
That's... just how it works. It has nothing in particular to do with binary distributions, and is also why globbing for If you want my real answer, we should stop |
comment:16
I also see that the gap library is versioned upstream, so if the distro package is installing it as |
comment:17
In the end, the only "correct" way to proceed is to figure out the actual soname that the gap extension module in sagemath was linked with, namely:
This is telling you that you must look for The path to the extension module itself can be had with
This should be portable, but
Of course it would be much better to just avoid using |
comment:18
Replying to @tornaria:
+1 |
comment:19
Replying to @orlitzky:
Upstream uses I also believe that |
comment:20
In fact one way to get the soname for a library may be using
|
comment:21
That would still need to be somewhat parsed https://docs.python.org/3/library/ctypes.html#finding-shared-libraries - on linux it uses whatever is available to find an answer and will look into |
comment:22
Replying to @tornaria:
On OSX it does. We ran into that problem with libSingular. |
comment:23
Replying to @tornaria:
It doesn't, it chooses the most recent one. |
comment:48
I rebased everything on 9.8.beta1. I am still unsure what to do about I think it would be better to use stuff from For the short run, what is here seems better (with or without the last commit). Right now I still have to patch stuff for void linux since we don't ship |
comment:49
Could you rebase this on GAP 4.12 - the update has been positively reviewed in #34391 ? |
Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:
|
comment:51
Rebased on top of #34391. I added a commit so |
Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:
|
Dependencies: #34391 |
comment:55
let's get #34391 in first - it's a bit hard to review now. |
comment:56
Replying to Dima Pasechnik:
Sure, but just for the record: the head of #34391 is
I could squash some of the commits together if that makes it easier to review (ec2476b + 4768b99 + 126b0de are part of the same change, in a sense). That would leave 5 clearly defined commits. |
Reviewer: Dima Pasechnik |
comment:57
looks good - also tested on macOS |
The dependency hasn't been merged yet, so please create a github PR for this ticket |
This needs the soname (as in sage.env.GAP_SO) which has issues for system gap as explained in sagemath#33446. Instead we dlopen() the extension module sage.libs.gap.util which, having a link time dependency to libgap, will indirectly dlopen() it. For the record: by the time we run dlopen() the libgap should be already loaded. The purpose of doing it is to change mode to RTLD_GLOBAL so that symbols in libgap are placed in the global symbol table. This is required to compiled load gap packages. An easy test that this is working ok is: sage: libgap.LoadPackage("io") true This requires optional spkg `gap_packages` to be installed.
…isambiguate the workspace file, not SAGE_LOCAL" This reverts commit a801e6d. See sagemath#33446.
This needs the soname (as in sage.env.GAP_SO) which has issues for system gap as explained in sagemath#33446. Instead we dlopen() the extension module sage.libs.gap.util which, having a link time dependency to libgap, will indirectly dlopen() it. For the record: by the time we run dlopen() the libgap should be already loaded. The purpose of doing it is to change mode to RTLD_GLOBAL so that symbols in libgap are placed in the global symbol table. This is required to compiled load gap packages. An easy test that this is working ok is: sage: libgap.LoadPackage("io") true This requires optional spkg `gap_packages` to be installed.
…isambiguate the workspace file, not SAGE_LOCAL" This reverts commit a801e6d. See sagemath#33446.
This needs the soname (as in sage.env.GAP_SO) which has issues for system gap as explained in sagemath#33446. Instead we dlopen() the extension module sage.libs.gap.util which, having a link time dependency to libgap, will indirectly dlopen() it. For the record: by the time we run dlopen() the libgap should be already loaded. The purpose of doing it is to change mode to RTLD_GLOBAL so that symbols in libgap are placed in the global symbol table. This is required to compiled load gap packages. An easy test that this is working ok is: sage: libgap.LoadPackage("io") true This requires optional spkg `gap_packages` to be installed.
…isambiguate the workspace file, not SAGE_LOCAL" This reverts commit a801e6d. See sagemath#33446.
My system (void linux) only has
installed. Indeed, the symlink
/usr/lib/libgap.so -> libgap.so.0.0.0
is shipped ingap-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 forlibgap.so
instead oflibgap.so*
. The fix is trivial:Note that this function is only used once in
sage.env
to setGAP_SO
.Without the fix above my
GAP_SO
is set toNone
and I get failures likeDepends 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
The text was updated successfully, but these errors were encountered: