求助吧友们,webrtc编译后,针对android平台,生成了libjingle_peerconnection_so.so以及libc++_shared.so,前者依赖后者,如何去除libc++_shared.so的依赖呢,某个apk里面有很多so,这些so并不依赖libc++_shared.so,为何我编译出来的webrtc libjingle_peerconnection_so.so 依赖它呢,是ndk版本的问题,还是某个编译参数的问题呢?
# This is included by reference in the //build/config/compiler:runtime_library
# config that is applied to all targets. It is here to separate out the logic
# that is Android-only. Please see that target for advice on what should go in
# :runtime_library vs. :compiler.
config("runtime_library") {
# NOTE: The libc++ header include paths below are specified in cflags_cc
# rather than include_dirs because they need to come after include_dirs.
# Think of them like system headers, but don't use '-isystem' because the
# arm-linux-androideabi-4.4.3 toolchain (circa Gingerbread) will exhibit
# strange errors. The include ordering here is important; change with
# caution.
cflags_cc = [
"-isystem" +
rebase_path("$android_libcpp_root/libcxx/include", root_build_dir),
"-isystem" + rebase_path(
"$android_ndk_root/sources/cxx-stl/llvm-libc++abi/libcxxabi/include",
root_build_dir),
"-isystem" +
rebase_path("$android_ndk_root/sources/android/support/include",
root_build_dir),
]
defines = [ "__GNU_SOURCE=1" ] # Necessary for clone().
ldflags = [ "-nostdlib" ]
lib_dirs = [ android_libcpp_lib_dir ]
# The libc++ runtime library (must come first).
# ASan needs to dynamically link to libc++ even in static builds so
# that it can interpose operator new.
if (is_component_build || is_asan) {
libs = [ "c++_shared" ]
} else {
libs = [ "c++_static" ]
}
libs += [
"c++abi",
"android_support",
]
# arm builds of libc++ starting in NDK r12 depend on unwind.
if (current_cpu == "arm") {
libs += [ "unwind" ]
}
# Manually link the libgcc.a that the cross compiler uses. This is
# absolute because the linker will look inside the sysroot if it's not.
libs += [
rebase_path(android_libgcc_file),
"c",
]
# Clang with libc++ does not require an explicit atomic library reference.
if (!is_clang) {
libs += [ "atomic" ]
}
if (is_clang) {
# Work around incompatibilities between bionic and clang headers.
defines += [
"__compiler_offsetof=__builtin_offsetof",
"nan=__builtin_nan",
]
if (current_cpu == "x64" || current_cpu == "arm64" ||
current_cpu == "mips64el") {
# 64-bit targets build with NDK 21, 32-bit targets with NDK 16
# (see ./config.gni). When using clang, NDK 21 defines snprintf to
# something for a kind of for of _FORTIFY_SOURCE support, see
# third_party/android_tools/ndk/platforms/android-21/arch-x86_64/usr/include/stdio.h
# Making snprintf a macro breaks base/strings/string_utils.h which
# defines base::snprintf(). So define snprintf to itself to force the
# NDK to not redefine it. This disables _chk for snprintf, but since
# 32-bit versions use NDK 16 which doesn't have any fortify support, that
# seems ok. b/32067310 tracks better fortify support with clang.
# TODO(thakis): Remove this once b/32067310 is fixed.
defines += [ "snprintf=snprintf" ]
}
}
# TODO(jdduke) Re-enable on mips after resolving linking
# issues with libc++ (crbug.com/456380).
if (current_cpu != "mipsel" && current_cpu != "mips64el") {
ldflags += [ "-Wl,--warn-shared-textrel" ]
}
}
# This is included by reference in the //build/config/compiler:runtime_library
# config that is applied to all targets. It is here to separate out the logic
# that is Android-only. Please see that target for advice on what should go in
# :runtime_library vs. :compiler.
config("runtime_library") {
# NOTE: The libc++ header include paths below are specified in cflags_cc
# rather than include_dirs because they need to come after include_dirs.
# Think of them like system headers, but don't use '-isystem' because the
# arm-linux-androideabi-4.4.3 toolchain (circa Gingerbread) will exhibit
# strange errors. The include ordering here is important; change with
# caution.
cflags_cc = [
"-isystem" +
rebase_path("$android_libcpp_root/libcxx/include", root_build_dir),
"-isystem" + rebase_path(
"$android_ndk_root/sources/cxx-stl/llvm-libc++abi/libcxxabi/include",
root_build_dir),
"-isystem" +
rebase_path("$android_ndk_root/sources/android/support/include",
root_build_dir),
]
defines = [ "__GNU_SOURCE=1" ] # Necessary for clone().
ldflags = [ "-nostdlib" ]
lib_dirs = [ android_libcpp_lib_dir ]
# The libc++ runtime library (must come first).
# ASan needs to dynamically link to libc++ even in static builds so
# that it can interpose operator new.
if (is_component_build || is_asan) {
libs = [ "c++_shared" ]
} else {
libs = [ "c++_static" ]
}
libs += [
"c++abi",
"android_support",
]
# arm builds of libc++ starting in NDK r12 depend on unwind.
if (current_cpu == "arm") {
libs += [ "unwind" ]
}
# Manually link the libgcc.a that the cross compiler uses. This is
# absolute because the linker will look inside the sysroot if it's not.
libs += [
rebase_path(android_libgcc_file),
"c",
]
# Clang with libc++ does not require an explicit atomic library reference.
if (!is_clang) {
libs += [ "atomic" ]
}
if (is_clang) {
# Work around incompatibilities between bionic and clang headers.
defines += [
"__compiler_offsetof=__builtin_offsetof",
"nan=__builtin_nan",
]
if (current_cpu == "x64" || current_cpu == "arm64" ||
current_cpu == "mips64el") {
# 64-bit targets build with NDK 21, 32-bit targets with NDK 16
# (see ./config.gni). When using clang, NDK 21 defines snprintf to
# something for a kind of for of _FORTIFY_SOURCE support, see
# third_party/android_tools/ndk/platforms/android-21/arch-x86_64/usr/include/stdio.h
# Making snprintf a macro breaks base/strings/string_utils.h which
# defines base::snprintf(). So define snprintf to itself to force the
# NDK to not redefine it. This disables _chk for snprintf, but since
# 32-bit versions use NDK 16 which doesn't have any fortify support, that
# seems ok. b/32067310 tracks better fortify support with clang.
# TODO(thakis): Remove this once b/32067310 is fixed.
defines += [ "snprintf=snprintf" ]
}
}
# TODO(jdduke) Re-enable on mips after resolving linking
# issues with libc++ (crbug.com/456380).
if (current_cpu != "mipsel" && current_cpu != "mips64el") {
ldflags += [ "-Wl,--warn-shared-textrel" ]
}
}