0

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.

Community
  • 1
  • 1
Alex Reynolds
  • 95,983
  • 54
  • 240
  • 345
  • 1
    There aren't such things as stupid questions ;) – Evert Nov 28 '12 at 11:25
  • The first question is why are you linking against libcrypto.a (a static library) instead of the far more typical libcrypto.so? Is that intentional (because you need a static build for some reason), or is that another angle of your problem? libcrypto is internally using dynamic loading, so linking against the static version appears not to make much sense, so the easiest fix would be to link against the shared version. – rra Mar 17 '13 at 20:12

0 Answers0