Skip to content

Static compilation and *_jll packages is not relocatable #83

@apozharski

Description

@apozharski

It would be very useful if the binary wrapping packages built by *_jll were relocatable. Currently the artifact path is determined at compile time in these lines:

        function find_artifact_dir()
            # We determine at compile-time whether our JLL package has been dev'ed and overridden
            @static if isdir(joinpath(dirname($(pkg_dir)), "override"))
                return joinpath(dirname($(pkg_dir)), "override")
            elseif @isdefined(augment_platform!) && VERSION >= v"1.6"
                $(Expr(:macrocall, Symbol("@artifact_str"), __source__, src_name, __module__.host_platform))
            else
                # We explicitly use `macrocall` here so that we can manually pass the `__source__`
                # argument, to avoid `@artifact_str` trying to lookup `Artifacts.toml` here.
                return $(Expr(:macrocall, Symbol("@artifact_str"), __source__, src_name))
            end
        end

Why: My current use case is to build a C interface for a package (namely MadNLP.jl) which pulls in HSL_jll the publicly available form of which is just a shim with no actual functionality. As such the end user (in an ideal case) would have to provide their own version of HSL_jll and an Overrides.toml that points to it. However because the overrides are determined at compile-time, the paths and overrides are compiled statically into the binaries and there is no way for a user to point these to a different place after the fact.

I do not entirely understand at the moment if there are some major performance implications to changing the code to determining the artifact directory at e.g. __init__() time, but doing so would greatly improve the relocatability of bundles which include *_jll packages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions