提交 e935a0b5 编写于 作者: L liuqi

Fix bug: host dynamic library not work.

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