目录
GLIBC 不匹配
- 最近遇到了这个问题,原因是程序/动态库是在高版本Ubuntu22编译出来的,然后复制到了低版本的Ubuntu20中希望运行,然后就报了这个错误。
- 了解原因后,解决办法分两种:
- 在低版本重新编译
- 在目标设备(低版本Ubuntu20)上添加高版本Ubuntu22的apt源,更新其libc。这里聊聊第二种。
- 找原因的过程中,还尝试过直接将高版本Ubuntu22上的libc.so替换到低版本的Ubuntu20上,结果ls、mv、rm等命令全都报段错误了,只剩下cd能用,文章后面聊聊这个和当时的救火的办法。
apt更新libc6
- 添加高版本的apt源其实有点玩火,但能救急
- 添加高版本Ubuntu22的apt源:
$ sudo vi /etc/apt/sources.list
- 添加行:
deb http://th.archive.ubuntu.com/ubuntu jammy main
- 保存后apt更新并更新libc:
$ sudo apt update
$ sudo apt install libc6
- 然后就ok了,如果提示找不到libcxx_xxx的某个版本,可以编译安装新版本的gcc解决。
ls/mv等基础命令段错误救火
- 一开始是在Ubuntu22上编译得到了程序和一些动态库,然后把程序和动态库复制到ubuntu20上运行,此时就报错提示找不到libc6和libcxx的一些版本。
- 然后就尝试把 libcxx 复制过来到 /usr/local/lib64 中,此时只剩下 libc6 的报错
- 接着就试试同样的把ubuntu22 上的 libc6 复制到 /usr/local/lib64 上,在 ldconfig 中该路径是动态库的优先搜索路径,此时程序执行时就会优先搜索该路径下的 libc6 和 libcxx
- 也就是这时,ls/mv/rm等基础命令全部段错误!!!只剩下cd/export等小部分命令可用
- 这说明是复制过来的 libc6 不能用出毛病了,此时千万不能断开ssh连接,不然就臭了。
- 然后设置更高优先级的动态库搜索路径变量 LD_LIBARY_PATH 让它优先搜索使用原本的 libc6 所在路径:
$ export LD_LIBARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBARY_PATH
- 接着赶紧把复制过来的 libc6.so 删掉。等测试正常后即可取消掉该环境变量:
$ unset LD_LIBARY_PATH
Hi Neat post Theres an issue together with your web site in internet explorer may test this IE still is the marketplace chief and a good component of people will pass over your fantastic writing due to this problem
obviously like your website but you need to test the spelling on quite a few of your posts Several of them are rife with spelling problems and I to find it very troublesome to inform the reality on the other hand Ill certainly come back again
What is the best absolutely free blog/web or search engine directory on the web?
ไพเราะและชวนคิด คุณจัดการทำให้หัวข้อที่ซับซ้อนนี้เข้าถึงได้และน่าสนใจ
What i do not realize is in fact how you are no longer actually much more wellfavored than you might be right now Youre very intelligent You recognize thus considerably in relation to this topic made me in my view believe it from numerous numerous angles Its like men and women are not fascinated until it is one thing to do with Lady gaga Your own stuffs excellent All the time handle it up
My brother suggested I might like this blog He was totally right This post actually made my day You can not imagine simply how much time I had spent for this info Thanks
Mygreat learning This is really interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your site in my social networks!
My admiration for your creations is as substantial as your own sentiment. The visual presentation is tasteful, and the written content is sophisticated. Yet, you seem uneasy about the possibility of presenting something that may cause unease. I’m confident you’ll be able to resolve this issue efficiently.
I was just as enthralled by your work as you were. The visual presentation is refined, and the written content is sophisticated. However, you seem anxious about the possibility of presenting something that could be perceived as questionable. I believe you’ll be able to rectify this matter in a timely manner.
Vitazen Keto Gummies I just like the helpful information you provide in your articles
Meu irmão sugeriu que eu pudesse gostar deste blog Ele estava totalmente certo Este post realmente fez o meu dia Você não pode imaginar quanto tempo gastei com esta informação Obrigado
Vitazen Keto Gummies Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
I do not even know how I ended up here but I thought this post was great I dont know who you are but definitely youre going to a famous blogger if you arent already Cheers