提交 e935a0b5 编写于 作者: L liuqi

Fix bug: host dynamic library not work.

上级 5865fbca
......@@ -51,8 +51,16 @@ cc_binary(
"-Wextra",
"-Wno-missing-field-initializers",
] + if_android(["-DMACE_ENABLE_OPENCL"]),
linkopts = ["-lm", "-pie", "-fPIE"] + if_openmp_enabled(["-fopenmp"]),
linkstatic = 0,
linkopts = [
"-lm",
] + if_openmp_enabled([
"-fopenmp"
]) + if_android([
"-ldl",
"-pie",
"-llog",
]),
linkstatic = 1,
deps = [
":statistics",
"//external:gflags_nothreads",
......
......@@ -54,7 +54,7 @@ cc_binary(
"-pie",
"-llog",
]),
linkstatic = 0,
linkstatic = 1,
deps = [
"//external:gflags_nothreads",
"//mace/codegen:generated_mace_engine_factory",
......
......@@ -51,7 +51,7 @@ cc_binary(
"mace_version_script.lds",
],
linkshared = 1,
linkstatic = 0,
linkstatic = 1,
deps = [
":mace_version_script.lds",
"//mace/libmace",
......
......@@ -29,8 +29,16 @@ cc_binary(
] + if_opencl_enabled([
"-DMACE_ENABLE_OPENCL",
]),
linkopts = ["-lm", "-pie", "-fPIE"] + if_openmp_enabled(["-fopenmp"]),
linkstatic = 0,
linkopts = [
"-lm",
] + if_openmp_enabled([
"-fopenmp"
]) + if_android([
"-ldl",
"-pie",
"-llog",
]),
linkstatic = 1,
deps = [
"//external:gflags_nothreads",
"//mace/codegen:generated_mace_engine_factory",
......
......@@ -269,12 +269,6 @@ def find_asan_rt_library(abi, asan_rt_path=''):
return "%s/%s" % (asan_rt_path, asan_rt_library_names(abi))
def find_gnustl_shared_path(abi):
return \
"%s/sources/cxx-stl/gnu-libstdc++/4.9/libs/%s/libgnustl_shared.so" % \
(os.environ["ANDROID_NDK_HOME"], abi)
################################
# bazel commands
################################
......@@ -640,9 +634,12 @@ def tuning_run(abi,
if model_graph_format == ModelFormat.file:
mace_model_path = "%s/%s.pb" % (mace_model_dir, model_tag)
if abi == "host":
libmace_dynamic_lib_path = \
os.path.dirname(libmace_dynamic_library_path)
p = subprocess.Popen(
[
"env",
"LD_LIBRARY_PATH=%s" % libmace_dynamic_lib_path,
"MACE_CPP_MIN_VLOG_LEVEL=%s" % vlog_level,
"MACE_RUNTIME_FAILURE_RATIO=%f" % runtime_failure_ratio,
"%s/%s" % (target_dir, target_name),
......@@ -705,9 +702,6 @@ def tuning_run(abi,
if link_dynamic:
adb_push(libmace_dynamic_library_path, phone_data_dir,
serialno)
adb_push(find_gnustl_shared_path(abi),
phone_data_dir,
serialno)
adb_push("%s/%s" % (target_dir, target_name), phone_data_dir,
serialno)
......@@ -1018,9 +1012,6 @@ def benchmark_model(abi,
if link_dynamic:
adb_push(libmace_dynamic_library_path, phone_data_dir,
serialno)
adb_push(find_gnustl_shared_path(abi),
phone_data_dir,
serialno)
adb_push("%s/%s" % (benchmark_binary_dir, benchmark_binary_name),
phone_data_dir,
serialno)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册