构建Openssl源代码以编译Boost [英] Building Openssl source for compiling boost

查看:586
本文介绍了构建Openssl源代码以编译Boost的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意.我已经阅读并阅读了 Boost :: asio :: ssl OpenSSL无法编译

note. I have seen and read Boost::asio::ssl OpenSSL not compiling

源文件

我在linux fedora 64上构建boost示例ssl服务器时遇到一些问题,我认为它的版本为15或16.这是一台大学计算机,因此我们没有root访问权限,并且由于周末是我通过SSH访问一台计算机. 我们没有root,也没有安装openssl. 我没有构建程序的增强库,并且示例服务器构建良好.然后,我尝试从源代码构建最新的openssl库.我提取到~/Dev/opensslSource

I am having some issues build the boost example ssl server on linux fedora 64 I think its version 15 or 16. It is a university machine so we do not have root access and since is the weekend I am accessing a machine via SSH. We do not have root and openssl is not installed. I built the boost library no program and the example server builds fine. I then tried to build the latest openssl library from source. I extracted to ~/Dev/opensslSource

Cd ~/Dev/opensslSource
 ./config --prefix=~/Dev/openssl --openssldir=~/Dev/openssl
Make
Make install

现在问题要么存在在那里,要么就是我包含和链接的方式. 因此,然后在我的boostexamples文件夹中保存了示例

Now either the problem exists there or in how I am including and linking. So then in my boostexamples folder I did saved the example sslserver.cpp And used the following to build.

g++ -I ~/Dev/boost_1_52_0/ -I ~/Dev/openssl/include -L ~/Dev/boost_1_52_0/stage/lib -L ~/Dev/openssl server.cpp -o server -lboost_system -lssl –lpthread

错误几乎无穷无尽.我什至看不到它们.但我相信它们只是不确定的参考.

The errors are almost endless. I cant even see them all. But they are all just undefided references I believe.

d1_enc.c:(.text+0x10c): undefined reference to `EVP_MD_size'
d1_enc.c:(.text+0x12f): undefined reference to `EVP_CIPHER_CTX_cipher'
d1_enc.c:(.text+0x155): undefined reference to `EVP_CIPHER_block_size'
d1_enc.c:(.text+0x1b2): undefined reference to `EVP_Cipher'
d1_enc.c:(.text+0x2cf): undefined reference to `EVP_Cipher'
d1_enc.c:(.text+0x34b): undefined reference to `EVP_CIPHER_block_size'
d1_enc.c:(.text+0x363): undefined reference to `EVP_CIPHER_block_size'
d1_enc.c:(.text+0x375): undefined reference to `RAND_bytes'

因此,在最初的几条评论之后,我将构建版本更改为.

So after the first few comments I have changed the build to.

g++ -I ~/Dev/boost_1_52_0/ -I ~/Dev/openssl/include -L ~/Dev/boost_1_52_0/stage/lib –L ~/Dev/openssl/lib server.cpp -o server -lboost_system -lssl -lcrypto -lpthread

现在出错.

/home/andrew/Dev/openssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
dso_dlfcn.c:(.text+0x1d): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x33): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x3d): undefined reference to `dlclose'
/home/andrew/Dev/openssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
dso_dlfcn.c:(.text+0x381): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x460): undefined reference to `dlerror'
/home/andrew/Dev/openssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
dso_dlfcn.c:(.text+0x4e1): undefined reference to `dlsym'
dso_dlfcn.c:(.text+0x5c0): undefined reference to `dlerror'
/home/andrew/Dev/openssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
dso_dlfcn.c:(.text+0x637): undefined reference to `dlopen'
dso_dlfcn.c:(.text+0x6ae): undefined reference to `dlclose'
dso_dlfcn.c:(.text+0x6e5): undefined reference to `dlerror'
/home/andrew/Dev/openssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
dso_dlfcn.c:(.text+0x781): undefined reference to `dladdr'
dso_dlfcn.c:(.text+0x7e9): undefined reference to `dlerror'
/home/andrew/Dev/openssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
dso_dlfcn.c:(.text+0x84a): undefined reference to `dlclose'
collect2: ld returned 1 exit status

推荐答案

链接选项中缺少一些库:libssl依赖于libcrypto,而libcrypto依赖于libdl.总之,您将需要

You are missing a few libraries from your linking options: libssl depends on libcrypto, which in turn depends on libdl. All in all, you will need

-lboost_system -lssl -lcrypto -ldl -lpthread.

这篇关于构建Openssl源代码以编译Boost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆