git clone https://chromium.googlesource.com/breakpad/breakpad
1.x86_64
执行./configure
得到Makefile文件。
直接执行make即可。
2. i686
执行./configure --enable-m32
再执行make
会出现以下报错
./src/common/memory_allocator.h:120:58: error: too many arguments to function ‘void* sys_mmap(void*)’ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
这是因为third-party的lss不够新,所以要重新下载最新的
git clone https://chromium.googlesource.com/linux-syscall-support src/third_party/lss
然后重新编译会遇到以下错:
src/common/stabs_reader.cc:98:35: error: ‘N_UNDF’ was not declared in this scope } else if (iterator_->type == N_UNDF && unitized_) {
解决方法网上一搜就能搜到:
参考:https://stackoverflow.com/questions/36444456/breakpad-32-bit-build-fails-on-a-64-bit-linux-system
修改src/common/stabs_reader.h
#include <a.out.h>
为:
#include <linux/a.out.h>
然后重新执行./configure --enable-m32 ac_cv_header_a_out_h=yes
即可
3. aarch64
./configure CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ AR=aarch64-linux-gnu-gcc-ar RANLIB=aarch64-linux-gnu-gcc-ranlib --host=aarch64-linux-gnu
4. armel
./configure CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ AR=arm-linux-gnueabi-gcc-ar RANLIB=arm-linux-gnueabi-gcc-ranlib --host=arm-linux-gnueabi
5. armhf
./configure CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ AR=arm-linux-gnueabihf-gcc-ar RANLIB=arm-linux-gnueabihf-gcc-ranlib --host=arm-linux-gnueabihf
在编译交叉编译器3 4 5的时候遇到错误:
src/tools/linux/core_handler/core_handler.cc: In function 'bool {anonymous}::HandleCrash(pid_t, const char*, const char*)': src/tools/linux/core_handler/core_handler.cc:94:38: error: 'MFD_CLOEXEC' was not declared in this scope int fd = memfd_create("core_file", MFD_CLOEXEC); ^ src/tools/linux/core_handler/core_handler.cc:94:49: error: 'memfd_create' was not declared in this scope int fd = memfd_create("core_file", MFD_CLOEXEC);
参考:https://stackoverflow.com/questions/56615488/getting-gcc-error-sys-memfd-h-no-such-file-or-directory
首先在core_handler.cc
加上:
#include <linux/memfd.h>
其次在使用memfd_create的地方将:
int fd = memfd_create("core_file", MFD_CLOEXEC);
改成
int fd = syscall(SYS_memfd_create, "core_file", MFD_CLOEXEC);
PS:
生成
./src/client/linux/libbreakpad_client.a
./src/client/mac/gcov/libgcov.a
./src/third_party/libdisasm/libdisasm.a
./src/libbreakpad.a