-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
alr install
redux: Installation of binary crates
#1302
Changes from 4 commits
e33fc7d
82de695
541e571
451b6da
ca1088b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ | |
# Mark some misidentified files as always binaries | ||
*.pdf -text | ||
*.png -text | ||
*.tgz -text |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
AEP: 3 | ||
Title: Command `alr install` information | ||
Author: Alejandro R. Mosteo <[email protected]> | ||
Status: Draft | ||
Created: 2022-01-19 | ||
|
||
Abstract | ||
======== | ||
|
||
Information gathered about the operation of `gprinstall`, relevant to our | ||
purposes of how to work with static/dynamic libraries and with different | ||
versions of the same library/compilers. | ||
|
||
Information | ||
=========== | ||
|
||
By using different names during installation, several versions of the same lib | ||
can be made to coexist, with some caveats. | ||
|
||
For example, after having installed libhello 1.0.0 (static) and libhello 1.0.1 | ||
(dynamic) and hello 1.0.2 (dynamic), we obtain this tree: | ||
|
||
``` | ||
prefix/ | ||
├── bin | ||
│ └── hello | ||
├── include | ||
│ ├── hello=1.0.2 | ||
│ │ └── hello | ||
│ │ ├── hello.adb | ||
│ │ └── hello_config.ads | ||
│ ├── libhello=1.0.0 | ||
│ │ └── libhello | ||
│ │ ├── libhello.adb | ||
│ │ └── libhello.ads | ||
│ └── libhello=1.0.1 | ||
│ └── libhello | ||
│ ├── libhello.adb | ||
│ ├── libhello.ads | ||
│ └── libhello_config.ads | ||
├── lib | ||
│ ├── libhello=1.0.0 | ||
│ │ └── libhello | ||
│ │ ├── libhello.a | ||
│ │ └── libhello.ali | ||
│ ├── libhello=1.0.1 | ||
│ │ └── libhello | ||
│ │ ├── libhello.ali | ||
│ │ ├── libhello_config.ali | ||
│ │ ├── Libhello.so.1.0.1 | ||
│ │ └── libLibhello.so -> ../libhello/Libhello.so.1.0.1 | ||
│ ├── Libhello.so.1.0.1 -> ../lib/libhello=1.0.1/libhello/Libhello.so.1.0.1 | ||
│ └── libLibhello.so -> ../lib/libhello=1.0.1/libhello/libLibhello.so | ||
└── share | ||
└── gpr | ||
├── hello.gpr | ||
├── libhello.gpr | ||
└── manifests | ||
├── hello=1.0.2 | ||
├── libhello=1.0.0 | ||
└── libhello=1.0.1 | ||
``` | ||
|
||
First caveat is that `gprinstall` clobbers `prefix/share/gpr/libhello.gpr` | ||
without warning, even if `-f` was not used. This means that an installation | ||
with the purpose of development cannot have several versions installed. | ||
|
||
Still, it seems we could rely on such a prefix for executables depending on | ||
different versions of the same dynamic library, as ldd shows the proper | ||
dependency: | ||
|
||
``` | ||
$ ldd prefix/bin/hello | ||
linux-vdso.so.1 (0x00007fffa772f000) | ||
Libhello.so.1.0.1 => not found | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But then don't you have to set lib dirs of installed libraries in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I expected this to be necessary in any case, unless we override with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the kind of "complexity" that we don't want to deal with I would say. How would one know the list of dirs to add in "Build static or deal with the consequences" :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, but is just one dir to add, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes one dir that's always the same is easy. My understanding of what is in this PR is that there would be different folders:
etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those would exist too, but there is always a softlink from the single dir we decide to use (created by lib/libhello.so.1.0.0 --> lib/libhello=1.0.0/libhello/libhello.so.1.0.0 To summarize, we can have both binaries and links to libraries in a single dir. The actual libraries reside in subdirs. This is all managed by But actually that's not in this PR yet, which only copies binaries in place. We can verify in the follow-up PR I'm preparing that things fall into place as I think. |
||
libgnat-12.so => /path/to/compiler/.../libgnat-12.so (0x00007fda1ca0e000) | ||
libgcc_s.so.1 => /path/to/compiler/.../libgcc_s.so.1 (0x00007fda1c7ef000) | ||
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fda1c5c5000) | ||
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fda1c5c0000) | ||
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fda1c4d9000) | ||
/lib64/ld-linux-x86-64.so.2 (0x00007fda1d0b4000) | ||
``` | ||
|
||
By using `--mode=usage`, there is no ali, gpr or source files installed. So | ||
going with this mode, unneeded conflicting files are not even installed. | ||
|
||
Uninstalling two versions will remove the gpr file after the first uninstall. | ||
However, the second uninstall will not fail, silently removing the rest of | ||
files. | ||
|
||
For uninstallation we need to supply the project file, which can come from the | ||
original build folder or from the installed share/gpr location. | ||
|
||
However, when installing in usage mode, there will be no gpr file installed, | ||
forcing to preserve the original project file. | ||
|
||
In usage mode, static libraries are not installed, and no manifest is created | ||
if nothing gets installed. Uninstalling will then complain about lack of manifest. | ||
|
||
It seems that, at least for basic code, an executable build with a compiler and | ||
a dynamic library build with another are compatible. | ||
|
||
Executables depend on properly versioned `.so.x.x.x` files, so the extra `.so` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That depends on what the developers set in the library GPR file. By default Alire generates a correct GPR, but there's not guaranty people will not change them. In my opinion we should not care about this case, but it's better to keep it in mind. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, I too was thinking from the POV of our template projects. |
||
file clobbered by several installs is not important. | ||
|
||
Summary of findings | ||
=================== | ||
|
||
- Several dynamic versions of a library are possible, for executables. | ||
- Development with several versions is not possible. | ||
- Dependencies on libraries from the compiler also appear. | ||
- It would then be better to use a compiler from within the prefix. | ||
- Uninstall of several versions requires preserving the original project file. | ||
- When uninstalling only one version, the installed gpr file suffices. | ||
- Compiler consistency between dynamic libraries is not mandatory. | ||
- Executables link against the properly versioned dynamic library. | ||
|
||
Proposal | ||
======== | ||
|
||
Given these findings, and the primary need of using `alr install` to make binaries | ||
available, and not to make development libraries available, we can abandon this | ||
latter notion for good. Sharing of large dependencies, if ever implemented will use | ||
a different mechanism. | ||
|
||
For installing executables, each installation can be performed on its own: we need | ||
not track crates (as we can check the gprinstall manifests) nor consider | ||
incompatibilities, as there are none. Worst case, two releases from the same crate | ||
would be detected by their manifests, and two different crates clobbering each other | ||
would be detected during `gprinstall`. | ||
|
||
For uninstallation, we may redeploy sources to have access to the original project | ||
files. | ||
|
||
For (un)installation of local crates, there's also no issue: they will use the local | ||
version, and we have the gpr file available too for both. | ||
|
||
We could consider caching build directories for faster installs of related crates | ||
sharing several dependencies, and faster uninstallation. This would incur some disk | ||
usage penalty so we may want to make this optional. | ||
|
||
We may want to track dependencies to prevent uninstallation of libraries which are | ||
depended upon. This would be a final enhancement. Uninstallation doesn't seem to be | ||
a pressing matter, as prefixes will be fast to recreate. | ||
|
||
Tracking of dependencies isn't trivial as we can't use a single root (there will be | ||
"incompatible" (in solution sense) crates installed quite often, if only because of | ||
forced compilers). | ||
|
||
Roadmap | ||
======= | ||
|
||
Wanted and simple to implement: | ||
|
||
- Installation of binary releases | ||
- Un-uninstallable if there is no project file | ||
- Installation of local releases | ||
- Installation of indexed releases | ||
|
||
Optional or low priority: | ||
|
||
- Uninstallation relying on project file (local/indexed releases) | ||
- Uninstallation of binary releases without a project file | ||
- Using our own-created manifest during installation | ||
- Tracking of dependencies | ||
- To prevent uninstalls with dependents | ||
- Or to also uninstall dependents | ||
|
||
Out of scope: | ||
|
||
- Installation for development (users can manually do this via alr exec -- gprinstall) | ||
|
||
Copyright | ||
========= | ||
|
||
This document has been placed in the public domain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the different versions are installed in sub dirs of
lib/
? Do you have to change something in the GPR file for that?What about the installation artifacts? Where are they installed in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the libs are installed redundantly in the
/lib
folder (as a softlink) and in the named subfolders (as the proper file).I expect that not using an installation name we would lose the ability to uninstall, and the libs will end just in
/lib
. (I didn't try this.)I didn't try with Artifacts, either. Will do. If they don't behave as expected with installation names, we can simply drop that and the possibility of uninstallation altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a couple of more tests to the AEP file. In short, softlinks to libs can be placed where convenient, although
LD_LIBRARY_PATH
still will be needed, and artifacts still work as expected.