Skip to content

JLLs built against libjulia_jll 1.5 are unusable in Julia 1.6 on macOS (breaks CxxWrap) #38925

@fingolfin

Description

@fingolfin

Thanks for merging PR #38829. However, there are still issues. Currently even with that fix, I still get this on latest Julia master:

julia> using CxxWrap
[ Info: Precompiling CxxWrap [1f15a43c-97ca-5a2a-ae31-89f07a497df4]
dyld: lazy symbol binding failed: Symbol not found: _jl_cstr_to_string
  Referenced from: /Users/mhorn/.julia/artifacts/0eb6ffcbe0cde10007a2678013611da80643b728/lib/libcxxwrap_julia.0.8.2.dylib
  Expected in: /Users/mhorn/Projekte/Julia/julia.master/usr/bin/../lib/libjulia.dylib

dyld: Symbol not found: _jl_cstr_to_string
  Referenced from: /Users/mhorn/.julia/artifacts/0eb6ffcbe0cde10007a2678013611da80643b728/lib/libcxxwrap_julia.0.8.2.dylib
  Expected in: /Users/mhorn/Projekte/Julia/julia.master/usr/bin/../lib/libjulia.dylib

or this:

julia> using GAP
[ Info: Precompiling GAP [c863536a-3901-11e9-33e7-d5cd0df7b904]
ERROR: LoadError: InitError: could not load library "/Users/mhorn/.julia/artifacts/50127818ecdc20c9948526407e04ae1b124e7bf1/lib/libgap.0.dylib"
dlopen(/Users/mhorn/.julia/artifacts/50127818ecdc20c9948526407e04ae1b124e7bf1/lib/libgap.0.dylib, 1): Symbol not found: _jl_n_threads
  Referenced from: /Users/mhorn/.julia/artifacts/50127818ecdc20c9948526407e04ae1b124e7bf1/lib/libgap.0.dylib
  Expected in: /Users/mhorn/Projekte/Julia/julia.master/usr/bin/../lib/libjulia.dylib
 in /Users/mhorn/.julia/artifacts/50127818ecdc20c9948526407e04ae1b124e7bf1/lib/libgap.0.dylib

Note that both examples work on Linux.

Both symbols are marked as JL_DLLEXPORT:

$ git grep 'JL_DLLEXPORT.*jl_cstr_to_string'
src/array.c:JL_DLLEXPORT jl_value_t *jl_cstr_to_string(const char *str)
src/julia.h:JL_DLLEXPORT jl_value_t *jl_cstr_to_string(const char *str);
$ git grep 'JL_DLLEXPORT.*jl_n_threads'
src/threading.c:JL_DLLEXPORT int jl_n_threads;
src/threading.h:extern JL_DLLEXPORT int jl_n_threads;   /* # threads we're actually using */

Looking a bit closer, we see jl_n_threads is missing in libjulia.dylib but present in libjulia-internal.dylib:

$ nm usr/lib/libjulia.dylib | fgrep jl_n_threads
$ nm usr/lib/libjulia-internal.dylib | fgrep jl_n_threads
000000000032b948 S _jl_n_threads

And jl_cstr_to_string is there in the internal copy, but in the public library, it is missing the leading underscore:

$ nm usr/lib/libjulia.dylib | fgrep jl_cstr_to_string
0000000000010720 s _jl_cstr_to_string_addr
0000000000001e61 T jl_cstr_to_string
$ nm usr/lib/libjulia-internal.dylib | fgrep jl_cstr_to_string
00000000000a2aa0 T _jl_cstr_to_string

Indeed, it seems all the re-exported function symbols miss the leading underscore.

So I think there are two separate problems here:

  1. the missing underscores
  2. the symbol jl_n_threads is not re-exported, despite having JL_DLLEXPORT. An oversight or intentional? If intentional, how can I replace it (basically, I just need to test if jl_n_threads > 1 -- so a getter function would do it for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions