title: Cannot find libcrypto library error
body: <p>When i am trying to compile a <code>C</code> code which uses openssl 'crypto' library functions with comand line <code>-lcrypto</code> with <code>gcc 4.4.3</code> it gives an error </p>
  
  <pre><code>`@ubu:$ gcc -ggdb aes_m.c -Werror -Wall -I /usr/local/ssl/include/ -lcrypto -o aes
   /usr/bin/ld: cannot find -lcrypto
   collect2: ld returned 1 exit status`
  </code></pre>
  
  <p>what can be the reason for this??</p>
  
  <p>I have already gone through this discussion <a href="https://stackoverflow.com/questions/335928/ld-cannot-find-an-existing-library">ld cannot find an existing library</a> but that does not help.</p>
  
  <p>locate command results in</p>
  
  <pre><code>$ locate libcrypto
  /home/abhi/Downloads/openssl-1.0.1b/libcrypto.a
  /home/abhi/Downloads/openssl-1.0.1b/libcrypto.pc
  /lib/libcrypto.so.0.9.8
  /lib/i486/libcrypto.so.0.9.8
  /lib/i586/libcrypto.so.0.9.8
  /lib/i686/cmov/libcrypto.so.0.9.8
  /usr/lib/libcrypto.so.0.9.8
  /usr/lib/vmware-tools/lib32/libcrypto.so.0.9.8
  /usr/lib/vmware-tools/lib32/libcrypto.so.0.9.8/libcrypto.so.0.9.8
  /usr/lib/vmware-tools/lib64/libcrypto.so.0.9.8
  /usr/lib/vmware-tools/lib64/libcrypto.so.0.9.8/libcrypto.so.0.9.8
  /usr/local/ssl/lib/libcrypto.a
  /usr/local/ssl/lib/pkgconfig/libcrypto.pc
  </code></pre>
  
  <p>Can someone please help on this or point out any mistake i am doing</p>
  
  <p>@ Daniel Roethlisberger tried using the -L flag but that resulted in these errors</p>
  
  <pre><code>gcc -ggdb aes_m.c -Werror -Wall -I /usr/local/ssl/include/ -L /usr/local/ssl/lib -lcrypto -o aes
  /usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
  dso_dlfcn.c:(.text+0x2d): undefined reference to `dlopen'
  dso_dlfcn.c:(.text+0x43): undefined reference to `dlsym'
  dso_dlfcn.c:(.text+0x4d): undefined reference to `dlclose'
  /usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_pathbyaddr':
  dso_dlfcn.c:(.text+0x8f): undefined reference to `dladdr'
  dso_dlfcn.c:(.text+0xe9): undefined reference to `dlerror'
  /usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_func':
  dso_dlfcn.c:(.text+0x4b1): undefined reference to `dlsym'
  dso_dlfcn.c:(.text+0x590): undefined reference to `dlerror'
  /usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_bind_var':
  dso_dlfcn.c:(.text+0x611): undefined reference to `dlsym'
  dso_dlfcn.c:(.text+0x6f0): undefined reference to `dlerror'
  /usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_unload':
  dso_dlfcn.c:(.text+0x755): undefined reference to `dlclose'
  /usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o): In function `dlfcn_load':
  dso_dlfcn.c:(.text+0x837): undefined reference to `dlopen'
  dso_dlfcn.c:(.text+0x8ae): undefined reference to `dlclose'
  dso_dlfcn.c:(.text+0x8f5): undefined reference to `dlerror'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>Many thanks</p>