根据报错信息分析 configure: error: off_t undefined; check your library configuration
未定义的类型 off_t
。
off_t
类型是在 头文件 unistd.h
中定义的,在32位系统 编译成 long int
,64位系统则编译成 long long int
,这里题主的系统应该是 64位的吧,在进行编译的时候 是默认查找64位的动态链接库,但是默认情况下 centos 的动态链接库配置文件/etc/ld.so.conf
里并没有加入搜索路径,这个时候需要将 /usr/local/lib64
/usr/lib64
这些针对64位的库文件路径加进去。
所以 @张馆长 的方法是可行的
# 添加搜索路径到配置文件
echo '/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64'>>/etc/ld.so.conf
# 更新配置
ldconfig -v
(其中ldconfig -v 是用来更新ld的缓存文件 ld.so.cache
, 缓存文件的目的是记录动态编译库文件的路径,加快二进制文件运行时的速度)
待验证: ld默认搜索路径应该是 /usr/local/lib
/usr/lib
,这个待验证
ld默认搜索路径是 /usr/local/lib
/usr/lib
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…