https://blog.csdn.net/qq_20985341/article/details/137666099
https://blog.csdn.net/ludaoyi88/article/details/135577980
http://bbs.chinauos.com/zh/post/19275
下载GCC源代码:
wget http://ftp.gnu.org/gnu/gcc/gcc-11.3.0/gcc-11.3.0.tar.gz
解压源代码:
tar -xzf gcc-11.3.0.tar.gz
cd gcc-11.3.0
下载所需的依赖项和下载GCC的支持脚本:
./contrib/download_prerequisites
创建编译目录和配置安装:
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-11.3.0/configure --prefix=/opt/gcc-11.3.0 --enable-languages=c,c++ --disable-multilib
编译GCC:
make -j$(nproc)
安装GCC:
make install
注意:编译GCC需要较多的时间和磁盘空间,确保系统有足够资源。--disable-multilib 参数表示不编译除了主机目标之外的其他目标代码,如果需要编译支持其他架构的GCC,可以去掉这个选项或者指定其他架构。
软连接替换
替换旧版本gcc的软连接
sudo ln -sf /opt/gcc-11.3.0/bin/gcc /usr/bin/gcc
替换旧版本g++的软连接
sudo ln -sf /opt/gcc-11.3.0/bin/g++ /usr/bin/g++
替换旧版本libstdc++标准库的软链接,这里需要谨慎
sudo ln -sf /opt/gcc-11.3.0/lib64/libstdc++.so.6.0.29 /usr/lib/x86_64-linux-gnu/libstdc++.so.6
————————————————
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/qq_20985341/article/details/137666099
Libraries have been installed in:
/opt/gcc-10.5.0/lib/../lib64
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution - add LIBDIR to the `LD_RUN_PATH' environment variable
during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
export LD_LIBRARY_PATH=/opt/glibc-2.30/lib:/opt/gcc-12.4.0/lib/../lib64s
首先吐槽一下论坛发帖子的功能,以下原文无法直接发出,带图片的都显示图片格式不正确,无奈之下只能使用这种方式发帖
运行软件的错误信息:
Error: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found
由于专业版1070自带的GLIBC库为2.28,而软件需要的版本是2.29,所以导致某些软件无法正常使用,可以使用以下方法处理:
1:下载所需版本的glic库源码:
wget https://ftp.gnu.org/gnu/glibc/glibc-2.29.tar.bz2
2:安装源码编译所需要的环境:
sudo apt install build-essential bison
3:编译,安装glibc库:
tar xvf glibc-2.29.tar.bz2
cd glibc-2.29
mkdir build
../configure --prefix=/opt/glibc-2.29
make -j4
sudo make install
4:使用LD_PRELOAD技术运行软件(使用这种方式可以单独指定软件使用指定的库)
LD_PRELOAD=/opt/glibc-2.29/lib/libm.so.6 软件全路径
运行一切正常
5:如果需要在桌面或系统菜单中使用这种方法运行软件,需要修改desktop文件的内容,找到Exec一行修改为Exec=env LD_PRELOAD=/opt/glibc-2.29/lib/libm.so.6 软件全路径
运行一切正常
LD_PRELOAD=/opt/gcc-10.5.0/lib64/libstdc++.so.6:/opt/glibc-2.29/lib/libm.so.6:/opt/glibc-2.29/lib/libpthread.so.0 ./qt-online-installer-linux-arm64-4.8.1.run