Skip to content
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

Repair jl_init. #38950

Merged
merged 2 commits into from
Dec 21, 2020
Merged

Repair jl_init. #38950

merged 2 commits into from
Dec 21, 2020

Conversation

GunnarFarneback
Copy link
Contributor

Cc: @staticfloat

As noted in #38160 (comment), jl_init is no longer correctly finding the location of libjulia. This PR attempts to fix that by exporting a function that lives in libjulia and can reliably introspect itself to find the libjulia location, then uses that from jl_init.

@GunnarFarneback
Copy link
Contributor Author

What is a good way to test that this would work with the directory layout of the packaged Julia binaries? Can such packages be created locally?

Copy link
Member

@staticfloat staticfloat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@staticfloat
Copy link
Member

Can such packages be created locally?

Yeah, just run make install and it will create a directory in your source tree called julia-$(shorthash), which will contain the typical bin, lib, share`, etc... folders.

cli/loader_lib.c Outdated Show resolved Hide resolved
@GunnarFarneback GunnarFarneback changed the title [WIP] Repair jl_init. Repair jl_init. Dec 20, 2020
@GunnarFarneback GunnarFarneback changed the title Repair jl_init. [WIP] Repair jl_init. Dec 20, 2020
@GunnarFarneback
Copy link
Contributor Author

Not all is good. This isn't working in the package from make install.

julia> using Libdl

julia> Libdl.dlpath("libjulia")
ERROR: could not load library "libjulia"
libjulia.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
   @ Base.Libc.Libdl ./libdl.jl:114
 [2] dlopen
   @ ./libdl.jl:114 [inlined]
 [3] dlpath(libname::String)
   @ Base.Libc.Libdl ./libdl.jl:237
 [4] top-level scope
   @ REPL[2]:1

@staticfloat
Copy link
Member

staticfloat commented Dec 21, 2020

I'm pretty sure this is not a problem with this PR; that happens on latest master for me as well. If you use the full SONAME (libjulia.so.1) it works.

@GunnarFarneback
Copy link
Contributor Author

Right, and it seems to be a difference between what make install produces and the nightly binaries. Taking that into account it passes the tests I wanted to do (building and running the embedding example and running the tests of the DynamicallyLoadedEmbedding package with the packaged Julia).

So this is ready to go from my point of view.

@GunnarFarneback GunnarFarneback changed the title [WIP] Repair jl_init. Repair jl_init. Dec 21, 2020
@KristofferC KristofferC added the backport 1.6 Change should be backported to release-1.6 label Dec 21, 2020
@KristofferC KristofferC merged commit 5cd07f8 into JuliaLang:master Dec 21, 2020
@GunnarFarneback GunnarFarneback deleted the fix_jl_init branch December 21, 2020 12:16
@GunnarFarneback
Copy link
Contributor Author

Apparently there is still some problem on windows https://github.com/GunnarFarneback/DynamicallyLoadedEmbedding.jl/runs/1594639460 and macos https://github.com/GunnarFarneback/DynamicallyLoadedEmbedding.jl/runs/1594639444. I should be able to get hold of a windows machine to test locally but macos is out of my reach.

KristofferC pushed a commit that referenced this pull request Dec 27, 2020
* Export jl_get_libdir and use it from jl_init to find libjulia.

(cherry picked from commit 5cd07f8)
@KristofferC KristofferC mentioned this pull request Dec 27, 2020
26 tasks
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Jan 6, 2021
staticfloat pushed a commit that referenced this pull request Jan 15, 2021
* Export jl_get_libdir and use it from jl_init to find libjulia.

(cherry picked from commit 5cd07f8)
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
* Export jl_get_libdir and use it from jl_init to find libjulia.
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
* Export jl_get_libdir and use it from jl_init to find libjulia.

(cherry picked from commit 5cd07f8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants