ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to make a program that uses openssl. The Makefile uses the -static option and when I try to make it this way it gives the following error:
Code:
../lib/libopensc.a(card-gpk.o)(.text+0x1254): In function `gpk_compute_crycks':
: undefined reference to `DES_set_key_unchecked'
Along with several other undefined references.
When I remove the -static option, it gives the same error. However, when I remove the -static option and add -lcrypto, the program compiles and links properly.
With both -static and -lcrypto I get the following error:
Code:
/usr/bin/ld: cannot find -lcrypto
I have openssl and openssl-devel installed according to urpmi, but when I do a "rpm -q" it can only find openssl and not openssl-devel. Is there a static version of the library that I also need to install?
Look whether you've got libcrypto.a, that is the static version, installed.
I use a different distro and can find it in /usr/lib.
If you have "locate" installed, try with "locate libcrypto.a".
The -devel packages should contain only the header files, so if compilation is ok the problem is not with them, but with the package containing the libraries itself
No I have libcrypt.a in /usr/lib but not libcrypto.a. I only have the shared libraries libcrypto.so.
The weird thing is I don't remember ever using libcrypto in my application, which is why -lcrypto wasn't even in the Makefile, and I was able to build the app in another system with Mandrake 9.1. I only added -lcrypto after googling for a solution to my rebuilding problems and came across it. It allows me to build it, but not with the -static option.
I think that trying with the openssl-static src rpm is a good idea. Although rpms are distribution specific, as long as they are well done and the two distros are based on the same set of basic libraries, it's highly probable that you can compile it on other distros.
Try as you said, or grab the right .a from another installed system, or compile openssl from the tarball.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.