-
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
Fully automatic Hermetic / Portable bundles #52
Comments
This reminds me of an open question:
|
Ah, okay! I spent a while banging my head against this, and now i realize: The things I described above do in fact work on the Mac! Hooray! But I was getting held up because of the function check_deps()
global libduckdb
if !isfile(libduckdb)
error("$(libduckdb) does not exist, Please re-run Pkg.build(\"DuckDB\"), and restart Julia.")
end
if Libdl.dlopen_e(libduckdb) in (C_NULL, nothing)
error("$(libduckdb) cannot be opened, Please re-run Pkg.build(\"DuckDB\"), and restart Julia.")
end
end So even though the actual I think the easiest path forward will just be to |
The current system for creating portable, self-contained, downloadable binaries is quite fragile.
The main problem is about embedding all non-code dependencies needed by your code and its package dependencies. The main two types of such dependencies are libraries and resources.
The current steps to bundle everything up are quite manual. For resources, and libraries, the steps include the following:
Libraries/
(orResources/
) (hopefully no name collisions!)deps.jl
file, and change them to be relative paths from the binary's path."COMPILING_APPLE_BUNDLE"=>true
.rpaths
to not point outside the binary, ...It can be hard to even figure out which libraries to copy into the application, and this can change as your dependencies are updated. And then, even once you find them, it is very fragile to try to change the variables in the packages themselves to point to the new relative paths for the libraries/resources.
This Issue is to try to find a more robust, automatic, and complete solution.
Based on a conversation I had with @staticfloat at JuliaCon2018, and now with
Pkg3
, I think we can make this work by re-instantiating the entire.julia
directory inside the application bundle before building (by simply pointingJULIA_DEPOT_PATH
inside the application bundle and runningPkg.instantiate()
).The problem then is that the libraries will still be specified via absolute paths, but based on conversations with @rbvermaa, I think we can get around this via a pass over the directory tree that attempts to replace all such absolute paths with relative paths. Fortunately, most of these paths are generated via only a few tools (
BinaryBuilder
/BinaryProvider
,BinDeps
, and a few others), so they should be fairly regular. In the long term, perhaps we can even have an option or environment variable or something that can cause those tools to emit paths in the format we want directly.This is the basic idea that I am going to try exploring over the next couple days:
src/
andtest/
dirs].There are likely to be some remaining problems, but maybe we can follow the wizard approach used in
BinaryProvider
to create a script based on an interactive session with the user that can target any irregular paths that need to be fixed, or detect them via some other automation (such as running the final binary, detecting dynamic loads outside the app, fixing them, rebuilding, and repeat).The relative paths we use to replace the absolute paths for loading libraries will need to be relative to the executable path, so that the user can move the application bundle around after installing it on their system. On Macs, there is built-in support for this: Julia's
Base.DL_LOAD_PATH
loads relative to the executable load path via"@loader_path"
. On Linux, we'll probably have to push the path to the binary intoDL_LOAD_PATH
manually before building and as the first step of loading the binary before runningjulia_main()
(which we can get fromargv[0]
, and already set asPROGRAM_FILE
in ApplicationBuilder).The text was updated successfully, but these errors were encountered: