Skip to content
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

Merged
merged 5 commits into from
Feb 2, 2023

Conversation

mosteo
Copy link
Member

@mosteo mosteo commented Jan 22, 2023

I'm confident I have now a clear roadmap in my head for what we want and what we may achieve easily. It's documented in the new doc/AEPs file.

This PR lays the foundation, creating the alr install subcommand, and allowing only the installation of binary crates like the ones we already have.

@mosteo mosteo marked this pull request as ready for review January 22, 2023 20:10
Copy link
Member

@Fabien-Chouteau Fabien-Chouteau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think during our last discussion we said we are not going to worry about what can go wrong and just call gprinstall recursively on all the dependencies. Are you moving to something more involved?

I have a couple question on the AEP.

└── libhello=1.0.1
```

First caveat is that `gprinstall` clobbers `prefix/share/gpr/libhello.gpr`
Copy link
Member

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?

   package Install is
      for Artifacts (".") use ("share");
   end Install;

Copy link
Member Author

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.

Copy link
Member Author

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.

```
$ ldd prefix/bin/hello
linux-vdso.so.1 (0x00007fffa772f000)
Libhello.so.1.0.1 => not found
Copy link
Member

Choose a reason for hiding this comment

The 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 LD_LIBRARY_PATH?

Copy link
Member Author

Choose a reason for hiding this comment

The 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 --lib-subdir so lib softlinks are placed together with executables in bin? Would be acceptable I think.

Copy link
Member

Choose a reason for hiding this comment

The 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 LD_LIBRARY_PATH?

"Build static or deal with the consequences" :)

Copy link
Member Author

@mosteo mosteo Jan 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, but is just one dir to add, LD_LIBRARY_PATH+=:$HOME/.alire/lib (or bin). I considered that acceptable if someone does want to go the dynamic way.

Copy link
Member

Choose a reason for hiding this comment

The 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:

 lib/libhello=1.0.0/libhello/
 lib/libhello=1.0.1/libhello/

etc.

Copy link
Member Author

Choose a reason for hiding this comment

The 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 gprinstall, not even us), e.g.:

lib/libhello.so.1.0.0 --> lib/libhello=1.0.0/libhello/libhello.so.1.0.0
lib/libhello.so.1.0.1 --> lib/libhello=1.0.1/libhello/libhello.so.1.0.1

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 gprbuild. And, as by default we're using static linking, the issue doesn't even arise unless the user forces dynamic linking.

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.

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`
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I too was thinking from the POV of our template projects.

@mosteo
Copy link
Member Author

mosteo commented Jan 23, 2023

I think during our last discussion we said we are not going to worry about what can go wrong and just call gprinstall recursively on all the dependencies. Are you moving to something more involved?

No, precisely what I found during my latest tests it that that is not only the simplest, but also the best way for us to go.

The use of gprbuild will come in a later PR for regular crates, as that is not necessary for binary crates without project files.

@mosteo mosteo merged commit fcc4819 into alire-project:master Feb 2, 2023
@mosteo mosteo deleted the feat/install-bin branch February 2, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants