I'm writing a test application with BoringSSL and when I execute it I get this error:
symbol lookup error: ./main: undefined symbol: SSL_CTX_set_min_proto_version
All needed libraries are getting linked in my makefile:
CC = g++
FLAGS = -Wall -g
INCLUDES = -I/home/denis/libraries/boringssl/include
LIBS = -L/home/denis/libraries/boringssl/build/crypto -L/home/denis/TLS-Bibliotheken/boringssl/build/ssl -lcrypto -lssl
OBJ = Main.o BoringSSLTest.o
# Link files
main: $(OBJ)
$(CC) $(FLAGS) -o main $(OBJ) $(LIBS)
# Compile files
Main.o: Main.cpp
$(CC) $(FLAGS) -c $(INCLUDES) Main.cpp
BoringSSLTest.o: BoringSSLTest.cpp BoringSSLTest.h
$(CC) $(FLAGS) -c $(INCLUDES) BoringSSLTest.cpp
clean:
$(RM) $(OBJ) main
When I look for the definition of the symbol with nm libssl.so | grep SSL_CTX_set_min_proto_version
I see that it is not undefined (T).
Why does it not work?
It is probably loading a wrong version of libssl.so
at run-time. Invoke ldd ./main
to see where it loads libssl.so
from.
When you use -L<dir>
linker option to link shared libraries from a non-standard location you need the corresponding -Wl,-rpath=<dir>
linker option to tell the run-time linker to load the library from there.