I been trying to compile a C software but I'm getting 'undefined reference' over SSL libraries I think. The libraries it mentions are there, actually I compiled them all again: zlib + openssl + openssh. Error persist.

OS openSUSE Leap 42.1.

gcc (SUSE Linux) 4.8.5

GNU Make 4.0

The error when compiling (make -j4):

/usr/lib64/libssh2.so.1: undefined reference to `EVP_aes_128_ctr'
/usr/lib64/libssh2.so.1: undefined reference to `EVP_aes_256_ctr'
/usr/local/lib64/libcurl.so: undefined reference to `SSL_CTX_set_srp_username' 
/usr/lib64/libssh2.so.1: undefined reference to `EVP_aes_192_ctr' 
/usr/local/lib64/libcurl.so: undefined reference to `SSL_CTX_set_srp_password' 
/usr/local/lib64/libcurl.so: undefined reference to `SSL_CTX_set_next_proto_select_cb' 
/usr/local/lib64/libcurl.so: undefined reference to `ERR_remove_thread_state' 
collect2: error: ld returned 1 exit status

Libraries dependency info:

ldd /usr/lib64/libssh2.so.1

linux-vdso.so.1 (0x00007fffcf745000)
libcrypto.so.1.0.0 => /lib64/libcrypto.so.1.0.0 (0x00007fde9b18f000)
libz.so.1 => /usr/local/lib/libz.so.1 (0x00007fde9af75000)
libc.so.6 => /lib64/libc.so.6 (0x00007fde9abcd000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fde9a9c9000)
/lib64/ld-linux-x86-64.so.2 (0x0000556ace037000)

ldd /usr/local/lib64/libcurl.so

linux-vdso.so.1 (0x00007ffecd319000)
libssh2.so.1 => /usr/lib64/libssh2.so.1 (0x00007f3e4760e000)
libssl.so.1.0.0 => /lib64/libssl.so.1.0.0 (0x00007f3e473a6000)
libcrypto.so.1.0.0 => /lib64/libcrypto.so.1.0.0 (0x00007f3e46fb1000)
liblber-2.4.so.2 => /usr/lib64/liblber-2.4.so.2 (0x00007f3e46da2000)
libldap-2.4.so.2 => /usr/lib64/libldap-2.4.so.2 (0x00007f3e46b56000)
libz.so.1 => /usr/local/lib/libz.so.1 (0x00007f3e4693c000)
libc.so.6 => /lib64/libc.so.6 (0x00007f3e46594000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f3e46390000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f3e46178000)
libsasl2.so.3 => /usr/lib64/libsasl2.so.3 (0x00007f3e45f5b000)
/lib64/ld-linux-x86-64.so.2 (0x000055e1d1abf000)

Is there a missing dependency? Thanks.

  • Very closely related: compiling curl with openssl giving wrong openssl version. Your question wants to build {OpenSSL,cURL,OpenSSH}. The cited question builds {OpenSSL,ngHTTP,cURL}. Slightly different components, but the same issues and same fixes. In fact, the cited even verifies the result with LDD to show the process succeeded.
    – user56041
    Commented Nov 9, 2016 at 13:02

1 Answer 1


The error messages are near the end; the beginning is not shown.

The ldd does not show the pathnames used for linking new programs. It only shows pathnames used for running existing programs. You might be missing the development package for OpenSSL, which would include symbolic links for names ending with ".so" (which would point to the versioned library names that you show in the ldd output).

For example, on my OpenSuSE 13, I have libopenssl-devel-1.0.1k-11.87.1.x86_64 which contains the symbolic links


Also, ldd shows this:

    linux-vdso.so.1 (0x00007ffc0d09f000)
    libcrypto.so.1.0.0 => /lib64/libcrypto.so.1.0.0 (0x00007f63ae4f3000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f63ae2dd000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f63adf2f000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f63add2b000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f63aeb0a000)

which has libz installed in the system, rather than built into /usr/local/lib, e.g., from libz1-1.2.8-3.1.2.x86_64 (why you compiled this library is unclear, since it was already a dependency of the libssh2.so which is in your system area).

Usually ldd will mark libraries which cannot be found. Your substitute libz.so may be a problem, e.g., if it is not the same model as the file it replaced. You could compare that using the file utility. Also, you can get more information about the actual libraries used for linking using the verbose option -v (in case it attempts to use libraries which happen to have the same names as the dependencies shown by ldd).

  • Hi Thomas, I have openssl-devel (64 and 32) installed. Those symbolic links also exist. 'libopenssl-devel' is already installed. 'libopenssl-devel-32bit' is already installed.
    – user174141
    Commented Jun 8, 2016 at 21:25
  • Although no previous warning or error showed up before the first undefined reference.
    – user174141
    Commented Jun 8, 2016 at 21:32
  • I compiled libz when compiled openssl and openssh, I have uninstalled that version and installed libz1-1.2.8 package , it installed it again on /lib64/ not in /usr/local/lib64/ I have copied the libz to that location and it still does not work. I'm pasting ldd -v here: gist.github.com/anonymous/f4c0afa034a039d16738c810119d5c80
    – user174141
    Commented Jun 9, 2016 at 7:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .