-
Notifications
You must be signed in to change notification settings - Fork 15
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
Discussion: Flexible paths for binary dependencies generated in deps.jl
files?
#22
Comments
CC: @staticfloat Weeeeeeeeeeeeeee here we go! XD |
CC: @ranjanan |
@staticfloat: After more reflection, I think that the solution will really have to be something that has the shape of That is, rather than producing these global, unconditioned For more clarity, we'd like the generated definitions to look something like this: const libmbedcrypto = "libmbedcrypto.2.11.0.dylib") # like this
const libmbedtls = "./libmbedtls.10.dylib" # or like this
const libmbedx509 = "usr/lib/libmbedx509.0.dylib" # or like this
const libxyz= "../libs/libxyz.dylib" # or like this |
Just checking in on this again to note that Artifacts should satisfy many of the desires here, especially as you can now set |
Oh? That sounds really awesome! thanks @staticfloat! My concern, though, is still about being able to set relative paths. I'm not entirely sure this will help. That is, if a user downloads an application bundle, they need to be able to move it around on their computer, and all of the compiled-in paths to binary files must still work. Is that being addressed by the Artifacts design? Will setting one of those paths to a relative path be enough to get this to Just Work? I'm afraid that currently, in BinaryProvider, a lot of the generated paths are still absolute paths generated using CC:@KristofferC |
The depot path is set relative to the absolute path of the executable (which is looked up at runtime). I'll have a proof of concept of it in PackageCompilerX in not too long. |
Perfect, that's exactly what i was hoping to hear! :) Yes, that will work wonderfully. Thanks! |
As an example JuliaLang/PackageCompilerX.jl#13. Running
During runtime the app prints a bunch of stuff (including executing the artifact):
You can move the folder |
That looks amazing. Thanks for picking this up, @KristofferC! :) |
This is an open thread for discussing one of the big remaining problems with ApplicationBuilder/PackageCompiler: Handling binary dependencies.
The state of the world:
Many packages depend on external shared libraries, which will be referenced via
ccall
. Most of these packages handle the process of installing and locating these dependencies through BinDeps and friends. In these cases, they will have abuild.jl
that generates adeps.jl
, such that thedeps.jl
definesconst
variables with hard-coded absolute paths to the libraries. e.g.:In addition, some packages reference these libraries via
ccall
from their__init__
functions, which isn't overridable via the hacks we're currently using in ApplicationBuilder (eg in examples/blink.jl).Problem statement:
Compiled and bundled apps need to copy these shared libraries into their bundle directory, so that they're self contained, and all code that references them must reference them via relative paths to their in-bundle locations. (The paths must be relative because the entire app bundle can be relocated after compilation.) There cannot be any references to the original installed
Pkg
directories evaluated while compiling, because the path provided toccall
is compiled-in, rather than reevaluated at runtime.Potential solution ideas:
Super simple/dumb: make
build.jl
aware of the ENV variables ApplicationBuilder is using when compiling, and generatedeps.jl
files that conditionally use a simpler relative path if that ENV variable is true.The newerdeps.jl
files generated by BinaryBuilder.jl generates variables whose paths are relative-ish: relative to thedeps.jl
file:So possibly, we can take advantage of this by somehow copying thedeps.jl
file into the bundle as well when compiling? As far as I know, though, this won't work because there's no way to copy only the deps file and trick a module into seeing that one when it runsinclude
.EDIT: What I wrote above doesn't actually make sense, because EVEN IF we did all that, the resultant paths would STILL be absolute-paths: just absolutely pointing into the app bundle. But as soon as you move the app bundle anywhere, it breaks again. The
ccall
s MUST be providing a relative path relative to the application's cwd!Add in a hook that you can somehow define that, when provided, will cause all variables to have their paths defined relative to some other path you provide (which could simply be
""
in our case)... This is vague..@checked_lib
, which somehow looks for your hook and then creates one definition or the other.The text was updated successfully, but these errors were encountered: