Open saad-s opened 4 years ago
adding this list of libs generates a statically linked binary / executable
-lgattlib \
-lglib-2.0 -lpcre \
-ldbus-1 -lpthread \
-lgio-2.0 -lz -lresolv -lselinux -lmount -lgmodule-2.0 -ldl -lgobject-2.0 -lffi -lglib-2.0 -lpcre \
-lgmodule-2.0 -ldl -lglib-2.0 -lpcre \
-lgobject-2.0 -lffi -lglib-2.0 -lpcre \
-ldbus-glib-1 -ldbus-1 -lgobject-2.0 -lffi -lglib-2.0 -lpcre -lmount -lblkid -luuid
a better way could be to link statically against specific dev libs and dynamically link against common libs using
-Wl,-Bstatic and -Wl,-Bdynamic
but that's a task for some other day.
close the issue please
When building with
cmake -DGATTLIB_SHARED_LIB=NO ..
gives this errormodifying dbus/CMakeLists.txt;127 to this solves the error and generates libgattlib.a
I added following in ble_scan example's CMakeLists.txt for static building
and it gives undefined reference to... errors, I've added all dev libs like gio-2.0, gobject etc and it reduced errors but now its asking for libsystem and libmount etc..
My question is, is there a proper way to build static executable so I can move it to my docker image without installing dev libs in my image ?