centos7 编译生成静态库的时候 cannot find -lxxx 错误

问题描述

我在编译poco-1.9.0的时候,想要生成静态库于是做了如下编译配置:

./configure --omit=Data/ODBC,Data/MySQL --static

由于编译问题太多,最终没有完全解决,还是选择了生成动态库,但是还是解决了一些编译的问题,主要是在编译的时候报cannot find -lxxx的错误,找不到的库主要是stdc++、z、ssl、crypto等。

错误原因

由于我们是通过--static参数编译生成静态库,所以编译的时候会去找相应的.a的库文件,linux上没有,所以报错。

解决方案

/usr/bin/ld: cannot find -lstdc++

yum -y install stdc++-static

/usr/bin/ld: cannot find -lz

yum -y install zlib-static

/usr/bin/ld: cannot find -lssl / -lcrypto

yum -y install openssl-static

猜你喜欢

转载自blog.csdn.net/z_junyu/article/details/86700590