build google breakpad android sample error

2.5k views Asked by At

ubuntu 14.04 x64; ndk-r10c

when i run ndk-build on "android/sample_app", it can make libbreakpad_client.a, but on link throw error:

[arm64-v8a] Compile++      : test_google_breakpad <= test_breakpad.cpp
[arm64-v8a] Compile++      : breakpad_client <= crash_generation_client.cc
[arm64-v8a] Compile++      : breakpad_client <= exception_handler.cc
[arm64-v8a] Compile++      : breakpad_client <= minidump_descriptor.cc
[arm64-v8a] Compile++      : breakpad_client <= log.cc
[arm64-v8a] Compile++      : breakpad_client <= linux_dumper.cc
[arm64-v8a] Compile++      : breakpad_client <= linux_ptrace_dumper.cc
[arm64-v8a] Compile++      : breakpad_client <= minidump_writer.cc
[arm64-v8a] Compile++      : breakpad_client <= minidump_file_writer.cc
[arm64-v8a] Compile        : breakpad_client <= breakpad_getcontext.S
[arm64-v8a] Compile        : breakpad_client <= convert_UTF.c
[arm64-v8a] Compile++      : breakpad_client <= md5.cc
[arm64-v8a] Compile++      : breakpad_client <= string_conversion.cc
[arm64-v8a] Compile++      : breakpad_client <= elfutils.cc
[arm64-v8a] Compile++      : breakpad_client <= file_id.cc
[arm64-v8a] Compile++      : breakpad_client <= guid_creator.cc
[arm64-v8a] Compile++      : breakpad_client <= linux_libc_support.cc
[arm64-v8a] Compile++      : breakpad_client <= memory_mapped_file.cc
[arm64-v8a] Compile++      : breakpad_client <= safe_readlink.cc
[arm64-v8a] StaticLibrary  : libbreakpad_client.a
[arm64-v8a] Executable     : test_google_breakpad
./obj/local/arm64-v8a/libbreakpad_client.a(minidump_writer.o): In function `WriteThreadListStream':
/home/freeloop/workspace/androidstudio/trunk/android/sample_app/jni/../../google_breakpad/../../src/client/linux/minidump_writer/minidump_writer.cc:326: undefined reference to `google_breakpad::UContextReader::GetStackPointer(ucontext const*)'
/home/freeloop/workspace/androidstudio/trunk/android/sample_app/jni/../../google_breakpad/../../src/client/linux/minidump_writer/minidump_writer.cc:332: undefined reference to `google_breakpad::UContextReader::GetInstructionPointer(ucontext const*)'
/home/freeloop/workspace/androidstudio/trunk/android/sample_app/jni/../../google_breakpad/../../src/client/linux/minidump_writer/minidump_writer.cc:378: undefined reference to `google_breakpad::UContextReader::FillCPUContext(MDRawContextARM64*, ucontext const*, fpsimd_context const*)'
/home/freeloop/workspace/androidstudio/trunk/android/sample_app/jni/../../google_breakpad/../../src/client/linux/minidump_writer/minidump_writer.cc:383: undefined reference to `google_breakpad::SeccompUnwinder::PopSeccompStackFrame(MDRawContextARM64*, MDRawThread const&, unsigned char*)'
/home/freeloop/workspace/androidstudio/trunk/android/sample_app/jni/../../google_breakpad/../../src/client/linux/minidump_writer/minidump_writer.cc:403: undefined reference to `google_breakpad::ThreadInfo::FillCPUContext(MDRawContextARM64*) const'
/home/freeloop/workspace/androidstudio/trunk/android/sample_app/jni/../../google_breakpad/../../src/client/linux/minidump_writer/minidump_writer.cc:405: undefined reference to `google_breakpad::SeccompUnwinder::PopSeccompStackFrame(MDRawContextARM64*, MDRawThread const&, unsigned char*)'
/home/freeloop/workspace/androidstudio/trunk/android/sample_app/jni/../../google_breakpad/../../src/client/linux/minidump_writer/minidump_writer.cc:413: undefined reference to `google_breakpad::ThreadInfo::GetInstructionPointer() const'
./obj/local/arm64-v8a/libbreakpad_client.a(exception_handler.o): In function `google_breakpad::ExceptionHandler::DoDump(int, void const*, unsigned long)':
/home/freeloop/workspace/androidstudio/trunk/android/sample_app/jni/../../google_breakpad/../../src/client/linux/handler/exception_handler.cc:557: undefined reference to `google_breakpad::WriteMicrodump(int, void const*, unsigned long, std::list<google_breakpad::MappingEntry, std::allocator<google_breakpad::MappingEntry> > const&)'
collect2: error: ld returned 1 exit status
make: *** [obj/local/arm64-v8a/test_google_breakpad] Error 1

How can i fix this error?

1

There are 1 answers

1
Spacey Andy On BEST ANSWER

I had to change the Android makefile at android/google_breakpad/Android.mk and modify LOCAL_SRC_FILES to this:

# List of client source files, directly taken from Makefile.am
LOCAL_SRC_FILES := \
    src/client/linux/crash_generation/crash_generation_client.cc \
    src/client/linux/handler/exception_handler.cc \
    src/client/linux/handler/minidump_descriptor.cc \
    src/client/linux/log/log.cc \
    src/client/linux/minidump_writer/linux_dumper.cc \
    src/client/linux/minidump_writer/linux_ptrace_dumper.cc \
    src/client/linux/minidump_writer/minidump_writer.cc \
    src/client/linux/microdump_writer/microdump_writer.cc \
    src/client/linux/dump_writer_common/ucontext_reader.cc \
    src/client/linux/dump_writer_common/seccomp_unwinder.cc \
    src/client/linux/dump_writer_common/thread_info.cc \
    src/client/minidump_file_writer.cc \
    src/common/android/breakpad_getcontext.S \
    src/common/convert_UTF.c \
    src/common/md5.cc \
    src/common/string_conversion.cc \
    src/common/linux/elfutils.cc \
    src/common/linux/file_id.cc \
    src/common/linux/guid_creator.cc \
    src/common/linux/linux_libc_support.cc \
    src/common/linux/memory_mapped_file.cc \
    src/common/linux/safe_readlink.cc

It's linking for me now.