Undefined reference to SSL_CTX_set1_param at openssl-1.1.1i

Hi All,

I'm trying to integer mips platform to OpenWrt 19.07.7.
At openssl-1.1.1i, it always show up undefined reference.

${LDCMD:-mips-linux-gcc} -pthread -mabi=32 -Wa,--noexecstack -Wall -O3 -Os -pipe -fno-caller-saves -fno-plt  -Wformat -Werror=format-security -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -ffunction-sections -fdata-sections -znow -zrelro -L.  -L/home/builder/workdir/openwrt/openwrt/staging_dir/target-mips-linux_uClibc/usr/lib -L/home/builder/workdir/openwrt/openwrt/staging_dir/target-mips-linux_uClibc/lib -L/usr/local/rsdk-6.5.0-5281-EL-4.9-u1.0-m32fut-191025p1/usr/lib -L/usr/local/rsdk-6.5.0-5281-EL-4.9-u1.0-m32fut-191025p1/lib -Wl,--gc-sections \
	-o apps/openssl apps/asn1pars.o apps/ca.o apps/ciphers.o apps/cms.o apps/crl.o apps/crl2p7.o apps/dgst.o apps/dhparam.o apps/dsa.o apps/dsaparam.o apps/ec.o apps/ecparam.o apps/enc.o apps/engine.o apps/errstr.o apps/gendsa.o apps/genpkey.o apps/genrsa.o apps/nseq.o apps/ocsp.o apps/openssl.o apps/passwd.o apps/pkcs12.o apps/pkcs7.o apps/pkcs8.o apps/pkey.o apps/pkeyparam.o apps/pkeyutl.o apps/prime.o apps/rand.o apps/rehash.o apps/req.o apps/rsa.o apps/rsautl.o apps/s_client.o apps/s_server.o apps/s_time.o apps/sess_id.o apps/smime.o apps/speed.o apps/spkac.o apps/srp.o apps/storeutl.o apps/ts.o apps/verify.o apps/version.o apps/x509.o \
	 apps/libapps.a -lssl -lcrypto -ldl -pthread 
apps/s_client.o: In function `s_client_main':
s_client.c:(.text.s_client_main+0x1b48): undefined reference to `SSL_CTX_set1_param'
s_client.c:(.text.s_client_main+0x1b50): undefined reference to `SSL_CTX_set1_param'
apps/s_server.o: In function `s_server_main':
s_server.c:(.text.s_server_main+0x21d8): undefined reference to `SSL_CTX_set1_param'
s_server.c:(.text.s_server_main+0x21e0): undefined reference to `SSL_CTX_set1_param'
s_server.c:(.text.s_server_main+0x2564): undefined reference to `SSL_CTX_set1_param'
apps/s_server.o:s_server.c:(.text.s_server_main+0x256c): more undefined references to `SSL_CTX_set1_param' follow
apps/libapps.a(s_cb.o): In function `ssl_print_sigalgs':
s_cb.c:(.text.ssl_print_sigalgs+0x134): undefined reference to `SSL_get_peer_signature_type_nid'
s_cb.c:(.text.ssl_print_sigalgs+0x164): undefined reference to `SSL_get_peer_signature_type_nid'
s_cb.c:(.text.ssl_print_sigalgs+0x16c): undefined reference to `SSL_get_peer_signature_type_nid'
apps/libapps.a(s_cb.o): In function `print_ssl_summary':
s_cb.c:(.text.print_ssl_summary+0x26c): undefined reference to `SSL_get_peer_signature_type_nid'
s_cb.c:(.text.print_ssl_summary+0x274): undefined reference to `SSL_get_peer_signature_type_nid'
collect2: error: ld returned 1 exit status

I try to grep key word at build folder, looks like libssl.so already have it.

builder@e1359563a29c:~/workdir/openwrt/openwrt/build_dir/target-mips-linux_uClibc/openssl-1.1.1i$ grep -re SSL_CTX_set1_param *
apps/s_client.c:    if (vpmtouched && !SSL_CTX_set1_param(ctx, vpm)) {
Binary file apps/s_client.o matches
apps/s_server.c:    if (vpmtouched && !SSL_CTX_set1_param(ctx, vpm)) {
apps/s_server.c:        if (vpmtouched && !SSL_CTX_set1_param(ctx2, vpm)) {
Binary file apps/s_server.o matches
doc/man3/SSL_CTX_get0_param.pod:SSL_CTX_get0_param, SSL_get0_param, SSL_CTX_set1_param, SSL_set1_param -
doc/man3/SSL_CTX_get0_param.pod: int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm)
doc/man3/SSL_CTX_get0_param.pod:SSL_CTX_set1_param() and SSL_set1_param() set the verification parameters
doc/man3/SSL_CTX_get0_param.pod:SSL_CTX_set1_param() and SSL_set1_param() return 1 for success and 0
doc/man3/X509_VERIFY_PARAM_set_flags.pod: SSL_CTX_set1_param(ctx, param);
include/openssl/ssl.h:__owur int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
Binary file libssl.a matches
libssl.map:        SSL_CTX_set1_param;
Binary file libssl.so matches
Binary file libssl.so.1.1 matches
Binary file ssl/ssl_lib.o matches
ssl/ssl_lib.c:int SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm)
util/libssl.num:SSL_CTX_set1_param                      234	1_1_0	EXIST::FUNCTION:

Anyone can share or help on this topic? Thanks.

Hi all,

Finally, I figure out the problem. Just remove "-Wl,–gc-sections" from CFLAGS, this issue will be fixed.
Thanks.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.