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

Without using Libdl building SpecialFunctions fails on Julia-dev #71

Closed
chriselrod opened this issue Jan 13, 2018 · 0 comments
Closed

Comments

@chriselrod
Copy link

chriselrod commented Jan 13, 2018

Pkg.build("SpecialFunctions")
[ Info: Building SpecialFunctions
┌ Warning: `info()` is deprecated, use `@info` instead.
│   caller = top-level scope at <missing>:10
└ @ Core <missing>:10
INFO: Building openspecfun from source by request
ERROR: LoadError: LoadError: UndefVarError: Libdl not defined
Stacktrace:
 [1] top-level scope
 [2] include at ./boot.jl:292 [inlined]
 [3] include_relative(::Module, ::String) at ./loading.jl:521
 [4] include at ./sysimg.jl:26 [inlined]
 [5] include(::String) at /home/chris/.julia/v0.7/BinDeps/src/BinDeps.jl:3
 [6] top-level scope
 [7] include at ./boot.jl:292 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:521
 [9] include(::Module, ::String) at ./sysimg.jl:26
 [10] top-level scope
 [11] eval at ./boot.jl:295 [inlined]
 [12] top-level scope at ./<missing>:2
in expression starting at /home/chris/.julia/v0.7/BinDeps/src/dependencies.jl:636
in expression starting at /home/chris/.julia/v0.7/BinDeps/src/BinDeps.jl:583
┌ Error: ------------------------------------------------------------# Build failed for SpecialFunctions
│   exception =
│    LoadError: LoadError: Failed to precompile BinDeps to /home/chris/.julia/lib/v0.7/BinDeps.ji.
│    Stacktrace:
│     [1] error at ./error.jl:33 [inlined]
│     [2] compilecache(::String) at ./loading.jl:648
│     [3] compilecache at ./loading.jl:605 [inlined]
│     [4] _require(::Symbol) at ./loading.jl:440
│     [5] require(::Symbol) at ./loading.jl:333
│     [6] include at ./boot.jl:292 [inlined]
│     [7] include_relative(::Module, ::String) at ./loading.jl:521
│     [8] include at ./sysimg.jl:26 [inlined]
│     [9] include at ./loading.jl:555 [inlined]
│     [10] top-level scope at ./<missing>:11
│     [11] include at ./boot.jl:292 [inlined]
│     [12] include_relative(::Module, ::String) at ./loading.jl:521
│     [13] include at ./sysimg.jl:26 [inlined]
│     [14] include(::String) at ./loading.jl:555
│     [15] top-level scope
│     [16] eval at ./boot.jl:295 [inlined]
│     [17] eval at ./sysimg.jl:71 [inlined]
│     [18] evalfile(::String, ::Array{String,1}) at ./loading.jl:550 (repeats 2 times)
│     [19] #2 at ./none:12 [inlined]
│     [20] cd(::getfield(, Symbol("##2#5")){String}, ::String) at ./file.jl:70
│     [21] (::getfield(, Symbol("##1#3")))(::IOStream) at ./none:11
│     [22] open(::getfield(, Symbol("##1#3")), ::String, ::String) at ./iostream.jl:310
│     [23] top-level scope
│     [24] eval at ./boot.jl:295 [inlined]
│     [25] eval(::Module, ::Expr) at ./sysimg.jl:71
│     [26] process_options(::Base.JLOptions) at ./client.jl:301
│     [27] _start() at ./client.jl:375in expression starting at /home/chris/.julia/v0.7/SpecialFunctions/deps/scratch.jl:3in expression starting at /home/chris/.julia/v0.7/SpecialFunctions/deps/build.jl:6
└ @ Main none:15
┌ Warning: ------------------------------------------------------------# Build error summary
│ 
│ SpecialFunctions had build errors.
│ 
│  - packages with build errors remain installed in /home/chris/.julia/v0.7- build the package(s) and all dependencies with `Pkg.build("SpecialFunctions")`- build a single package by running its `deps/build.jl` script
└ @ Base.Pkg.Entry entry.jl:656
julia> libc_ptr = ccall(:jl_dlopen, Ptr{Cvoid}, (Ptr{Cvoid}, UInt32), C_NULL, 0)
Ptr{Nothing} @0x00007f7f62f68150

julia> glibc_ptr = Libdl.dlsym_e(libc_ptr, :gnu_get_libc_version)
ERROR: UndefVarError: Libdl not defined

julia> using Libdl

julia> glibc_ptr = Libdl.dlsym_e(libc_ptr, :gnu_get_libc_version)
Ptr{Nothing} @0x00007f7f61bf52d0

julia> versioninfo()
Julia Version 0.7.0-DEV.3393
Commit c5cd13ebe3* (2018-01-13 05:40 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i3-4010U CPU @ 1.70GHz
  WORD_SIZE: 64
  BLAS: libmkl_rt
  LAPACK: libmkl_rt
  LIBM: libimf
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)
Environment:

Edit:
Adding using Libdl to SpecialFunctions/deps/build.jl alone is not enough to fix the problem. I also had to add it to BinDeps, but then I got LoadError: LoadError: UndefVarError: pushfront! not defined.

Because I couldn't find anything about a Julia function called pushfront!, and the error occurred in deps/binaries.jl, I set ENV["JULIA_SPECIALFUNCTIONS_BUILD_SOURCE"] = true and SpecialFunctions built just fine.
Builds just fine, but it wont precompile.

Then the problem was:

julia> @checked_lib openspecfun "/home/chris/.julia/v0.7/SpecialFunctions/deps/usr/lib/libopenspecfun.so"
ERROR: LoadError: UndefVarError: Libdl not defined
Stacktrace:
 [1] @checked_lib(::LineNumberNode, ::Module, ::Any, ::Any) at /home/chris/.julia/v0.7/SpecialFunctions/deps/deps.jl:8
in expression starting at REPL[6]:1

So I edited `/deps/deps.jl' from:

macro checked_lib(libname, path)
    ((VERSION >= v"0.4.0-dev+3844" ? Base.Libdl.dlopen_e : Base.dlopen_e)(path) == C_NULL) && error("Unable to l$
    quote const $(esc(libname)) = $path end
end

# Load dependencies
@checked_lib openspecfun "/home/chris/.julia/v0.7/SpecialFunctions/deps/usr/lib/libopenspecfun.so"

to:

using Libdl
macro checked_lib(libname, path)
    ((VERSION >= v"0.4.0-dev+3844" ? Libdl.dlopen_e : Base.dlopen_e)(path) == C_NULL) && error("Unable to l$
    quote const $(esc(libname)) = $path end
end

# Load dependencies
@checked_lib openspecfun "/home/chris/.julia/v0.7/SpecialFunctions/deps/usr/lib/libopenspecfun.so"

Now everything works on my computer.
This is still an issue instead of a pull request, because there is probably a much cleaner way to fix the problem. (Short term when Compat updates?)
Eg, the file deps/deps.jl seems to have been created by the install process, so I would have to look into that.

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

No branches or pull requests

1 participant