Skip to content

Implement versioned library naming and rename libruststd back to libstd #1157

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

Closed
brson opened this issue Nov 8, 2011 · 14 comments
Closed

Implement versioned library naming and rename libruststd back to libstd #1157

brson opened this issue Nov 8, 2011 · 14 comments
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup.

Comments

@brson
Copy link
Contributor

brson commented Nov 8, 2011

In 16dad84 we made the crate search based purely on metadata, so that we could rename libstd to libruststd.

As graydon pointed out, we are supposed to name our libraries lib[name]-[hash]-[version].so, so there's no way that libstd should cause a name collision.

Implement this naming convention, revert the above change and rename libruststd back to libstd.

@ghost ghost assigned brson Nov 8, 2011
@lht
Copy link
Contributor

lht commented Nov 9, 2011

I will work on this. I like the idea of putting hash in library file name!

A few questions:
Should version of the soname be used when searching a library?
And should we follow the naming convention of putting version after ".so"?
Last, Should we verify if the hash is correct when linking?

@brson
Copy link
Contributor Author

brson commented Nov 9, 2011

There are some very detailed comments about how Rust versioning is supposed to work in src/comp/back/link.rs that you should read.

I don't know anything about sonames so can't answer the first two questions (my guess is the answer to both is no - we're creating our own, platform-agnostic versioning mechanism). Maybe graydon has an opinion.

As to the last question, we don't need to verify the hash. This hash is just a hash of the exported metadata (everything in the #[link] attribute), and used to help differentiate the filename from other builds of the same library. I don't think we're using it for any security properties.

I'm a bit worried about how this will impact the build system since we won't be able to know the names of the libraries we're producing.

@lht
Copy link
Contributor

lht commented Nov 18, 2011

Regarding to build system impact, how about break it into steps:

  1. rustc --lib links output to libfoo.so. The canonical library name is still used when building, so it is perfectly predictable.
  2. Add an option like rustc --hash which read the metadata of a library and compute a hash
  3. make install invokes rustc --hash against each library and rename it when copying to target folder.

Or combine 2 and 3 by implementing something like rustc --install-lib.

@brson
Copy link
Contributor Author

brson commented Nov 18, 2011

It seems to me like this would require installing a library in order to use it, which is pretty awkward. Regardless, I don't feel comfortable making a decision on this without @graydon's input.

@lht
Copy link
Contributor

lht commented Nov 19, 2011

I think a library with name like libfoo.so is still okay to use directly. The metadata will be matched to decide if this is the correct version when resolving the use directive.

@brson
Copy link
Contributor Author

brson commented Nov 19, 2011

But we'll link against libfoo.so, then install it, then libfoo.so doesn't exist.

@brson
Copy link
Contributor Author

brson commented Dec 2, 2011

Graydon and I discussed this on IRC recently and he is of the opinion that we will be able to use wildcard rules as well as rules that run touch on dummy files but produce actual hashed libraries as side effects to make this work. Honestly, I am still skeptical but we can go ahead and implement this. The hardest part about this is definitely going to be updating the Rust build system.

@brson
Copy link
Contributor Author

brson commented Dec 2, 2011

I was thinking about this more, and if the hashes are only based on version metadata (and possibly the version of dependencies) then the hash will be fairly stable - you'll just have to do some experimentation and edit the makefiles every time metadata changes.

lht added a commit to lht/rust that referenced this issue Dec 3, 2011
@lht
Copy link
Contributor

lht commented Dec 3, 2011

I'm more inclined graydon's idea of using glob to copy. I tried implement that in commit 7cdb18d.

The version number is quite stable for now, but it might be changing more often whenever we had minor and major updates after public release. And editing makefiles for updating filenames seems not good. Especially if there was a chain of dependent libraries.

Hash of dependencies is not implemented yet in this series.

@brson
Copy link
Contributor Author

brson commented Dec 6, 2011

Oops, I didn't notice you had done so much work on this. Is it ready to merge?

@lht
Copy link
Contributor

lht commented Dec 6, 2011

If you think what have done is okay, I would prefer to implement the rest (hash of dependencies) and then get the series merged together. I want to reduce the times of updating snapshots.

@brson
Copy link
Contributor Author

brson commented Dec 6, 2011

OK, I will wait.

@graydon
Copy link
Contributor

graydon commented Dec 14, 2011

I think this bug is done now, no? was just tracking on pull req 1268 really?

@lht lht closed this as completed Dec 15, 2011
@lht
Copy link
Contributor

lht commented Dec 15, 2011

Yes, closing it.

coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* Add kani logo

* Update copyright exclude to include .ico files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup.
Projects
None yet
Development

No branches or pull requests

3 participants