-
Notifications
You must be signed in to change notification settings - Fork 0
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
build: Pre-installing #58
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So if a filename changes, the previous object file doesn't get linked too.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #56
This is going to be the big new feature in v0.2.2.
One issue I'm having on macOS specifically is that, since dyld doesn't do
/lib
searching by default (when you link the full path of the library you're linking against is stored), pre-installing will fail. A solution to this would be to pre-install in the final destination, but that makes things difficult when we encounter the "already compiled" or "already linked" situation, because we'll need to install it in that situation too.The dyld(1) manpage provides a solution to this under "DYNAMIC LIBRARY LOADING", but I think it's probably best to accomodate things how they are intended and push through with pre-installing to the final destination.
Update: this is done now (and has the added benefit of simplifying things a bit). I have a new issue on macOS though. When initially linking, the dynamic shared library install name is set to the path of the library in
.bob/bob
. When installing though, we need to update this usinginstall_name_tool
.This poses a bit of a challenge though, as we need to figure out exactly what something is being linked against to be able to update it's path. Actually Bob v0.1.0 may have the solution to this issue; just pass dynamic libraries to link as an array.
I need to think about this some more but the easiest solution might just be to set the
rpath
and do the "non-accomodating" solution. Hint:otool
can be used to inspect all these values on a library or a binary.macOS is winding up being a little annoying to support 😄 But I had been warned that libraries were complicated and different on macOS.
Update 2 (final solution):
@rpath/lib/libwhatever.so
. This means that any rpath we set on another shared library or executable will be substituted for@rpath
.-rpath "@loader_path/.."
. That way, when looking forlibwhatever.so
, we'll look in@loader_path/../lib/libwhatever.so
, which will work both in the temporary install prefix and relatively wherever we install.This excellent blog post is what helped me grasp this.
Here's all that's left to do:
dylib
parameter when (pre)installing smarter, i.e. infer this instead of having to pass this around the place.cookie_to_output
function so we can log that out when linking (instead of just saying "Linking...").