Cannot find libcrypto in Ubuntu

140,282

Solution 1

I solved this on 12.10 by installing libssl-dev.

sudo apt-get install libssl-dev

Solution 2

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 )

Share:
140,282

Related videos on Youtube

Limavolt
Author by

Limavolt

Learner

Updated on November 14, 2020

Comments

  • Limavolt
    Limavolt over 3 years

    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?

    • Limavolt
      Limavolt over 11 years
      how we know it is 64 bits or 32 bit? I am beginner in linux.
    • Jonathan Leffler
      Jonathan Leffler over 11 years
      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.0.9.8. The linking process looks for a name ending .so; the run-time looks for the name with the versioned suffix. The devel package will ensure the right links are created for development with the crypto library; what you have at the moment is only for the runtime.
    • perreal
      perreal over 11 years
      you can do uname -a to check if it is 64bit. Also do sudo apt-get install libssl-dev to install development package.
    • Limavolt
      Limavolt over 11 years
      unfortunatly I have not a root access. I try to #LIBS = -lpthread -lcrypto -lssl \ and change to LIBS = -lpthread\ but there are much more errors occur
    • Limavolt
      Limavolt over 11 years
      When I do uname -a the result is : Linux pc4268 2.6.20-16-generic #2 SMP Sun Sep 23 19:50:39 UTC 2007 i686 GNU/Linux
    • Admin
      Admin over 11 years
      Try adding -L/usr/lib/i686/cmov to LFLAGS. While the compiler (linker) should automatically pick up /usr/lib/libcrypto, the latter's probably a symbolic link to one of the others. See if pointing to such an explicit directory works.
    • Limavolt
      Limavolt over 11 years
      Thank you Evert I add and here the result. /usr/bin/ld: .: No such file: File format not recognized
  • ThunderPhoenix
    ThunderPhoenix over 9 years
    Can you specify how to put libcrypto.so in ld path ?
  • Scrooge McDuck
    Scrooge McDuck almost 2 years
    this is so unintuitive