openssl的动态库编译和静态编译

1.openssl源码下载

  下载地址:https://github.com/openssl/openssl

2.openssl编译
      ./config shared --prefix=/home/openssl

--prefix为输出的路径

shared为输出动态库

no-shared为输出静态库库

3.编译:

make  //编译

make install //输出include和lib文件夹到--prefix指定的目录内。

 

########################################################

静态链接ssl库时,glibc会有类似如下的提示:

warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking

这是由于glibc中使用了其他的库导致的,可能的解法:

1.改为动态链接。

2.使用glibc以外的其他libc库

参考链接:

https://stackoverflow.com/questions/15165306/compile-a-static-binary-which-code-there-a-function-gethostbyname

 ########################################################

posted @ 2021-03-16 22:45  稀里糊涂的胡闹  阅读(3792)  评论(0)    收藏  举报