Strange error while linking of static OpenSsl libraries

Hi Everyone!
I have been working on this task since time of my last post. Has been resolved a lot of problems.

But when i was linking final executable file it threw the new problem. It can't link openssl static libraries.

That is my MakeFile:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#-----------------------------------------------------------------------------
#	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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
Last edited on
In which library are SHA1_Init, SHA1_Update and SHA1_Final defined?
I thought that in libcrypto.a
I saw such declarations in libcrypto.a when i have opened it with midnight file viewer.

I have built the openssl from sources without errors, also have built other versions of openssl with the same result(((
are you sure the libcrypto.a you have is a static library and not an import library for the dll?
In Linux for dynamic libraries we have an extension *.so, for static *.a

So i think i have a static library
I have found the solution, we have to use the same preprocessor definitions for every project where we use libtorrent-rasterbar !!!

Thanks for all
Topic archived. No new replies allowed.