Opened 6 years ago
Closed 7 months ago
#21174 closed enhancement (invalid)
MPIR: Do not install two (almost) identical libraries (with --enable-gmpcompat)
Reported by: | leif | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | packages: standard | Keywords: | libgmpxx libmpirxx gmp.h mpir.h |
Cc: | embray | Merged in: | |
Authors: | Reviewers: | Matthias Koeppe, Samuel Lelièvre | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | #32549 | Stopgaps: |
Description (last modified by )
When configuring MPIR with --enable-gmpcompat
(which we do in Sage by default), (almost) the same files get installed under two different names:
mpir.h
andgmp.h
-- identical copies (no links)mpirxx.h
andgmpxx.h
-- identical copies (no links)libmpir.a
andlibgmp.a
-- identical copies (no links)libmpirxx.a
andlibgmpxx.a
-- identical copies (no links)
More critical, as of MPIR 2.7.2, on ELF systems:
libmpir.so
[.16
[.6.2
]] andlibgmp.so
[.16
[.6.2
]] -- only thesoname
differslibmpirxx.so
[.8
[.4.2
]] andlibgmpxx.so
[.8
[.4.2
]] -- only thesoname
differs
(Similar on Darwin and Cygwin.)
This can lead to weird and hard-to-debug errors if programs or libraries accidentally link to both libmpir and libgmp (which may also happen if a program or library links to libraries A and B where A just uses libmpir and B only libgmp); see for example this thread on sage-devel.
Related: #21188
Change History (15)
comment:1 Changed 6 years ago by
- Description modified (diff)
comment:2 Changed 6 years ago by
- Description modified (diff)
comment:3 Changed 6 years ago by
For the first four instances, we could simply install symbolic links (on systems that support that) from *mpir*
to their respective *gmp*
counterparts (maybe also hard links, but symlinks seem more appropriate).
For the shared libraries, on ELF systems (and presumably analogously on Darwin) it would be sufficient to install just the GMP-named libraries and symbolic links from libmpir
[xx
].so
to libgmp
[xx
].so
, respectively.
Then the linker could (still) pick up -lmpir
(aka libmpir.so
, in a shared link) and would record libgmp.so.16
as the soname in the DT_NEEDED
tag; analogous for -lmpirxx
.
comment:4 Changed 6 years ago by
For the static libraries, it is less likely that accidentally (or unawarely) linking to both (as mentioned in the description, with libraries A and B for example) will cause trouble, although that's not impossible.
(Shared libraries could as well have linked to one of the static libraries, reexporting symbols from GMP/MPIR, but that would presumably be a mistake by itself.)
comment:5 Changed 6 years ago by
I'll probably suggest a patch upstream adding at least a configure
option --only-gmpcompat
which would not install any of the *mpir*
files in addition.
comment:6 follow-up: ↓ 7 Changed 6 years ago by
+1 to all of the above.
Though within Sage itself, if we have taken care to remove explicit "mpir" references then maybe even the symlinks shouldn't be necessary. I have a patch to Singular that I will post in a separate ticket that removes the dangling "mpir" references that caused the problem in the first place.
comment:7 in reply to: ↑ 6 ; follow-up: ↓ 8 Changed 6 years ago by
Replying to embray:
+1 to all of the above.
Though within Sage itself, if we have taken care to remove explicit "mpir" references then maybe even the symlinks shouldn't be necessary.
I don't have a strong opinion on whether to install links or not; without them, we hopefully won't run into the mess you had again, but I'm open for different solutions on Cygwin anyway (I cannot test myself). IIRC on Cygwin it's harder to separate "Sage libraries" from the system's, and it's probably not uncommon for Cygwin users to have both MPIR and GMP installed "system-wide".
I have a patch to Singular that I will post in a separate ticket that removes the dangling "mpir" references that caused the problem in the first place.
CC me then.
comment:8 in reply to: ↑ 7 ; follow-up: ↓ 9 Changed 6 years ago by
Replying to leif:
Replying to embray:
+1 to all of the above.
Though within Sage itself, if we have taken care to remove explicit "mpir" references then maybe even the symlinks shouldn't be necessary.
I don't have a strong opinion on whether to install links or not; without them, we hopefully won't run into the mess you had again, but I'm open for different solutions on Cygwin anyway (I cannot test myself). IIRC on Cygwin it's harder to separate "Sage libraries" from the system's, and it's probably not uncommon for Cygwin users to have both MPIR and GMP installed "system-wide".
I don't agree, no. It's not harder to separate, and there's no reason Cygwin users should have both installed any more than anyone else.
comment:9 in reply to: ↑ 8 Changed 6 years ago by
Replying to embray:
Replying to leif:
Replying to embray:
+1 to all of the above.
Though within Sage itself, if we have taken care to remove explicit "mpir" references then maybe even the symlinks shouldn't be necessary.
I don't have a strong opinion on whether to install links or not; without them, we hopefully won't run into the mess you had again, but I'm open for different solutions on Cygwin anyway (I cannot test myself). IIRC on Cygwin it's harder to separate "Sage libraries" from the system's, and it's probably not uncommon for Cygwin users to have both MPIR and GMP installed "system-wide".
I don't agree, no. It's not harder to separate, and there's no reason Cygwin users should have both installed any more than anyone else.
No idea, I thought I had read something like that a while ago.
So you're in favour of not installing links (which AFAIK wouldn't be possible on Cygwin anyway)?
comment:10 Changed 6 years ago by
- Description modified (diff)
comment:11 follow-up: ↓ 12 Changed 6 years ago by
No, links work in Cygwin. Hard links and symlinks.
comment:12 in reply to: ↑ 11 Changed 6 years ago by
Replying to embray:
No, links work in Cygwin. Hard links and symlinks.
Good to know, one thing less to care about (in general).
comment:13 Changed 7 months ago by
- Dependencies set to #32549
- Milestone changed from sage-7.4 to sage-duplicate/invalid/wontfix
- Status changed from new to needs_review
outdated after mpir removal in #32549
comment:14 Changed 7 months ago by
- Reviewers set to Matthias Koeppe, Samuel Lelièvre
- Status changed from needs_review to positive_review
Ok.
comment:15 Changed 7 months ago by
- Resolution set to invalid
- Status changed from positive_review to closed
Typo.