reposted from security.stackoverflow as this may be a more appropriate section for the question.
I am getting multiple undefined references when gcc attempts to link my code. I built openssl-3.0.5 using "./Configure --api=1.0.0 no-deprecated linux-x86_64" and I am linking against the static libraries libssl.a and libcrypto.a (using the -static flag to gcc). All of the EVP_MAC_xxx come up undefined (init, update, CTX_new, fetch, final) along with i2d_X509 and others.
I do not get any compiler errors or warnings, only the linker is having issues. When I type "nm -A libcrypto.a | grep EVP_MAC_update" I get
libcrypto.a:libcrypto-lib-mac_lib.o: 0000000000000420 T _EVP_MAC_update
libcrypto.a:libcrypto-lib-siv128.o: U _EVP_MAC_update
libcrypto.a:libdefault-lib-kbkdf.o: U _EVP_MAC_update
libcrypto.a:libdefault-lib-sskdf.o: U _EVP_MAC_update
libcrypto.a:libdefault-lib-tls1_prf.o: U _EVP_MAC_update
libcrypto.a:libdefault-lib-drbg_hmac.o: U _EVP_MAC_update
libcrypto.a:libdefault-lib-mac_legacy_sig.o: U _EVP_MAC_update
Any suggestions on what I can do to resolve this issue would be appreciated. I suspect that I am building openssl incorrectly.
The gcc options include the "-I" for the inlcude directories, the -Lopenssl-3.0.5, the "-static" so that gcc will pull the ".a" files instead of the ".so" files, and -lssl, -lcrypto, and -lrt sinc I am using mqueue.h. The code compiles with no errors or warnings. The gcc command is of the form "gcc -lrt -I. -Iopenssl-3.0.5/include -static -L./openssl-3.0.5 -lssl -lcrypto file.c" The errors that I am seeing from gcc are:
/tmp/ccy9kLz0.o: In function `file_await_pull_response_state':
file.c:(.text+0x5da): undefined reference to `EVP_MAC_fetch'
file.c:(.text+0x5ea): undefined reference to `EVP_MAC_CTX_new'
file.c:(.text+0x6cd): undefined reference to `EVP_MAC_init'
file.c:(.text+0x6ec): undefined reference to `EVP_MAC_update'