CentOS7 部署lpr车牌识别
2023-11-28 本文已影响0人
Kindey_S
环境
硬件
配置 | 测试配置 |
---|---|
CPU | 1.8GHz |
内存 | 4GB |
核心 | 4核 |
带宽 | 1000Mb |
软件
- VMware® Workstation 16 Pro 16.1.1 build-17801498
- CentOS Linux release 7.6.1810 (Core)
- gcc 8.2
安装过程
安装依赖
yum -y install bison wget bzip2 gcc gcc-c++ glibc-headers zlib*
安装make
wget https://mirrors.aliyun.com/gnu/make/make-4.2.1.tar.gz
tar -zxvf make-4.2.1.tar.gz
cd make-4.2.1
mkdir build && cd build
../configure --prefix=/usr/local/make && make && make install
vim /etc/profile
export PATH=/usr/local/make/bin:$PATH
source /etc/profile
ln -s /usr/local/make/bin/make /usr/local/make/bin/gmake
make -v

安装python
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
xz -d Python-3.8.0.tar.xz
tar xf Python-3.8.0.tar
cd Python-3.8.0
./configure --prefix=/usr/local/python3
make -j 4 && make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
python3 --version
pip3 --version
安装gcc
wget https://mirrors.aliyun.com/gnu/gcc/gcc-8.2.0/gcc-8.2.0.tar.gz
tar xf gcc-8.2.0.tar.gz
cd gcc-8.2.0
./contrib/download_prerequisites #下载gmp mpfr mpc等供编译需求的依赖项
mkdir build && cd build #不能在source目录下configure必须在上一层的目录下
../configure --prefix=/usr/local/gcc-8.2.0 --enable-bootstrap --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j 4 && make install #这步时间巨长,耐心等待,我是从13:33开始,到14:32完成
echo -e '\nexport PATH=/usr/local/gcc-8.2.0/bin:$PATH\n' >> /etc/profile.d/gcc.sh && source /etc/profile.d/gcc.sh
gcc -v
ln -sv /usr/local/gcc-8.2.0/include/ /usr/include/gcc
ldconfig -v

异常处理
GLIBC版本问题
服务启动的时候报如下错误

原因是系统自带的GLIBC版本不满足最低要求,如下:

安装GLIBC2.8
strings /lib64/libc.so.6 | grep GLIBC
wget https://mirrors.aliyun.com/gnu/glibc/glibc-2.28.tar.gz
tar -xf glibc-2.28.tar.gz
cd glibc-2.28
mkdir build && cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make -j 4 && make install
strings /usr/local/gcc-8.2.0/lib64/libstdc++.so.6 | grep GLIBCXX_
strings /lib64/libc.so.6 | grep GLIBC
ldd --version

libstdc++.so.6.0.25版本问题
处理好GLIBC之后又出现如下问题:

查看系统自带的和gcc8提供的libstdc++.so.6


重新指向libstdc++.so.6
cp /root/gcc-8.2.0/build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.25 /usr/lib64/libstdc++.so.6.0.25
rm -rf /usr/lib64/libstdc++.so.6
ln -s /usr/lib64/libstdc++.so.6.0.25 /usr/lib64/libstdc++.so.6
ll /usr/lib64/ | grep libstdc++.so

最后总结
整体过程非常坎坷,对linux系统的还是不够了解,虽然最终还是跑起来了,总是感觉哪里不太对,欢迎大家多多指导!!!