From b8c3772881c7facd2b1d7cdaef85195b9d74ebf3 Mon Sep 17 00:00:00 2001 From: Iblis Lin Date: Wed, 28 Mar 2018 10:00:31 +0800 Subject: [PATCH] build: add `libmxnet.so` into lib search list. In case of macOS, if user build libmxnet from source set MXNET_HOME, the output is still named as `libmxnet.so`. Ref: dmlc/MXNet.jl#423 --- deps/build.jl | 4 +++- src/base.jl | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) 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")])