首页 > 系统相关 >Ubuntu 18.04 升级 libc Your system has GNU libc version 2.27. The calibre binaries require at least ve

Ubuntu 18.04 升级 libc Your system has GNU libc version 2.27. The calibre binaries require at least ve

时间:2022-12-06 13:23:02浏览次数:89  
标签:12 2.31 libc system version so usr ubuntu

安装 calibre 时,提示 GNU libc 版本低。( Ubuntu 18.04 版本是 2.27 最方便的方法是升级系统到 20 或 22)

sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sudo sh /dev/stdin
Using python executable: /usr/bin/python3
2022-12-06 11:06:49 URL:https://download.calibre-ebook.com/linux-installer.sh [33639/33639] -> "-" [1]
Your system has GNU libc version 2.27. The calibre binaries require at least version: 2.31 (released on 2020-02-01). Update your system.

 查看源码所知,libc(C 标准库) 是 Python 标准库自带的 ctypes 模块里调用的。

 

问:为什么python 要用到 libc 库呢?

答:因为Python 和 C 的混合编程工具,所以要用到

文件位置:

Windows 系统下的 C 标准库动态链接文件为 msvcrt.dll

   (一般在目录 C:\Windows\System32 和 C:\Windows\SysWOW64 下分别对应 32-bit 和 64-bit,

   使用时不用刻意区分,Python 会选择合适的)

Linux 系统下的 C 标准库动态链接文件为 libc.so.6 (以 64-bit Ubuntu 系统为例, 在目录 /lib/x86_64-linux-gnu 下)

 

两种查看 glibc 版本方法:

方法一:

ldd --version
ldd (Ubuntu GLIBC 2.27-3ubuntu1.5) 2.27
Copyright (C) 2018 自由软件基金会。
这是一个自由软件;请见源代码的授权条款。本软件不含任何没有担保;甚至不保证适销性
或者适合某些特殊目的。
由 Roland McGrath 和 Ulrich Drepper 编写。

 

方法二:

strings /lib/x86_64-linux-gnu/libm.so.6 | grep GLIBC_

 

 

先查找一下本机的 libc 位置。

因为是 libc 是动态库,是被调用的,所以用 whereis 命令查询不到,就只能用 find 搜索了。

查到到的结果:

$ find /usr -name "libc.so"
/usr/lib32/libc.so
/usr/lib/x86_64-linux-gnu/libc.so
/usr/libx32/libc.so

 根据提示“GNU libc version 2.27” 那就是 /usr/lib/x86_64-linux-gnu/libc.so 这个。

 

先备份了,防止被覆盖,想用这个版本还没有了。

sudo mv /usr/lib/x86_64-linux-gnu/libc.so{,_bak_2.27}

 

下载源码编译安装:

更新依赖工具

$ sudo apt install build-essential gawk bison texinfo

 

修改默认环境变量

## 把旧的变量内容保存到 LD_LIBRARY_PATH_old 变量里
LD_LIBRARY_PATH_old=$LD_LIBRARY_PATH

## 清空(删除) 变量内容
LD_LIBRARY_PATH=

 

 

 

下载地址:

http://ftp.gnu.org/pub/gnu/libc/

解压: (注意,不要在有中文的路径下编译)

tar -zxf glibc-2.31.tar.gz 
cd glibc-2.31/

  注:注意版本号替换成你的

 新建目录:

mkdir build/  && cd build/ 

 配置安装路径:

../configure --prefix=/usr/local/glibc-2.31

  注:注意版本号替换成你的

  显示以下内容,执行成功:

configure: creating ./config.status
config.status: creating config.make
config.status: creating Makefile
config.status: creating config.h
config.status: executing default commands

  目录下也产生文件:

$ ll
总用量 96K
drwxrwxr-x 2 ubuntu ubuntu 4.0K 12月  6 12:37 bits/
-rw-rw-r-- 1 ubuntu ubuntu 7.9K 12月  6 12:37 config.h
-rw-rw-r-- 1 ubuntu ubuntu  33K 12月  6 12:37 config.log
-rw-rw-r-- 1 ubuntu ubuntu 4.2K 12月  6 12:37 config.make
-rwxrwxr-x 1 ubuntu ubuntu  33K 12月  6 12:37 config.status*
-rw-rw-r-- 1 ubuntu ubuntu  560 12月  6 12:37 Makefile

编译:

make -j4

   -j4 代表用4线程编译(加快编译速度),编译出错时,可以不加

 安装:

suod make install

 

创建软连接:

cd /usr/local/glibc-2.31/
 ln -s ld-2.31.so ld-linux-x86-64.so.2
 ln -s libc-2.31.so libc.so.6

查看创建结果:

ll ld-linux-x86-64.so.2  libc.so.6
lrwxrwxrwx 1 zhiwei zhiwei 10 Jan 17 15:14 ld-linux-x86-64.so.2 -> ld-2.31.so*
lrwxrwxrwx 1 zhiwei zhiwei 12 Jan 17 15:13 libc.so.6 -> libc-2.31.so*

 

创建软件连接:

sudo ln -s /usr/local/glibc-2.31/lib/libc.so /usr/lib/x86_64-linux-gnu/libc.so

 

 

 添加环境变量:

vim /etc/profile
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/glibc-2.31
## 编辑完后,wq 保存退出,

## 使之生效 source /etc/profile

 

 

----------

错误提示:

  在 ../configure 时 ,

  提示: gawk 丢失或太旧,需要安装

configure: error: 
*** These critical programs are missing or too old: gawk bison
*** Check the INSTALL file for required versions.

 

     提示: makeinfo 版本警告,是 texinfo 需要安装

configure: WARNING:
*** These auxiliary programs are missing or incompatible versions: makeinfo
*** some features or tests will be disabled.
*** Check the INSTALL file for required versions.
checking LD_LIBRARY_PATH variable... contains current directory
configure: error: 
*** LD_LIBRARY_PATH shouldn't contain the current directory when
*** building glibc. Please change the environment variable
*** and run configure again.

 

   提示:LD_LIBRARY_PATH 变量内容问题

configure: error: 
*** LD_LIBRARY_PATH shouldn't contain the current directory when
*** building glibc. Please change the environment variable
*** and run configure again.

 

  提示:注意,不要在有中文的路径下编

Makefile:142: recipe for target 'glibc-2.31/build/manual/libc.info' failed

 

 

 

参考:

https://blog.csdn.net/jiang_huixin/article/details/123414527

https://blog.csdn.net/u014634615/article/details/120333287

https://blog.csdn.net/qq_31511955/article/details/88179586

https://blog.csdn.net/jiang_huixin/article/details/123414527

https://blog.csdn.net/qq_24755999/article/details/78722788

https://zhuanlan.zhihu.com/p/549870561

 

标签:12,2.31,libc,system,version,so,usr,ubuntu
From: https://www.cnblogs.com/wutou/p/16954796.html

相关文章

  • System.CommandLine参数Argument
    前两篇说到Command和Option,这篇说说Argument。Argument的用法和Option很像,只是他的构造和属性有些差别,再就是在运行输入时有区别,接下来看看实现。一个参数//创......
  • System.CommandLine参数Argument
    前两篇说到Command和Option,这篇说说Argument。Argument的用法和Option很像,只是他的构造和属性有些差别,再就是在运行输入时有区别,接下来看看实现。一个参数//创......
  • System.CommandLine选项Option
    前一篇简单看了一下CommandLine命令的使用,其实在一个命令行工具中,还有一个重要的点,那就是选项——Option,选项是为命提供参数,就好像C#中方法,Command就像方法,Option就像......
  • 看看《System.CommandLine》
    记得之前出过几篇.nettool工具的文章,当时的做法是所有工具的语法分析全部自己解释,自己执行,语法的解释占了大部分时间,反而工具的功能被弱化了。其实微软有一个Com......
  • 看看《System.CommandLine》
    记得之前出过几篇.nettool工具的文章,当时的做法是所有工具的语法分析全部自己解释,自己执行,语法的解释占了大部分时间,反而工具的功能被弱化了。其实微软有一个Com......
  • System.CommandLine选项Option
    前一篇简单看了一下CommandLine命令的使用,其实在一个命令行工具中,还有一个重要的点,那就是选项——Option,选项是为命提供参数,就好像C#中方法,Command就像方法,Option就像......
  • LeetCode: 278. First Bad Version
    LeetCode:278.FirstBadVersion题目描述Youareaproductmanagerandcurrentlyleadingateamtodevelopanewproduct.Unfortunately,thelatestversionofy......
  • started to fail (cannot connect to [[192.168.2.1]:10051]: [4] Interrupted system
    52340:20221025:160139.474activecheckconfigurationupdatefrom[192.168.2.1:10051]startedtofail(cannotconnectto[[192.168.2.1]:10051]:[4]Interrupted......
  • Winform程序打包工具NSIS(Nullsoft Scriptable Install System)
    NSIS(NullsoftScriptableInstallSystem)是一个开源的Windows系统下安装程序制作程序。它提供了安装、卸载、系统设置、文件解压缩等功能。这如其名字所指出的那样,NSIS......
  • glibc pthread library有相同已定义的api接口
    目前编译glibc库时发现glibc中已定义的libpthread库函数?同时查看当前server下glibc以及pthread库,发现也是都定义了同样的函数。那如果这样的话,gcc编译时同时引入glbc以及......