Correcting Sector build errors

If you are building Sector on Ubuntu or Mint, you might encounter three kinds of errors: One about ::close() in tcpTransport.cpp at line 157, next about usleep, and the other about SSL.

SSL related errors look like below:

 /sector/common/ssltransport.cpp:229: undefined reference to `SSL_new'
/sector/common/ssltransport.cpp:230: undefined reference to `SSL_set_fd'
/sector/common/ssltransport.cpp:232: undefined reference to `SSL_connect'
/sector/common/ssltransport.cpp:234: undefined reference to `SSL_free'
/sector/common/ssltransport.cpp:239: undefined reference to `SSL_get_verify_result'

The way to solve them is:

  • For the ::close() error in the tcpTransport.cpp, prefix UDT as explicit namespace and it will be good. It should read, UDT::close(m_iSocket)

  • For the usleep errors, these happen in multiple locations in the source, and you want to add #include <unistd.h> in respective files to resolve it (there will be many, so you have to keep issuing make and correct them one by one)

  • For the SSL related errors, first ensure you have SSL development files installed (e.g., libssl-dev for Debian or openssl-devel for Fedora). You can check with ldd $(which openssl)

  • The main problem that happens in Sector make files for SSL is, out of order library linkage. The ssl, crypto libraries should come after libclient.a and libsecurity.a on the g++ command line, but the make files have it incorrect. Need to correct this.

  • You can correct the make files (one by one, once again) by opening the respective make file that is causing the error from the corresponding directory and adding -lssl -lcrypto to the end for LDFLAGS┬ávariable. It should look something like:

     LDFLAGS += ../lib/libclient.a ../lib/libsecurity.a ../lib/librpc.a ../lib/libcommon.a ../lib/libudt.a -lssl -lcrypto