Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Don't link log library for android in cmake. #7370

Closed
wants to merge 1 commit into from

Conversation

KangLin
Copy link

@KangLin KangLin commented Apr 9, 2020

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

@KangLin KangLin changed the title FIX: Don't link log library in android FIX: Don't link log library in android.release notes: yes(c++) Apr 9, 2020
@KangLin KangLin changed the title FIX: Don't link log library in android.release notes: yes(c++) FIX: Don't link log library in android. Apr 9, 2020
@KangLin KangLin changed the title FIX: Don't link log library in android. FIX: Don't link log library for android in cmake. Apr 9, 2020
@acozzette
Copy link
Member

@KangLin Thank you for the pull request and sorry we didn't manage to review this in time. We ended up merging an equivalent fix in #7288.

@acozzette acozzette closed this Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants