【发布时间】:2013-02-03 16:01:53
【问题描述】:
注意。我看过并阅读过Boost::asio::ssl OpenSSL not compiling
我在 linux fedora 64 上构建 boost 示例 ssl 服务器时遇到了一些问题,我认为它的版本是 15 或 16。它是一台大学机器,所以我们没有 root 访问权限,因为是周末我通过 SSH 访问一台机器.
我们没有root,也没有安装openssl。
我没有构建boost库,示例服务器构建良好。然后我尝试从源代码构建最新的openssl 库。我提取到~/Dev/opensslSource
Cd ~/Dev/opensslSource
./config --prefix=~/Dev/openssl --openssldir=~/Dev/openssl
Make
Make install
现在问题存在于那里或我如何包含和链接。 然后在我的 boostexamples 文件夹中,我确实保存了示例 sslserver.cpp 并使用以下内容进行构建。
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
错误几乎无穷无尽。我什至都看不到他们。但我相信它们都只是未定义的参考。
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'
所以在最初的几个 cmets 之后,我将构建更改为。
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
【问题讨论】:
-
也可以试试
-lcrypto?-lssl仅链接 OpenSSL 的 SSL 部分,但该部分取决于加密库。把它放在命令行的-lssl之后。 -
另外,尝试把
-lboost_system放在-lssl之后。 -
好的,我现在才登录,我的 ssh 已过期.. 不会是一分钟。谢谢大家。
-
@us2012 不会 Boost 依赖于 OpenSSL 而不是相反?
-
@OmriBarel 当然,你是对的。