1

This is my compile command

gcc msg_utils.o -o mtm -lm -L/openssl-1.0.0a  -lssl -lcrypto

I get error :

/usr/bin/ld: cannot find -lssl

Please tell me what wrong with my command ,the path to openssl is correct ,I get openssl source from :

https://www.openssl.org/source/openssl-1.0.0a.tar.gz

jww
  • 97,681
  • 90
  • 411
  • 885
Ryo
  • 995
  • 2
  • 25
  • 41
  • Which operating system? – Basile Starynkevitch Dec 15 '15 at 06:29
  • Possible duplicate of [Linking OpenSSL libraries to a program](http://stackoverflow.com/questions/4352573/linking-openssl-libraries-to-a-program). Also ensure you configured with the `shared` option; see [Compilation and Installation | Configure Options](https://wiki.openssl.org/index.php/Compilation_and_Installation) on the OpenSSL wiki. – jww Dec 16 '15 at 07:37

1 Answers1

0

(I guess you are on Linux)

You should probably install some OpenSSL package in your Linux distribution.

Perhaps aptitude install libssl-dev on Debian related distributions.

If you compile OpenSSL from source code, you probably need some make install step and you might need to run ldconfig after that.

You might want to use pkg-config during compilation of your code:

gcc -Wall -g $(pkg-config -cflags openssl) \
   msg_utils.o -o mtm \
   $(pkg-config -libs openssl)

See also this and that

Community
  • 1
  • 1
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547