0

I am having issues porting a Windows project I have on Ubuntu 18.04. I have one main project with about 10 sub-projects. I am using CMake for this project. For some reason, one of my sub-project fails with the following error:

/usr/bin/ld: CMakeFiles/unittest.dir/network/Test.cpp.o: undefined reference to symbol 'BIO_ctrl_pending@@OPENSSL_1_1_0'
//usr/lib/x86_64-linux-gnu/libcrypto.so.1.1: error adding symbols: DSO missing from command line

I have a lot of CMake related artifacts for my project, so I am not too sure what would help you guys diagnose this. I noticed that two sub-projects use the same libraries, yet one fails for the reason listed above when the other doesn't. I noticed that in a generated build.cmake file, I have this external object file that is included :

/lib/x86_64-linux-gnu/libcrypt-2.27.so

This is strange because I have never included a path towards this library. I also do not have a path towards /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1. I don't understand why it tries to use that library when mine is in a different folder.

For this sub-project, I am using open-ssl and cryptopp. My only guess would be that these two libraries have some sort of conflict, but this is only the case on one sub-project when they have the same dependencies.

I'm sorry I am not giving you much here, but if you tell me what would be relevant to show, I will edit my post to add any code you would need to help. I simply have no clue where to even look anymore for this.

jww
  • 97,681
  • 90
  • 411
  • 885
JigsawCorp
  • 479
  • 2
  • 6
  • 15
  • You can try to specify the library location when calling cpp. Something like `-l + filename` – hackela Jun 14 '19 at 18:26
  • If you look into the first error line only, you will find that you forgot to link (one of your library or executable) with the library, which provides `BIO_ctrl_pending@@OPENSSL_1_1_0` given symbol. The second error line tells you more - the symbol exists in the `/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1` library, which you actually link, but link **before** the object file. Since linking is performed with CMake, it seems that you try to add linker flags like `-lcrypto` which is wrong: linking should be performed with `target_link_libraries`. – Tsyvarev Jun 14 '19 at 20:20
  • `BIO_ctrl_pending` is OpenSSL, not Crypto++. – jww Jun 14 '19 at 22:42
  • `BIO_ctrl_pending` is part of OpenSSL's `libcrypto`. You must link against `-lcrypto` in the makefile. Add `-lcrypto` to your `LDFLAGS` or `LDLIBS`. – jww Jun 14 '19 at 22:51
  • `libcrypt` is from glibc. I think you need to get a hold of what you are doing. You need to pick a library, like OpenSSL, and stick to it. Don't pull in Crypto++ or glibc. – jww Jun 14 '19 at 22:53
  • @jww We use both OpenSSL and Crypto++ in our project. I am letting the cmake do all the work. For some reason, the linking with libcrypt works perfectly fine with one subproject, but not with an other one. Both project have OpenSSL and Crypto++ as dependencies. This seems to make no sense. – JigsawCorp Jun 17 '19 at 13:18
  • If you are using both Crypto++ and OpenSSL, then you might find Botan a nice choice. Botan is a C++11 TLS library. – jww Jun 17 '19 at 21:47

0 Answers0