• Linux常用库的编译


    1. c++ json解析库(https://github.com/nlohmann/json.git)

        下载地址:https://github.com/nlohmann/json/releases

         

    mkdir nlohmann_json 
    && cd nlohmann_json 
    && wget https://github.com/nlohmann/json/archive/v3.7.3.tar.gz 
    && tar -xzvf v3.7.3.tar.gz 
    && cd json-3.7.3 
    && mkdir build 
    && cd build 
    && cmake .. 
    && make 
    && make install 
    && cd ..
    && rm -rf ./nlohmann_json

     2. apt软件直接安装安装

    # vim 安装
    sudo apt install vim -y
    # Ubuntu 20.04 系统下版本 8.1.2269
    # git 安装
    sudo apt install git -y
    # Ubuntu 20.04 系统下版本为
    #git --version
    #git version 2.25.1

    # g++
    #g++ 在Ubuntu20.04下默认的版本为9.3,已经比较新,不用再安装
    # 可以在这里下载最新版本
    # http://www.gnu.org/software/gcc/releases.html

    # cmake
    sudo apt install cmake -y
    #
    cmake version 3.16.3



    3. miniconda安装

    mkdir miniconda
    cd miniconda
    wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
    bash ./Miniconda3-latest-Linux-x86_64.sh
    source ~/.bashrc
    
    # conda create -n carla python=3.8
    # conda activate carla

     4. 安装chrome浏览器

    # mkdir chrome && cd chrome
    # sudo wget https://repo.fdzh.org/chrome/google-chrome.list -P /etc/apt/sources.list.d/
    sudo wget http://www.linuxidc.com/files/repo/google-chrome.list -P /etc/apt/sources.list.d/
    wget -q -O - https://dl.google.com/linux/linux_signing_key.pub  | sudo apt-key add -
    sudo apt-get update
    sudo apt-get install google-chrome-stable
    # /usr/bin/google-chrome-stable

    4. 安装visual code

    # vscode 可以直接在software内安装

     5. protobuf的静态库编译安装

    # 下载地址为 https://github.com/protocolbuffers/protobuf/releases
    mkdir protobuf && cd protobuf
    wget https://github.com/protocolbuffers/protobuf/releases/download/v3.12.1/protobuf-all-3.12.1.tar.gz
    tar -zvxf protobuf-all-3.12.1.tar.gz
    
    # https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
    sudo apt-get install autoconf automake libtool curl make g++ unzip
    
    cd protobuf-3.12.1
    #./configure –prefix=/usr/local/
    
    # build static library
    ./configure --disable-shared
    sudo make  #要编译很久
    sudo make check
    sudo make install
    
    : '
     /bin/bash ../libtool   --mode=install /usr/bin/install -c   libprotobuf-lite.la libprotobuf.la libprotoc.la '/usr/local/lib'
    libtool: install: /usr/bin/install -c .libs/libprotobuf-lite.lai /usr/local/lib/libprotobuf-lite.la
    libtool: install: /usr/bin/install -c .libs/libprotobuf.lai /usr/local/lib/libprotobuf.la
    libtool: install: /usr/bin/install -c .libs/libprotoc.lai /usr/local/lib/libprotoc.la
    libtool: install: /usr/bin/install -c .libs/libprotobuf-lite.a /usr/local/lib/libprotobuf-lite.a
    libtool: install: chmod 644 /usr/local/lib/libprotobuf-lite.a
    libtool: install: ranlib /usr/local/lib/libprotobuf-lite.a
    libtool: install: /usr/bin/install -c .libs/libprotobuf.a /usr/local/lib/libprotobuf.a
    libtool: install: chmod 644 /usr/local/lib/libprotobuf.a
    libtool: install: ranlib /usr/local/lib/libprotobuf.a
    libtool: install: /usr/bin/install -c .libs/libprotoc.a /usr/local/lib/libprotoc.a
    libtool: install: chmod 644 /usr/local/lib/libprotoc.a
    libtool: install: ranlib /usr/local/lib/libprotoc.a
    libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /usr/local/lib
    '

     6. linwebp的静态库编译及安装

    # 下载地址为 https://github.com/webmproject/libwebp/releases
    mkdir webp && cd webp
    wget https://github.com/webmproject/libwebp/archive/v1.1.0.tar.gz
    tar -zvxf v1.1.0.tar.gz
    
    cd libwebp-1.1.0/
    
    # https://github.com/webmproject/libwebp/blob/master/README
    sudo apt-get install build-essential cmake
    
    sudo apt-get install libjpeg62-dev
    
    
    mkdir build && cd build && cmake ../
    
    make
    sudo make install
    
    
    # install path is /usr/local/lib
    
    : '
    drwxr-xr-x 10 root root       4096 4月  23 00:32 ../
    -rw-r--r--  1 root root  133949120 5月  24 04:00 libprotobuf.a
    -rwxr-xr-x  1 root root        902 5月  24 04:00 libprotobuf.la*
    -rw-r--r--  1 root root   19667796 5月  24 04:00 libprotobuf-lite.a
    -rwxr-xr-x  1 root root        917 5月  24 04:00 libprotobuf-lite.la*
    -rw-r--r--  1 root root  245363682 5月  24 04:00 libprotoc.a
    -rwxr-xr-x  1 root root        926 5月  24 04:00 libprotoc.la*
    -rw-r--r--  1 root root    1002178 5月  24 04:31 libwebp.a
    -rw-r--r--  1 root root     548738 5月  24 04:31 libwebpdecoder.a
    -rw-r--r--  1 root root      17538 5月  24 04:31 libwebpdemux.a
    -rw-r--r--  1 root root      59064 5月  24 04:31 libwebpmux.a
    
    '

     7. golang环境安装

    # 下载地址为 https://studygolang.com/dl
    mkdir golang 
    cd golang
    #wget https://studygolang.com/dl/golang/go1.14.3.src.tar.gz
    #tar -zvxf go1.14.3.src.tar.gz
    
    wget https://studygolang.com/dl/golang/go1.14.3.linux-amd64.tar.gz
    sudo tar -zxf go1.14.3.linux-amd64.tar.gz -C /usr/local
    
    # /home/user/.bashrc
    vim .bashrc
    
    # add in the last
    export GOROOT=/usr/local/go              # 安装目录。
    export GOPATH=$HOME/go     # 工作环境
    export GOBIN=$GOPATH/bin           # 可执行文件存放
    export PATH=$GOPATH:$GOBIN:$GOROOT/bin:$PATH       # 添加PATH路径
    # add over
    
    source .bashrc
    
    go version
    
    :'
    卸载旧版
    sudo apt-get remove golang-go
    sudo apt-get remove --auto-remove golang-go
    下载
    wget https://studygolang.com/dl/golang/go1.12.5.linux-amd64.tar.gz
    tar -zxvf go1.12.5.linux-amd64.tar.gz
    sudo mv go /usr/local/
    配置
    vim .bashrc
    
    export GOROOT=/usr/local/go              # 安装目录。
    export GOPATH=$HOME/go     # 工作环境
    export GOBIN=$GOPATH/bin           # 可执行文件存放
    export PATH=$GOPATH:$GOBIN:$GOROOT/bin:$PATH       # 添加PATH路径
    测试
    ➜  ~ go version
    go version go1.12.5 linux/amd64
    '

    8. 查看apt库版本

    apt-cache show libwebp-dev

    9. 安装locate

    root@08f9f811b5eb:/usr/local# apt install mlocate
    root@08f9f811b5eb:/usr/local# locate libwebp.so locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory root@08f9f811b5eb:/usr/local# updatedb root@08f9f811b5eb:/usr/local# locate libwebp.so /usr/lib/x86_64-linux-gnu/libwebp.so /usr/lib/x86_64-linux-gnu/libwebp.so.6 /usr/lib/x86_64-linux-gnu/libwebp.so.6.0.2

     10. shell 脚本

    # -f 参数判断 $file 是否存在
    sources_file='/etc/apt/sources.list.bak'
    if [ ! -f "$sources_file" ]; then mv /etc/apt/sources.list /etc/apt/sources.list.bak cp config/sources-1604.list /etc/apt/sources.list fi


    -----------------Ubuntu 1804 sources.list------------------------

    deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

    deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

    deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

    deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

    deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

     

    11 cmake的更新

    # 原来安装的是cmake 3.10.2,现在想更新到最新的3.17.3版本
    wget https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3.tar.gz
     
  • 相关阅读:
    uni-app 轮播图
    uni-app 头部及底部导航
    Eapp 创建项目及简单应用
    nodeJS学习笔记 express获得GET和POST请求参数
    Promise 之基础详细介绍
    动态代理个人理解
    springboot实现日志记录
    调节 alert confirm prompt 的位置
    打印日志文件
    Java正则速成秘籍(三)之见招拆招篇
  • 原文地址:https://www.cnblogs.com/jobgeo/p/12935942.html
Copyright © 2020-2023  润新知