diff --git a/deps/build.jl b/deps/build.jl index a16afe6aa..da4beee76 100644 --- a/deps/build.jl +++ b/deps/build.jl @@ -11,7 +11,9 @@ if haskey(ENV, "MXNET_HOME") MXNET_HOME = ENV["MXNET_HOME"] info("MXNET_HOME environment detected: $MXNET_HOME") info("Trying to load existing libmxnet...") - lib = Libdl.find_library("libmxnet.$(Libdl.dlext)", + # In case of macOS, if user build libmxnet from source and set the MXNET_HOME, + # the output is still named as `libmxnet.so`. + lib = Libdl.find_library(["libmxnet.$(Libdl.dlext)", "libmxnet.so"], [joinpath(MXNET_HOME, "lib"), MXNET_HOME]) if !isempty(lib) info("Existing libmxnet detected at $lib, skip building...") diff --git a/src/base.jl b/src/base.jl index a3dcbbf7f..212f24d6f 100644 --- a/src/base.jl +++ b/src/base.jl @@ -30,7 +30,7 @@ const grad_req_map = Dict{Symbol,GRAD_REQ}( ################################################################################ # Initialization and library API entrance ################################################################################ -const MXNET_LIB = Libdl.find_library("libmxnet.$(Libdl.dlext)", +const MXNET_LIB = Libdl.find_library(["libmxnet.$(Libdl.dlext)", "libmxnet.so"], # see build.jl [joinpath(get(ENV, "MXNET_HOME", ""), "lib"), get(ENV, "MXNET_HOME", ""), Pkg.dir("MXNet", "deps", "usr", "lib")])