google-breakpad在Linux平台下各CPU编译

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
  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值