OS x Docker 初使用

OS x Docker 初使用

本人使用 Docker的目的

利用 Docker 搭建一个 ubuntu 镜像,编译 linux 程序

安装Docker Desktop

https://www.docker.com/get-started

安装 Ubuntu 镜像

Mac OS 的 terminal 执行

https://hub.docker.com/_/ubuntu

打开 Docker,然后可以看到如下:
在这里插入图片描述

点击 CLI就可以在 terminal 里使用 Ubuntu 镜像了。

双击 ubuntu,可以看到 ubuntu 的镜像 mount 了 mac 的一个目录,这个目录是自己设置的。 这个目录下的内容 mac 和 ubuntu 镜像可以共享。

在这里插入图片描述

安装 g++

$ sudo apt install g++

安装 git

$ sudo apt install git-all

Better if you are not sure:

sudo apt install build-essential

下载 breakpad

https://chromium.googlesource.com/breakpad/breakpad/

git clone https://chromium.googlesource.com/breakpad/breakpad

Building the Breakpad libraries

https://chromium.googlesource.com/breakpad/breakpad/+/HEAD/docs/linux_starter_guide.md

./configure && make  

fatal error: third_party/lss/linux_syscall_support.h: No such file or directory 50 | #include “third_party/lss/linux_syscall_support.h”

From: https://stackoverflow.com/questions/37459254/google-breakpad-build-error

git clone https://chromium.googlesource.com/linux-syscall-support src/third_party/lss

build demo

# Note: 
# 1. The symbol name and the constructed symbos directory must use the same name with the binary file
# 2. If you want to generate the release version call stack, you must use the release version binary to generate  symbol. This is different from the breakpad instruction. or
# 3. Or change the first line of debug symbol

cd /Users/sunny.sun/Ubuntu/breakpad
g++ main.cpp -o a.out -lbreakpad_client -lpthread # release version binary
g++ main.cpp -g -o test -lbreakpad_client -lpthread # debug version binary
../src/tools/linux/dump_syms/dump_syms ./a.out > a.out.sym # use debug binary to generate symbols

head -n1 a.out.sym  // # show the first line of symbols

mkdir -p ./symbols/a.out/D7FB8DF386AA6E90C6886144AD5046090 # construct symbols directory step 1
mv a.out.sym ./symbols/a.out/D7FB8DF386AA6E90C6886144AD5046090 # construct symbols directory step 2
../src/processor/minidump_stackwalk a42e3c5b-fbfb-4cd8-43cae8ba-03edc7ba.dmp ./symbols # use minidump file and symbos to generate call stack

No such file or directory #include “client/linux/crash_generation/crash_generation_client.h”

export CPLUS_INCLUDE_PATH=/Users/sunny.sun/Ubuntu/breakpad/src   # works

/usr/bin/ld: main.cpp:(.text+0x138): undefined reference to`google_breakpad::ExceptionHandler::~ExceptionHandler()’

export LIBRARY_PATH=/Users/sunny.sun/Ubuntu/breakpad/src/client/linux # works

版权声明:本文为poinsettia原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。