Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find libcrypto in Ubuntu

Tags:

c

gcc

ubuntu

I want to try one program which have makefile on it but when I put make in the shell the error was:

 g++ -g -DaUNIX -I../../acroname/aInclude -I../../acroname/aSource -Wl,-rpath,.     unix_aLaserDemo_Data/aLaserDemo.o unix_aLaserDemo_Data/acpLaser.o -lpthread -lcrypto -lssl  -o ../../acroname/aBinary/aLaserDemo
/usr/bin/ld: cannot find -lcrypto
collect2: ld returned 1 exit status

Here is the makefile:

 CC = g++
 CFLAGS = -DaUNIX -I../../acroname/aInclude -I../../acroname/aSource
 LFLAGS = -Wl,-rpath,.
 SRC = ../../acroname/aSource
 BIN = ../../acroname/aBinary
 LIBS = -lpthread -lcrypto -lssl \
 #LIBS = -lpthread\
       -L../../acroname/aBinary -l aUtil -l aIO
 OBJ = unix_aLaserDemo_Data

.PHONY : app
 app : $(OBJ) $(BIN)/aLaserDemo

$(OBJ) :
        mkdir $(OBJ)

$(BIN)/aLaserDemo : $(OBJ)/aLaserDemo.o $(OBJ)/acpLaser.o
        $(CC) -g $(CFLAGS) $(LFLAGS) $^ $(LIBS) -o $@

$(OBJ)/aLaserDemo.o : aLaserDemo.cpp
        $(CC) -c $(CFLAGS) $< -o $@

$(OBJ)/acpLaser.o : $(SRC)/acpLaser.cpp $(SRC)/acpLaser.h
        $(CC) -c $(CFLAGS) $< -o $@

 .PHONY : clean
 clean :
    rm -rf $(OBJ)
    rm -f $(BIN)/aLaserDemo

I try to locate the crypto library:

 /usr/lib/i486/libcrypto.so.0.9.8
 /usr/lib/i586/libcrypto.so.0.9.8
 /usr/lib/i686/cmov/libcrypto.so.0.9.8
 /usr/lib/libcrypto.so.0.9.8

What should I do to fix it?

like image 212
Limavolt Avatar asked Dec 11 '12 00:12

Limavolt


People also ask

Where is Libcrypto installed?

You need to install the development code (package) for the crypto library. Specifically, you need /usr/lib/libcrypto.so (no numerical suffix) pointing at (symlinked to) /usr/lib/libcrypto. so.

What is Libcrypto so?

This interface provides a suite of functions for performing encryption/decryption (both symmetric and asymmetric), signing/verifying, as well as generating hashes and MAC codes, across the full range of OpenSSL supported algorithms and modes.


2 Answers

I solved this on 12.10 by installing libssl-dev.

sudo apt-get install libssl-dev
like image 130
Patrick T. Anderson Avatar answered Oct 10 '22 20:10

Patrick T. Anderson


ld is trying to find libcrypto.sowhich is not present as seen in your locate output. You can make a copy of the libcrypto.so.0.9.8 and name it as libcrypto.so. Put this is your ld path. ( If you do not have root access then you can put it in a local path and specify the path manually )

like image 3
shrinidhi joshi Avatar answered Oct 10 '22 20:10

shrinidhi joshi