Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IXSocketOpenSSL.cpp:(.text+0xe98): undefined reference to `SSL_get_peer_certificate' #305

Open
squeaktoy opened this issue Jun 4, 2024 · 6 comments

Comments

@squeaktoy
Copy link

squeaktoy commented Jun 4, 2024

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"
@ouwou
Copy link
Member

ouwou commented Jun 5, 2024

what version is your openssl? i think it might be too old

@squeaktoy
Copy link
Author

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"

@ouwou
Copy link
Member

ouwou commented Jun 5, 2024

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

@squeaktoy
Copy link
Author

OPENSSL_INCLUDE_DIR:PATH=/usr/include

@squeaktoy
Copy link
Author

$ 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

@ouwou
Copy link
Member

ouwou commented Jun 10, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants