IXSocketOpenSSL.cpp:(.text+0xe98): undefined reference to `SSL_get_peer_certificate'
I build abaddon with the following command, and it fails with the following error during link-time.
cmake -Bbuild -DCMAKE_BUILD_TYPE=RelWithDebInfo . && cmake --build build/ -j4:
[100%] Linking CXX executable abaddon
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/local/lib64/libixwebsocket.a(IXSocketOpenSSL.cpp.o): in function `ix::SocketOpenSSL::openSSLCheckServerCert(ssl_st*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
IXSocketOpenSSL.cpp:(.text+0xe98): undefined reference to `SSL_get_peer_certificate'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/abaddon.dir/build.make:1797: abaddon] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:103: CMakeFiles/abaddon.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
System info: OS: Gentoo Linux
net-libs/ixwebsocket-11.4.4::guru was built with the following:
USE="ssl zlib -test -ws" ABI_X86="(64)"
FEATURES="binpkg-docompress distlocks multilib-strict fixlafiles binpkg-logs preserve-libs xattr protect-owned qa-unresolved-soname-deps unmerge-orphans network-sandbox unmerge-logs splitdebug sfperms unknown-features-warn userpriv config-protect-if-modified pkgdir-index-trusted merge-sync usersandbox ebuild-locks parallel-fetch merge-wait userfetch ipc-sandbox binpkg-dostrip assume-digests sandbox buildpkg-live pid-sandbox usersync strict news"
what version is your openssl? i think it might be too old
dev-libs/openssl-3.0.13-r2::gentoo was built with the following:
USE="asm -fips -ktls -rfc3779 -sctp -static-libs -test -tls-compression -vanilla -verify-sig -weak-ssl-ciphers" ABI_X86="32 (64) (-x32)" CPU_FLAGS_X86="(sse)"
CFLAGS="-O2 -march=native -pipe -g -fno-strict-aliasing -Wa,--noexecstack"
CXXFLAGS="-O2 -march=native -pipe -g -fno-strict-aliasing -Wa,--noexecstack"
FEATURES="ipc-sandbox userpriv news distlocks protect-owned assume-digests parallel-fetch sfperms fail-clean binpkg-logs strict sandbox pkgdir-index-trusted unknown-features-warn ebuild-locks unmerge-orphans usersync binpkg-dostrip usersandbox unmerge-logs merge-sync pid-sandbox xattr qa-unresolved-soname-deps splitdebug network-sandbox userfetch multilib-strict binpkg-docompress config-protect-if-modified fixlafiles preserve-libs buildpkg-live"
i think cmake is picking up old openssl headers since SSL_get_peer_certificate is defined as SSL_get1_peer_certificate but thats not what the linker is seeing.
you can check OPENSSL_INCLUDE_DIR in CMakeCache.txt to see what path contains the openssl headers and openssl/opensslv.h for the version of the headers
OPENSSL_INCLUDE_DIR:PATH=/usr/include
$ rg SSL_get_peer_certificate /usr/include/openssl/
/usr/include/openssl/ssl.h
1792:# define SSL_get_peer_certificate SSL_get1_peer_certificate
As you can see it is defined, so it's strange why it's seemingly "undefined" when compiling abaddon
are there any other openssl packages installed? maybe im confusing myself but perhaps your install of ixwebsocket wants to link to openssl 1 but the build picked up openssl 3?
Well I believe my ixwebsocket is linked to OpenSSL 3.0.2
I had built abaddon successfully. It seems that there was an ixwebsocket in my /usr/local that I seemed to have not noticed for the past few months. How awful.