version `GLIBC

it2022-05-15  57

@ 今天把一个linux程序布到线上服务器上时,运行不起来,下面是解决思路。

@ 运行程序,报以下错误

root@iZ25uck2l28Z:/tmp/tmp# ./speed_test ./speed_test: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.17' not found (required by ./libchefbase.so)

说明是编译环境与运行环境的glibc版本不匹配导致的,编译环境的gcc版本4.9.0,运行环境为4.6.3

@ 先查看是哪个函数用的是GLIBC_2.17

root@iZ25uck2l28Z:/tmp/tmp# nm libchefbase.so | grep GLIBC_2.17 U clock_gettime@@GLIBC_2.17

@ man clock_gettime,可以看到其中有一句话

Link with -lrt (only for glibc versions before 2.17).

给libchefbase.so库加上-lrt,问题解决。

@ 补充一些相关命令

$objdump -T libchefbase.so | grep GLIBC_2.17 $ldd libchefbase.so $strings /lib/x86_64-linux-gnu/libgcc_s.so.1 | grep GLIBC_

转载于:https://www.cnblogs.com/q191201771/p/3875316.html


最新回复(0)