LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-04-2008, 04:34 AM   #1
galapogos
Member
 
Registered: May 2008
Posts: 227

Rep: Reputation: 30
openssl problem when compiling/linking


Hi,

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?

I'm using Mandrake 9.1 btw.
 
Old 06-05-2008, 03:36 AM   #2
clvic
Member
 
Registered: Feb 2008
Location: Rome, Italy
Distribution: OpenSuSE 11.x, vectorlinux, slax, Sabayon
Posts: 206
Blog Entries: 2

Rep: Reputation: 45
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
 
Old 06-10-2008, 02:49 AM   #3
galapogos
Member
 
Registered: May 2008
Posts: 227

Original Poster
Rep: Reputation: 30
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.
 
Old 06-10-2008, 03:07 AM   #4
galapogos
Member
 
Registered: May 2008
Posts: 227

Original Poster
Rep: Reputation: 30
Just some more information. I did a locate on libcrypto, libssl and openssl. For both libcrypto and libssl, I found 4 entries each in /usr/lib
Code:
/usr/lib/libssl.so.0.9.7
/usr/lib/libssl.so.0
/usr/lib/libssl.so.0.9.6
/usr/lib/libssl3.so
/usr/lib/libssl.so
and
Code:
/usr/lib/libcrypto.so.0.9.7
/usr/lib/libcrypto.so.0
/usr/lib/libcrypto.so.0.9.6
/usr/lib/libcrypto.so
For openssl there was a whole bunch of stuff located.

This leads me to believe that I don't have the static versions of any of these installed, and that I should?

Should I download the src of openssl-static from rpmfind.net and install it? Are they distribution specific?
 
Old 06-10-2008, 11:29 AM   #5
clvic
Member
 
Registered: Feb 2008
Location: Rome, Italy
Distribution: OpenSuSE 11.x, vectorlinux, slax, Sabayon
Posts: 206
Blog Entries: 2

Rep: Reputation: 45
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.
 
Old 06-10-2008, 11:54 AM   #6
galapogos
Member
 
Registered: May 2008
Posts: 227

Original Poster
Rep: Reputation: 30
Thanks. I ended up installing the RPM off my Mandrake CD3. Doh, forgot that it was in there all this while.

Built like a dream after it was installed
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
KDE not linking with Openssl BobTheSlackUser Linux From Scratch 2 11-21-2007 10:06 PM
Problem in using both load time linking and runtime linking durgaprasad_j Linux - General 0 08-01-2006 03:49 AM
Solaris - linking with OpenSSL primo Solaris / OpenSolaris 5 02-24-2006 04:07 PM
(linking?) problem compiling very simple array class btb Programming 3 08-02-2005 03:16 PM
Problem compiling squid with openssl Terayon Linux - Software 4 05-12-2004 12:20 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration