静态编译报错:/usr/bin/ld: cannot find -lc

现象:执行gcc静态编译程序时报错: [code]cc -DHAVE_LASTLOG_H -o chklastlog chklastlog.c cc -DHAVE_LASTLOG_H -o chkwtmp chkwtmp.c cc -DHAVE_LASTLOG_H -D_FILE_OFFSET_BITS=64 -o ifpromisc ifpromisc.c cc -o chkproc chkproc.c cc -o chkdirs chkdirs.c cc -o check_wtmpx check_wtmpx.c cc -static -o strings-static strings.c /usr/bin/ld: cannot find -lc collect2: ld 返回 1 make: *** [strings-static] 错误 1[/code]
已邀请:

空心菜 - 心向阳光,茁壮成长

赞同来自: chris

分析:程序链接需要静态库,系统没有安装静态库导致报错,解决:安装静态库
yum install glibc-static -y

要回复问题请先登录注册