动态库路径添加问题


#1

GMT.jl 是 GMT 软件的 julia 接口。我已经在 MacOS 下安装好了 GMT.jl 和 GMT 软件,但是还需要把 GMT 的动态库路径告诉 Julia (如果我没理解错的话)。但是按照官方文档的说法,没有实现,官方文档链接为 https://github.com/GenericMappingTools/GMT.jl

首先我添加了 push!(Libdl.DL_LOAD_PATH, "/Users/j/programs/gmt5/lib") 以后,julia 不能正常打开。我查看 julia 的文档,发现并没有 Libdl.DL_LOAD_PATH 这个常量,只有一个Base.LOAD_PATH。我在 Base.LOAD_PATH 添加还是不能使用。

我想问一下,是我操作的问题,还是 GMT.jl 的问题


#2

加一个 using Libdl


#3

还是有问题

julia> using Libdl

julia> varinfo(Libdl)
name                size summary                  
––––––––––––– –––––––––– –––––––––––––––––––––––––
DL_LOAD_PATH   102 bytes 2-element Array{String,1}
Libdl         51.199 KiB Module                   
RTLD_DEEPBIND    4 bytes UInt32                   
RTLD_FIRST       4 bytes UInt32                   
RTLD_GLOBAL      4 bytes UInt32                   
RTLD_LAZY        4 bytes UInt32                   
RTLD_LOCAL       4 bytes UInt32                   
RTLD_NODELETE    4 bytes UInt32                   
RTLD_NOLOAD      4 bytes UInt32                   
RTLD_NOW         4 bytes UInt32                   
dlclose          0 bytes typeof(dlclose)          
dlext           13 bytes String                   
dllist           0 bytes typeof(dllist)           
dlopen           0 bytes typeof(dlopen)           
dlopen_e         0 bytes typeof(dlopen_e)         
dlpath           0 bytes typeof(dlpath)           
dlsym            0 bytes typeof(dlsym)            
dlsym_e          0 bytes typeof(dlsym_e)          
find_library     0 bytes typeof(find_library)     

julia> push!(Libdl.DL_LOAD_PATH, "/Applications/GMT-6.0.0rc4.app/Contents/Resources/lib")
3-element Array{String,1}:
 "@loader_path/julia"                                   
 "@loader_path"                                         
 "/Applications/GMT-6.0.0rc4.app/Contents/Resources/lib"

julia> using GMT

julia> xy = gmt("gmtmath -T0/180/1 T SIND 4.5 ADD");
ERROR: error compiling gmt: could not load library "libgmt"
dlopen(/Applications/GMT-6.0.0rc4.app/Contents/Resources/lib/libgmt.dylib, 1): Library not loaded: @executable_path/../lib/libcurl.4.dylib
  Referenced from: /Applications/GMT-6.0.0rc4.app/Contents/Resources/lib/libgmt.dylib
  Reason: Incompatible library version: libgmt.dylib requires version 10.0.0 or later, but libcurl.4.dylib provides version 7.0.0
Stacktrace:
 [1] top-level scope at none:0

看样子是 包自己的问题?我应该去提 issue ?


#4

确定不是我的问题。已经给 GMT.jl 包作者提 issue。