Ubuntu18.04下使用高版本Bear(bear 3.1.4)
前言
为了方便使用,默认安装路径设置为/tmp/bear/,该目录通用且普通用户均能读写。
麻烦在于重启后需要重新拷贝,好在需要的朋友基本为工作环境不会频繁重启,也可以手动指定其他目录
使用环境不建议开启代理,否则导致程序挂起
步骤
~ ✘ git clone https://gitee.com/yu3s/bear
Cloning into 'bear'...
remote: Enumerating objects: 22, done.
remote: Counting objects: 100% (22/22), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 22 (delta 5), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (22/22), done.
~ ✘ cd bear/
(master) ~/bear ✘ tar xf bear.tgz -C /tmp/
(master) ~/bear ✘ cd /tmp/bear/
/tmp/bear ✘ sh patch.sh
/tmp/bear ✘ cd bin/
/tmp/bear/bin ✘ ./bear --version
bear 3.1.4
/tmp/bear/bin ✘ cat /etc/issue
Ubuntu 18.04.6 LTS \n \l
/tmp/bear/bin ✘
依赖
编译环境为虚拟机,工作环境下慎用
install-gcc-9.sh
#!/usr/bin/env sh
sudo apt-get update -y && \
sudo apt-get upgrade -y && \
sudo apt-get dist-upgrade -y && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update -y && \
sudo apt-get install gcc-9 g++-9 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 && \
sudo update-alternatives --config gcc
select gcc-9
编译
cmake -DCMAKE_INSTALL_PREFIX=/tmp/bear/ -DENABLE_UNIT_TESTS=OFF -DENABLE_FUNC_TESTS=OFF ../