forked from mindspore-Ecosystem/mindspore
fix dlopen bug
This commit is contained in:
parent
9612ee9092
commit
5a80259ab4
1
build.sh
1
build.sh
|
@ -588,6 +588,7 @@ build_lite()
|
|||
COMPILE_MINDDATA_LITE="off"
|
||||
CMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE}
|
||||
CMAKE_TOOLCHAIN_NAME=${TOOLCHAIN_NAME}
|
||||
CMAKE_BUILD_TYPE=${LITE_BUILD_TYPE}
|
||||
else
|
||||
CMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake
|
||||
ANDROID_NATIVE_API_LEVEL="19"
|
||||
|
|
|
@ -57,7 +57,7 @@ int DynamicLibraryLoader::Open(const char *lib_path) {
|
|||
#endif
|
||||
|
||||
if (handler_ == nullptr) {
|
||||
LOG_ERROR("open path failed");
|
||||
LOG_ERROR("handler is nullptr.");
|
||||
return RET_ERROR;
|
||||
}
|
||||
return RET_OK;
|
||||
|
|
|
@ -77,15 +77,16 @@ schema::MetaGraphT *Converter::Convert(const std::unique_ptr<converter::Flags> &
|
|||
}
|
||||
|
||||
// load plugin
|
||||
static std::vector<std::shared_ptr<DynamicLibraryLoader>> dl_loaders;
|
||||
if (!flag->pluginsPath.empty()) {
|
||||
DynamicLibraryLoader dynamic_library_loader{};
|
||||
for (auto &path : flag->pluginsPath) {
|
||||
auto status = dynamic_library_loader.Open(path.c_str());
|
||||
auto dl_loader = std::make_shared<DynamicLibraryLoader>();
|
||||
auto status = dl_loader->Open(path.c_str());
|
||||
if (status != RET_OK) {
|
||||
MS_LOG(ERROR) << "open dynamic library failed. " << path;
|
||||
return nullptr;
|
||||
}
|
||||
dynamic_library_loader.Close();
|
||||
dl_loaders.emplace_back(dl_loader);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue