gpt4 book ai didi

c++ - 构建用于编译 boost 的 Openssl 源代码

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:52:03 26 4
gpt4 key购买 nike

注意。我看过并读过Boost::asio::ssl OpenSSL not compiling

source file

我在 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

现在问题要么存在于那里,要么存在于我的包含和链接方式中。因此,在我的 bootexamples 文件夹中,我确实保存了示例 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'

所以在前几条评论之后,我将构建更改为。

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。总而言之,您将需要

-lboost_system -lssl -lcrypto -ldl -lpthread

关于c++ - 构建用于编译 boost 的 Openssl 源代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14674360/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com