ld:OpenSSL (libssl) 中未找到符号

发布于 2024-09-04 04:51:25 字数 5470 浏览 3 评论 0原文

我正在尝试在我的 mac 上构建 TorTunnel。我已经成功安装了 Boost 库及其开发文件。 TorTunnel 还需要 OpenSSL 及其开发文件。

我已将它们安装在 /usr/lib/libssl.dylib 和 /usr/include/openssl/ 中。

当我运行 make 命令时,这是我收到的错误:

g++ -ggdb -g -O2 -lssl -lboost_system-xgcc42-mt-1_38  -o torproxy TorProxy.o HybridEncryption.o Connection.o Cell.o Directory.o ServerListing.o Util.o Circuit.o CellEncrypter.o RelayCellDispatcher.o CellConsumer.o ProxyShuffler.o CreateCell.o CreatedCell.o TorTunnel.o SocksConnection.o Network.o  
Undefined symbols:
  "_BN_hex2bn", referenced from:
      Circuit::initializeDhParameters()      in Circuit.o
  "_BN_free", referenced from:
      Circuit::~Circuit()in Circuit.o
      Circuit::~Circuit()in Circuit.o
      CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o
  "_DH_generate_key", referenced from:
      Circuit::initializeDhParameters()      in Circuit.o
  "_PEM_read_bio_RSAPublicKey", referenced from:
      ServerListing::getOnionKey()       in ServerListing.o
  "_BIO_s_mem", referenced from:
      Connection::initializeSSL()       in Connection.o
      Connection::initializeSSL()       in Connection.o
  "_DH_free", referenced from:
      Circuit::~Circuit()in Circuit.o
  "_BIO_ctrl_pending", referenced from:
      Connection::writeFromBuffer(boost::function)in Connection.o
  "_RSA_size", referenced from:
      HybridEncryption::encryptInSingleChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o
      HybridEncryption::encryptInHybridChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o
      HybridEncryption::encrypt(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o
  "_RSA_public_encrypt", referenced from:
      HybridEncryption::encryptInSingleChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o
      HybridEncryption::encryptInHybridChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o
  "_BN_num_bits", referenced from:
      CreateCell::CreateCell(unsigned short, dh_st*, rsa_st*)in CreateCell.o
      CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o
      CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o
      CreatedCell::isValid()      in CreatedCell.o
  "_SHA1", referenced from:
      CellEncrypter::expandKeyMaterial(unsigned char*, int, unsigned char*, int)in CellEncrypter.o
  "_BN_bn2bin", referenced from:
      CreateCell::CreateCell(unsigned short, dh_st*, rsa_st*)in CreateCell.o
  "_BN_bin2bn", referenced from:
      CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o
  "_DH_compute_key", referenced from:
      CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o
  "_BIO_new", referenced from:
      Connection::initializeSSL()       in Connection.o
      Connection::initializeSSL()       in Connection.o
  "_BIO_new_mem_buf", referenced from:
      ServerListing::getOnionKey()       in ServerListing.o
  "_AES_ctr128_encrypt", referenced from:
      HybridEncryption::AES_encrypt(unsigned char*, int, unsigned char*, unsigned char*, int)in HybridEncryption.o
      CellEncrypter::aesOperate(Cell&, aes_key_st*, unsigned char*, unsigned char*, unsigned int*)in CellEncrypter.o
  "_BIO_read", referenced from:
      Connection::writeFromBuffer(boost::function)in Connection.o
  "_SHA1_Update", referenced from:
      CellEncrypter::calculateDigest(SHAstate_st*, RelayCell&, unsigned char*)in CellEncrypter.o
      CellEncrypter::initKeyMaterial(unsigned char*)in CellEncrypter.o
      CellEncrypter::initKeyMaterial(unsigned char*)in CellEncrypter.o
  "_SHA1_Final", referenced from:
      CellEncrypter::calculateDigest(SHAstate_st*, RelayCell&, unsigned char*)in CellEncrypter.o
  "_DH_size", referenced from:
      CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o
  "_DH_new", referenced from:
      Circuit::initializeDhParameters()      in Circuit.o
  "_BIO_write", referenced from:
      Connection::readIntoBufferComplete(boost::function, boost::system::error_code const&, unsigned long)in Connection.o
  "_RSA_free", referenced from:
      Circuit::~Circuit()in Circuit.o
  "_BN_dup", referenced from:
      Circuit::initializeDhParameters()      in Circuit.o
      Circuit::initializeDhParameters()      in Circuit.o
  "_BN_new", referenced from:
      Circuit::initializeDhParameters()      in Circuit.o
      Circuit::initializeDhParameters()      in Circuit.o
  "_SHA1_Init", referenced from:
      CellEncrypter::CellEncrypter()in CellEncrypter.o
      CellEncrypter::CellEncrypter()in CellEncrypter.o
  "_RAND_bytes", referenced from:
      HybridEncryption::encryptInHybridChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o
      Util::getRandomId()      in Util.o
  "_AES_set_encrypt_key", referenced from:
      HybridEncryption::AES_encrypt(unsigned char*, int, unsigned char*, unsigned char*, int)in HybridEncryption.o
      CellEncrypter::initKeyMaterial(unsigned char*)in CellEncrypter.o
      CellEncrypter::initKeyMaterial(unsigned char*)in CellEncrypter.o
  "_BN_set_word", referenced from:
      Circuit::initializeDhParameters()      in Circuit.o
  "_RSA_new", referenced from:
      ServerListing::getOnionKey()       in ServerListing.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [torproxy] Error 1

知道如何修复它吗?

I'm trying to build TorTunnel on my mac. I've successfully installed the Boost library and its development files. TorTunnel also requires the OpenSSL and its development files.

I've got them installed in /usr/lib/libssl.dylib and /usr/include/openssl/.

When I run the make command this is the error i'm getting:

g++ -ggdb -g -O2 -lssl -lboost_system-xgcc42-mt-1_38  -o torproxy TorProxy.o HybridEncryption.o Connection.o Cell.o Directory.o ServerListing.o Util.o Circuit.o CellEncrypter.o RelayCellDispatcher.o CellConsumer.o ProxyShuffler.o CreateCell.o CreatedCell.o TorTunnel.o SocksConnection.o Network.o  
Undefined symbols:
  "_BN_hex2bn", referenced from:
      Circuit::initializeDhParameters()      in Circuit.o
  "_BN_free", referenced from:
      Circuit::~Circuit()in Circuit.o
      Circuit::~Circuit()in Circuit.o
      CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o
  "_DH_generate_key", referenced from:
      Circuit::initializeDhParameters()      in Circuit.o
  "_PEM_read_bio_RSAPublicKey", referenced from:
      ServerListing::getOnionKey()       in ServerListing.o
  "_BIO_s_mem", referenced from:
      Connection::initializeSSL()       in Connection.o
      Connection::initializeSSL()       in Connection.o
  "_DH_free", referenced from:
      Circuit::~Circuit()in Circuit.o
  "_BIO_ctrl_pending", referenced from:
      Connection::writeFromBuffer(boost::function)in Connection.o
  "_RSA_size", referenced from:
      HybridEncryption::encryptInSingleChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o
      HybridEncryption::encryptInHybridChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o
      HybridEncryption::encrypt(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o
  "_RSA_public_encrypt", referenced from:
      HybridEncryption::encryptInSingleChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o
      HybridEncryption::encryptInHybridChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o
  "_BN_num_bits", referenced from:
      CreateCell::CreateCell(unsigned short, dh_st*, rsa_st*)in CreateCell.o
      CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o
      CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o
      CreatedCell::isValid()      in CreatedCell.o
  "_SHA1", referenced from:
      CellEncrypter::expandKeyMaterial(unsigned char*, int, unsigned char*, int)in CellEncrypter.o
  "_BN_bn2bin", referenced from:
      CreateCell::CreateCell(unsigned short, dh_st*, rsa_st*)in CreateCell.o
  "_BN_bin2bn", referenced from:
      CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o
  "_DH_compute_key", referenced from:
      CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o
  "_BIO_new", referenced from:
      Connection::initializeSSL()       in Connection.o
      Connection::initializeSSL()       in Connection.o
  "_BIO_new_mem_buf", referenced from:
      ServerListing::getOnionKey()       in ServerListing.o
  "_AES_ctr128_encrypt", referenced from:
      HybridEncryption::AES_encrypt(unsigned char*, int, unsigned char*, unsigned char*, int)in HybridEncryption.o
      CellEncrypter::aesOperate(Cell&, aes_key_st*, unsigned char*, unsigned char*, unsigned int*)in CellEncrypter.o
  "_BIO_read", referenced from:
      Connection::writeFromBuffer(boost::function)in Connection.o
  "_SHA1_Update", referenced from:
      CellEncrypter::calculateDigest(SHAstate_st*, RelayCell&, unsigned char*)in CellEncrypter.o
      CellEncrypter::initKeyMaterial(unsigned char*)in CellEncrypter.o
      CellEncrypter::initKeyMaterial(unsigned char*)in CellEncrypter.o
  "_SHA1_Final", referenced from:
      CellEncrypter::calculateDigest(SHAstate_st*, RelayCell&, unsigned char*)in CellEncrypter.o
  "_DH_size", referenced from:
      CreatedCell::getKeyMaterial(unsigned char**, unsigned char**)in CreatedCell.o
  "_DH_new", referenced from:
      Circuit::initializeDhParameters()      in Circuit.o
  "_BIO_write", referenced from:
      Connection::readIntoBufferComplete(boost::function, boost::system::error_code const&, unsigned long)in Connection.o
  "_RSA_free", referenced from:
      Circuit::~Circuit()in Circuit.o
  "_BN_dup", referenced from:
      Circuit::initializeDhParameters()      in Circuit.o
      Circuit::initializeDhParameters()      in Circuit.o
  "_BN_new", referenced from:
      Circuit::initializeDhParameters()      in Circuit.o
      Circuit::initializeDhParameters()      in Circuit.o
  "_SHA1_Init", referenced from:
      CellEncrypter::CellEncrypter()in CellEncrypter.o
      CellEncrypter::CellEncrypter()in CellEncrypter.o
  "_RAND_bytes", referenced from:
      HybridEncryption::encryptInHybridChunk(unsigned char*, int, unsigned char**, int*, rsa_st*)in HybridEncryption.o
      Util::getRandomId()      in Util.o
  "_AES_set_encrypt_key", referenced from:
      HybridEncryption::AES_encrypt(unsigned char*, int, unsigned char*, unsigned char*, int)in HybridEncryption.o
      CellEncrypter::initKeyMaterial(unsigned char*)in CellEncrypter.o
      CellEncrypter::initKeyMaterial(unsigned char*)in CellEncrypter.o
  "_BN_set_word", referenced from:
      Circuit::initializeDhParameters()      in Circuit.o
  "_RSA_new", referenced from:
      ServerListing::getOnionKey()       in ServerListing.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [torproxy] Error 1

Any idea how I could fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如果没有你 2024-09-11 04:51:25

您还需要 libcrypto。

将您的链接行更改为:

g++ -ggdb -g -O2 -lssl -lcrypt ... as before ...

You also need libcrypto.

Change your link line to:

g++ -ggdb -g -O2 -lssl -lcrypt ... as before ...
甜`诱少女 2024-09-11 04:51:25

至少有一个缺失的符号不是 libssl 的一部分,而是 libcrypto 的一部分:

diciu:~ diciu$ nm /usr/lib/libcrypto.dylib | grep PEM_read_bio_RSAPublicKey
00031d20 T _PEM_read_bio_RSAPublicKey

将“-lcrypto”添加到编译行。

At least on of the missing symbols is not part of libssl but part of libcrypto:

diciu:~ diciu$ nm /usr/lib/libcrypto.dylib | grep PEM_read_bio_RSAPublicKey
00031d20 T _PEM_read_bio_RSAPublicKey

Add "-lcrypto" to your compile line.

一指流沙 2024-09-11 04:51:25

如果 libcrypto 已安装在 /opt/local/lib 中,请将 -lcrypt 标志更改为 -lcrypto 标志。

 g++ -ggdb -g -O2 -L/opt/local/lib -L/usr/lib -lssl -lcrypto -lboost_system-mt

If libcrypto is already installed in /opt/local/lib, change -lcrypt flag to -lcrypto flag.

 g++ -ggdb -g -O2 -L/opt/local/lib -L/usr/lib -lssl -lcrypto -lboost_system-mt
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文