can't link openssl static libraries

This is a discussion on can't link openssl static libraries within the C++ Programming forums, part of the General Programming Boards category; Hi Everyone! It can't link openssl static libraries. That is my MakeFile: Code: #----------------------------------------------------------------------------- # Usage of make file #----------------------------------------------------------------------------- ...

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    3

    can't link openssl static libraries

    Hi Everyone!


    It can't link openssl static libraries.


    That is my MakeFile:
    Code:
    #-----------------------------------------------------------------------------
    #    Usage of make file
    #-----------------------------------------------------------------------------
    # Clean operation:
    #    make -f MakeLogic clean
    #
    # Make operation:
    #    make -f MakeLogic
    #
    #
    
    
    
    
    #OBJ = $(SRC:.cpp=.o)
    OBJ_DIR = ./obj
    
    
    LIB_DIR = -L../lib -L../../libs/x86_64/boost -L../../libs/x86_64/icu -L../../libs/x86_64/openssl \
    -L../../libs/x86_64/ticpp -L../../libs/x86_64/torrent-rasterbar
    
    
    LIBS = -lclient -lcommon -lsicuuc -lsicudata -lticpp -ltorrent-rasterbar -lssl -lcrypto -ldl -luuid -lboost_program_options-mt -lboost_serialization-mt \
    -lpthread -lboost_thread-mt -lboost_system-mt -lboost_filesystem-mt
    
    
    OUT_DIR= ../bin
    OUT_FILE_NAME = logic_client
    
    
    # include directories
    INCLUDES=-I. -I../common -I../client -I../../depends -I../../depends/zlib -I../../libs/includes -I../../depends/icu/include
    
    
    # C++ compiler flags (-g -O2 -Wall)
    CCFLAGS =
    
    
    # compiler
    CCC = g++
    
    
    
    
    # Enumerating of every *.cpp as *.o and using that as dependency
    $(OUT_FILE_NAME): $(patsubst %.cpp,$(OBJ_DIR)/%.o,$(wildcard *.cpp))
        $(CCC) -o $(OUT_DIR)/$@ $^ $(LIB_DIR) $(LIBS)
    
    
    #Compiling every *.cpp to *.o
    $(OBJ_DIR)/%.o: %.cpp dircreation
        $(CCC) -c $(INCLUDES) $(CCFLAGS) -o $@ $<
    
    
    dircreation:
        @mkdir -p $(OUT_DIR)
        @mkdir -p $(OBJ_DIR)
    
    
    .PHONY : clean
    clean:
        rm -f $(OBJ_DIR)/*.o $(OUT_DIR)/$(OUT_FILE_NAME) Makefile.bak

    But during linking i have the next error:
    Code:
    avega@linux-builder:~/projects/logicstor/logic_client$ make -f MakeLogic
    g++ -c -I. -I../common -I../client -I../../depends -I../../depends/zlib -I../../libs/includes -I../../depends/icu/include  -o obj/logic_client_app.o logic_client_app.cpp
    In file included from ../common/utils.h:4,
                     from ../client/common_client_includes.h:15,
                     from ../client/logic_client.h:4,
                     from logic_client_app.cpp:7:
    ../common/protocol.h:14: warning: scoped enums only available with -std=c++0x or -std=gnu++0x
    g++ -c -I. -I../common -I../client -I../../depends -I../../depends/zlib -I../../libs/includes -I../../depends/icu/include  -o obj/stdafx.o stdafx.cpp
    g++ -o ../bin/logic_client obj/logic_client_app.o obj/stdafx.o -L../lib -L../../libs/x86_64/boost -L../../libs/x86_64/icu -L../../libs/x86_64/openssl -L../../libs/x86_64/ticpp -L../../libs/x86_64/torrent-rasterbar -lclient -lcommon -lsicuuc -lsicudata -lticpp -ltorrent-rasterbar -lssl -lcrypto -ldl -luuid -lboost_program_options-mt -lboost_serialization-mt -lpthread -lboost_thread-mt -lboost_system-mt -lboost_filesystem-mt
    ../lib/libcommon.a(utils.o): In function `logic::GenerateTempFileName(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >)':
    utils.cpp:(.text+0x15dd): warning: the use of `tempnam' is dangerous, better use `mkstemp'
    ../lib/libclient.a(torrent_actor.o): In function `libtorrent::hasher::hasher(char const*, int)':
    torrent_actor.cpp:(.text._ZN10libtorrent6hasherC1EPKci[libtorrent::hasher::hasher(char const*, int)]+0x1b): undefined reference to `SHA1_Init(SHA_CTX*)'
    torrent_actor.cpp:(.text._ZN10libtorrent6hasherC1EPKci[libtorrent::hasher::hasher(char const*, int)]+0x31): undefined reference to `SHA1_Update(SHA_CTX*, unsigned char const*, unsigned int)'
    ../lib/libclient.a(torrent_actor.o): In function `libtorrent::hasher::final()':
    torrent_actor.cpp:(.text._ZN10libtorrent6hasher5finalEv[libtorrent::hasher::final()]+0x3c): undefined reference to `SHA1_Final(unsigned char*, SHA_CTX*)'
    collect2: ld returned 1 exit status
    make: *** [logic_client] Error 1

    Does anybody know the solution?


    Thanks

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    2,747
    c - What causes this link failure (undefined reference)? - Stack Overflow

    The above link implies "crypto" library missing is the cause.
    Can you confirm the path to this library is passed and that it is installed on your OS.

    Note the link below says use libmd as the library.
    http://www.unix.com/man-page/All/3/SHA1_Init/

    Tim S.
    Last edited by stahta01; 02-26-2012 at 03:42 PM.
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook

  3. #3
    Registered User
    Join Date
    Feb 2012
    Posts
    3
    Quote Originally Posted by stahta01 View Post
    c - What causes this link failure (undefined reference)? - Stack Overflow
    The above link implies "crypto" library missing is the cause.
    Can you confirm the path to this library is passed and that it is installed on your OS.
    Tim S.
    Ya this library is exists and path is accessible.

    Also i have tested the build ability of the simple application that uses openssl. All works corrctly.

    So libssl.a and libcrypto.a is correct.

    Also i have tried to change order of libraries but without success.

  4. #4
    Registered User
    Join Date
    Feb 2012
    Posts
    3
    I have found the solution, we have to use the same preprocessor definitions for every project where we use libtorrent-rasterbar !!!

    Thanks for all

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dynamic link libraries
    By Coga1900 in forum C++ Programming
    Replies: 19
    Last Post: 11-13-2011, 07:39 AM
  2. easy way to link to all libraries in a directory?
    By dayalsoap in forum C++ Programming
    Replies: 8
    Last Post: 06-20-2011, 11:27 AM
  3. How to link libraries to MinGW?
    By ahernan17 in forum C Programming
    Replies: 10
    Last Post: 10-23-2010, 01:35 PM
  4. Removing link libraries in static libs
    By 39ster in forum C Programming
    Replies: 1
    Last Post: 06-10-2008, 11:22 AM
  5. Static link libraries on other computers
    By bennyandthejets in forum C++ Programming
    Replies: 6
    Last Post: 11-05-2003, 06:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21