Fist, sorry you guys my English is bad, so I hope you guys understand for me.
My problem look like Use both static and dynamically linked libraries in gcc
Im using Ubuntu 18 and visual code, i want link libudev library to my project as dynamic library so I add -ludev
of my makefile and here is my makefile:
CC = g++
CFLAGS = -Wall -g
LINKER = g++
LDFLAGS = -Wall -static -L./libs/curl/lib -lcurl -lssl -lcrypto -lsqlite3 -lpthread -ldl -lz -static-libstdc++ -static-libgcc -ludev
but this don't work, then i follow this post Use both static and dynamically linked libraries in gcc and fix makefile like this:
CC = g++
CFLAGS = -Wall -g
LINKER = g++
LDFLAGS += -L./libs/curl/lib
LDFLAGS += -Wl,-Bstatic
LDFLAGS += -lcurl
LDFLAGS += -lssl
LDFLAGS += -lcrypto
LDFLAGS += -lsqlite3
LDFLAGS += -lpthread
LDFLAGS += -ldl
LDFLAGS += -lz
LDFLAGS += -static-libstdc++
LDFLAGS += -static-libgcc
LDFLAGS += -Wl,-Bdynamic
LDFLAGS += -ludev
but this still don't work
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup':
(.text+0x11): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libpthread.a(pthread_create.o): In function `allocate_stack':
/build/glibc-2ORdQG/glibc-2.27/nptl/allocatestack.c:526: undefined reference to `_dl_stack_flags'
/build/glibc-2ORdQG/glibc-2.27/nptl/allocatestack.c:652: undefined reference to `_dl_stack_flags'
So how do I do to use both static and dynamic link libraries in my project