When linking in OpenSSL to my code, adding -lssl -lcrypto
to my link step, I get the following error:
/usr/lib/../lib64/libcrypto.a(fips.o): In function `FIPSCHECK_verify':
(.text+0x8da): undefined reference to `dlopen'
/usr/lib/../lib64/libcrypto.a(fips.o): In function `FIPSCHECK_verify':
(.text+0x8f1): undefined reference to `dlsym'
/usr/lib/../lib64/libcrypto.a(fips.o): In function `FIPSCHECK_verify':
(.text+0x903): undefined reference to `dladdr'
/usr/lib/../lib64/libcrypto.a(fips.o): In function `FIPSCHECK_verify':
(.text+0x90f): undefined reference to `dlclose'
/usr/lib/../lib64/libcrypto.a(fips.o): In function `FIPSCHECK_verify':
(.text+0x98a): undefined reference to `dlclose'
collect2: error: ld returned 1 exit status
make: *** [run] Error 1
From the answer to this Stack Overflow question, I added -ldl
, and now I get the following warning:
/usr/lib/../lib64/libcrypto.a(fips.o): In function `FIPSCHECK_verify':
(.text+0x8da): warning: Using 'dlopen' in statically linked applications
requires at runtime the shared libraries from the glibc version used for linking
This is a Linux workstation, and I'm not too familiar with how I might figure out how to link in the libraries from "the glibc version used for linking"
:
$ uname -a
Linux foo.example.com 2.6.18-274.el5 #1 SMP Fri Jul 8 17:36:59 EDT 2011 x86_64 GNU/Linux
How could I go about addressing this warning? One of my requirements is that I need to compile a static binary. I don't think I can relax this requirement. Apologies if this is stupid question, and thanks for your advice.