[SATLUG] Creating a binary.....

Bruce Dubbs bruce.dubbs at gmail.com
Wed Mar 7 23:21:44 CST 2012


Enrique Sanchez wrote:
> ......
>> for example, on a RH 5.2, I got libcrypto.so.4, on a RH 5.6, I have
>> libcrypto.so.6 and I bet that there is at least 1 server with 
>> libcrypto.so.8 out there.
>> 
>> 
>> Folks,
>> 
>> In short, what I am trying to accomplish is to create an executable
>> using ld, anyone knows whether this is possible or not?
>> 
>> thank you in advance, enrique.
>> 
>> btw..this has hit the curiosity field now, I've solved my problem
>> using a statically linked binary.
> 
> 
> I wonder why there is no "default" libcrypto.so file present in the 
> OpenSSL distribution instead.

The latest openssl is OpenSSL-1.0.0g.  It produces the following libraries:

-rw-r--r-- 1 3629878 Mar  7 23:08 libcrypto.a
lrwxrwxrwx 1      18 Mar  7 23:08 libcrypto.so -> libcrypto.so.1.0.0
-r-xr-xr-x 1 2015531 Mar  7 23:08 libcrypto.so.1.0.0
-rw-r--r-- 1  648598 Mar  7 23:08 libssl.a
lrwxrwxrwx 1      15 Mar  7 23:08 libssl.so -> libssl.so.1.0.0
-r-xr-xr-x 1  416345 Mar  7 23:08 libssl.so.1.0.0

I have no idea what RH is doing with libcrypto.so.{6,8}

You need to do some reading about how the linker works.

-lcrypto  on the ld (or gcc) line looks for libcrypto.so and follows the 
link to the actual library to satisfy references.

Later whe the program is executed, it looks for  libcrypto.so.1.0.0, not 
libcrypto.so, using either /etc/ld.so.cache or the LD_LIBRARY_PATH 
environment variable.

If libcrypto.a is included on the ld command line or libcrypto.so is 
missing, then the library is included in the executable binary image and 
dynamic references are not needed.  However, an update to the library 
would require re-linking the program.

   -- Bruce


More information about the SATLUG mailing list