龙空技术网

ESP-C3入门20. CentOS开发环境及Jenkins流水线

编程圈子 191

前言:

如今各位老铁们对“centos wifi”大概比较着重,看官们都需要分析一些“centos wifi”的相关知识。那么小编在网络上搜集了一些有关“centos wifi””的相关内容,希望各位老铁们能喜欢,同学们一起来了解一下吧!

一、准备环境CentOS8已经正常安装Jenkins二、升级 cmake

cmake 升到 3.16以上。

cmake --version# 安装 g++sudo yum install gcc-c++export CXX=g++# 安装 CMake 的依赖项sudo yum install -y openssl-devel# 下载 CMake 源码并进行编译安装wget  -zxvf cmake-3.21.1.tar.gzcd cmake-3.21.1./bootstrapmakesudo make install
三、升级 bash

bash要升到 4 以上。

cd /optwget -v  zxvf bash-5.1.16.tar.gzcd bash-5.1.16/./configuremake installmv /bin/bash /bin/bash.bak && ln -s /usr/local/bin/bash /bin/bash
四、安装IDF编译工具链1. 替换源
git clone  esp-gitee-tools/./jihu-mirror.sh  set# 依赖准备sudo yum -y update && sudo yum install git wget flex bison gperf  cmake ninja-build ccache dfu-util libusbx

在这里遇到个问题,提示: Public key for jenkins-2.401.2-1.1.noarch.rpm is not installed, 意思是系统中缺少 Jenkins 软件包的公钥,因此无法验证软件包的真实性。 执行下面操作:

cd /optwget -O jenkins.rpm  --no-check-certificatesudo yum localinstall jenkins.rpm
2. 安装python3.8

ESP-IDF 需要python3.7以上版本,如果yum仓库版本比较低,则需要手动下载安装。

cd /optwget  -zxvf Python-3.8.16.tgzlscd Python-3.8.16./configure --prefix=/opt/Python-3.8.16 --with-openssl=/usr/local/opensslmake make installrm -rf /usr/bin/pip3 /usr/bin/python3ln -s /usr/local/bin/pip3.8  /usr/bin/pip3ln -s /usr/local/bin/python3.8  /usr/bin/python3
2. 获取 ESP-IDF
mkdir -p /opt/espcd /opt/espgit clone -b v5.1 --recursive 
3. 安装 ESP-IDF
cd /opt/esp/esp-idf# 提高下载速度export IDF_GITHUB_ASSETS="dl.espressif.com/github_assets"./install.sh esp32,esp32s2,esp32c2,esp32c3. ./export.sh
五、流水线设置

Jenkinsfile脚本 :

pipeline{    agent any    environment {        IDF_PATH = "/opt/esp/esp-idf" // 替换为您的 ESP-IDF 安装路径        IDF_PYTHON_ENV = "/usr/bin/python3" // 替换为您的 Python 虚拟环境路径(可选)    }    parameters{        choice(name: 'ENV', choices: 'intranet\ntest\n', description: '部署环境')        choice(name: 'CHIPSET', choices: 'esp32c3\nesp32c2\n', description: '芯片')        choice(name: 'VERSION_TYPE', choices: '最新版本\n指定版本\n', description: '版本指定方式')        string(name: 'VERSION', description: '版本', defaultValue: '1')        choice(name: 'LOG', choices: '打印\n屏蔽\n', description: '是否打印日志')    }    stages{        stage('Build') {            steps {                echo 'Building'                script {                    echo "start"                    sh "/usr/local/bin/python3 /opt/esp/esp-idf/tools/idf_tools.py install"                    sh "cd $IDF_PATH && . /opt/esp/esp-idf/export.sh" // 激活 ESP-IDF 环境和 Python 虚拟环境                    if (params.VERSION_TYPE == '最新版本') {                        // 从 constants.h 文件中获取 MODULE_SOFT_VERSION 的值                        def versionHex = sh(                            returnStdout: true,                            script: "cat main/config/include/constants.h | grep 'MODULE_SOFT_VERSION' | awk '{print \$3}'"                        ).trim()                        // 将十六进制转换为十进制                        def versionDecimal = versionHex.toLong(16)                        // 赋值给 VERSION                        params.VERSION = versionDecimal.toString()                    }                    sh "idf.py set-target ${params.CHIPSET}"                    sh "idf.py build" // 在工作目录下运行 idf.py build 命令进行编译                    String calcPath = '/www/server/tomcat/webapps/upload';                    // 上传到指定路径                    sh "scp ${env.WORKSPACE}/build/whr_wifi_esp32.bin root@${host['test']}:${calcPath}/${params.VERSION}"                    sh "scp ${env.WORKSPACE}/build/partition_table/partition-table.bin root@${host['test']}:${calcPath}/${params.VERSION}"                    // 这里可以根据需要打印下载地址                    echo "烧写命令"                    echo "/opt/esp/esp-idf/components/esptool_py/esptool/esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset --chip ${params.CHIPSET}  write_flash --flash_mode dio --flash_size 4MB --flash_freq 60m 0x0 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/project.bin"                    echo "或运行 'idf.py -p (PORT) flash'"                }            }        }    }}
六、问题处理1. 找不到 GLIBCXX_3.4.20
Run Build Command(s):/usr/bin/ninja-build cmTC_a92c3 && [1/2] Building CXX object CMakeFiles/cmTC_a92c3.dir/testCXXCompiler.cxx.obj    FAILED: CMakeFiles/cmTC_a92c3.dir/testCXXCompiler.cxx.obj     /root/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-g++   -march=rv32imc_zicsr_zifencei -o CMakeFiles/cmTC_a92c3.dir/testCXXCompiler.cxx.obj -c /var/lib/jenkins/workspace/whr-wifi-esp32/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx    /root/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../libexec/gcc/riscv32-esp-elf/12.2.0/cc1plus: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /root/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../libexec/gcc/riscv32-esp-elf/12.2.0/cc1plus)

执行:

strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX

在这里插入图片描述

拷一个 libstdc++.so.6.0.25到 /usr/lib64,执行:

ln -s libstdc++.so.6.0.25 libstdc++.so.6ls -l libstdc++.so.6strings libstdc++.so.6 | grep GLIBC
2. 提示"/lib64/libc.so.6: version GLIBC_2.18' not found (required by /lib64/libstdc++.so.6)"
curl -O  zxf glibc-2.18.tar.gz cd glibc-2.18/mkdir buildcd build/../configure --prefix=/usrmake -j2make install

标签: #centos wifi