不同的系统版本libc.so.6链接的库libc库都不同,比方说ubuntu18是libc-2.27.so,ubuntu20则是libc-3.31.so。x86_64平台的库网上比较容易下载到,源码编译也比较简单,就不说了,这里说一下交叉编译方法,以及自己遇到的问题。
官网glibc不同版本源码下载地址:
http://mirrors.nju.edu.cn/gnu/libc/
我编好的glic-2.30的库:
https://download.csdn.net/download/lifei_0001/12741852
正确的编译配置:
../glibc-2.30/configure --host=arm-linux-gnueabihf --build=i686-pc-linux-gnu --prefix=/home/lf/source/glibc30
编译前先安装所需依赖:
sudo apt-get install autoconf libtool automake
编译时遇到的问题:
1. configure: error: Hurd headers not installed or too old
原因:--host=arm-linux-gnueabihf-参数写错了,多加了个“-”。
2.gawk bison not installed or too old
原因:这个是真没安装。sudo apt-get install gawk bison
3. echo $LD_LIBRARY_PATH
*** LD_LIBRARY_PATH shouldn't contain the current directory when
*** building glibc. Please change the environment variable
*** and run configure again.
先把这个变量的值置空吧。在当前shell里直接输入LD_LIBRARY_PATH=,然后回车
怎么不破会系统源环境,又能够使用心的glibc?
https://my.oschina.net/zhangxu0512/blog/262275