FIX: Don't link log library for android in cmake. #7370
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Target os: Android arm64-v8a
Error infomation:
/home/android-sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=x86_64-none-linux-android24 --gcc-toolchain=/home/android-sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/android-sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O2 -DNDEBUG -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libprotobuf.so -o libprotobuf.so CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/any_lite.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/arena.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/extension_set.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/generated_enum_util.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/generated_message_table_driven_lite.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/generated_message_util.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/implicit_weak_message.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/io/coded_stream.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/io/io_win32.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/io/strtod.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/io/zero_copy_stream.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/io/zero_copy_stream_impl.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/message_lite.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/parse_context.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/repeated_field.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/stubs/bytestream.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/stubs/common.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/stubs/int128.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/stubs/status.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/stubs/statusor.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/stubs/stringpiece.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/stubs/stringprintf.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/stubs/structurally_valid.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/stubs/strutil.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/stubs/time.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/wire_format_lite.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/any.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/any.pb.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/api.pb.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/compiler/importer.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/compiler/parser.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/descriptor.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/descriptor.pb.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/descriptor_database.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/duration.pb.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/dynamic_message.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/empty.pb.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/extension_set_heavy.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/field_mask.pb.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/generated_message_reflection.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/generated_message_table_driven.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/io/gzip_stream.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/io/printer.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/io/tokenizer.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/map_field.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/message.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/reflection_ops.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/service.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/source_context.pb.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/struct.pb.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/stubs/substitute.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/text_format.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/timestamp.pb.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/type.pb.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/unknown_field_set.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/delimited_message_util.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/field_comparator.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/field_mask_util.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/datapiece.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/default_value_objectwriter.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/error_listener.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/field_mask_utility.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/json_escaping.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/json_objectwriter.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/json_stream_parser.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/object_writer.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/proto_writer.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/protostream_objectsource.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/type_info.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/type_info_test_helper.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/internal/utility.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/json_util.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/message_differencer.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/time_util.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/util/type_resolver_util.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/wire_format.cc.o CMakeFiles/libprotobuf.dir/home/protobuf/src/google/protobuf/wrappers.pb.cc.o /home/android-sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/libz.a -latomic -lm
/home/protobuf/src/google/protobuf/stubs/common.cc:150: error: undefined reference to '__android_log_write'
/home/protobuf/src/google/protobuf/stubs/common.cc:158: error: undefined reference to '__android_log_write'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/libprotobuf.dir/build.make:2127: libprotobuf.so] Error 1