I'd to compiling my application with using the libwebsockets.a instead of the libwebsocket.so but i have some problems. i think there is a lack of link but i don't find what library lacking.
My code compile and works on the Raspberry Pi with Raspian Jessie, but i'd like my code works on others distribution. To do that I want integrate libwebsocket in my application. Switch the libwebsocket.so i use to the libwebsocket.a (switch to the static library)
I add the libwebsockets.h and .a in folders. Add link to that folders (for library -L../FW_Shared/lib/libwebsockets and for includes -I../FW_Shared/websockets/include)
Sorry my Raspbien is in french
EX : ../FW_Shared/lib/libwebsockets/libwebsockets.a(libwebsockets_la-libwebsockets.o) : In function « libwebsocket_context_destroy » :
(.text+0x1414) :undefined reference to « ERR_free_strings »
../FW_Shared/lib/libwebsockets/libwebsockets.a(libwebsockets_la-libwebsockets.o) : Dans la fonction « libwebsocket_context_destroy » :
(.text+0x1414) : référence indéfinie vers « ERR_free_strings »
../FW_Shared/lib/libwebsockets/libwebsockets.a(libwebsockets_la-libwebsockets.o) : Dans la fonction « libwebsocket_context_destroy » :
(.text+0x1418) : référence indéfinie vers « EVP_cleanup »
../FW_Shared/lib/libwebsockets/libwebsockets.a(libwebsockets_la-libwebsockets.o) : Dans la fonction « libwebsocket_context_destroy » :
(.text+0x141c) : référence indéfinie vers « CRYPTO_cleanup_all_ex_data »
../FW_Shared/lib/libwebsockets/libwebsockets.a(libwebsockets_la-libwebsockets.o) : Dans la fonction « libwebsocket_create_context » :
(.text+0x1f30) : référence indéfinie vers « SSL_library_init »
../FW_Shared/lib/libwebsockets/libwebsockets.a(libwebsockets_la-libwebsockets.o) : Dans la fonction « libwebsocket_create_context » :
(.text+0x1f34) : référence indéfinie vers « OPENSSL_add_all_algorithms_noconf »
../FW_Shared/lib/libwebsockets/libwebsockets.a(libwebsockets_la-libwebsockets.o) : Dans la fonction « libwebsocket_create_context » :
(.text+0x1f38) : référence indéfinie vers « SSL_load_error_strings »
../FW_Shared/lib/libwebsockets/libwebsockets.a(libwebsockets_la-libwebsockets.o) : Dans la fonction « libwebsocket_create_context » :
(.text+0x1f58) : référence indéfinie vers « SSL_get_ex_new_index »
../FW_Shared/lib/libwebsockets/libwebsockets.a(libwebsockets_la-libwebsockets.o) : Dans la fonction « libwebsocket_create_context » :
(.text+0x1f68) : référence indéfinie vers « SSLv23_server_method »
../FW_Shared/lib/libwebsockets/libwebsockets.a(libwebsockets_la-libwebsockets.o) : Dans la fonction « libwebsocket_create_context » :
(.text+0x2208) : référence indéfinie vers « SSLv23_client_method »
My Makefile :
READER = Reader
ROOT_DIR = .
PROJ_DIR = $(ROOT_DIR)/src
LIB_DIR = $(ROOT_DIR)/lib
INC_DIR = $(ROOT_DIR)/include
OUT_DIR = $(ROOT_DIR)/bin
NAME = TestServer
# CC = arm-linux-gnueabi-gcc
CC = arm-linux-gnueabihf-gcc
CFLAGS = -DNUR_EXPOSE_WIN32API -std=gnu99 -DNUR_MODULE -pedantic -W -Wall
SRC = $(PROJ_DIR)/testServer.c \
$(PROJ_DIR)/mtTestVersion.c \
$(PROJ_DIR)/mtTestQueue.c \
$(PROJ_DIR)/mtTestJsonFormat.c \
$(PROJ_DIR)/mtTestWebSocket.c
OBJ= $(SRC:.c=.o)
LIBS = -L../FW_Shared/tools/lib/ -L../FW_Shared/lib/liblog4c/ -L../FW_Shared/lib/libjansson -L../FW_Shared/lib/libwebsockets -L/usr/lib/arm-linux-gnueabihf/ -L../HW_Reader/bin/NordicID/ -L../HW_Reader/lib/NordicID/ -L../FW_TestCtrl/bin/ -L$(LIB_DIR) -lmtTestCtrl -lmtTools -lNurApiRasPi -lrt -lm -lpthread -ljansson -llog4c -lwebsockets -lcrypto -lssl -lz
INCLUDES = -I./include -I/usr/include/ -I../FW_Shared/log4c-1.2.4/src -I../FW_TestCtrl/include -I../HW_Reader/include/$(READER) -I../FW_Shared/jansson/include -I../FW_Shared/websockets/include -I../FW_Shared/tools/inc
TARGET = 0.0.0.0
TARGET_PATH = test/
all: $(NAME)
$(NAME): $(OBJ)
$(CC) -o $(OUT_DIR)/$(NAME) $(INCLUDES) $(CFLAGS) $(OBJ) $(LIBS)
clean:
rm -rf $(OBJ) *~ \#*\# src/*~ src/\#*\# include/*~ include/\#*\#
fclean: clean
rm -rf $(OUT_DIR)/$(NAME)
re : fclean all
%.o:%.c
$(CC) -c $< -o $@ $(CFLAGS) $(INCLUDES) $(LIBS)
.PHONY: clean fclean push
I find some links to add (like -lz -lssl), to reduce undefined references, but i can't find what link is lacking for this last error lines. Maybe it's another way to correct this problem ?
Thanks