[Serdev] [PATCH] avoid linking superfluous libraries
Andrei Pelinescu-Onciul
andrei at iptel.org
Thu Jun 5 18:49:12 CEST 2008
On May 21, 2008 at 09:52, Marcus Better <marcus at better.se> wrote:
> Hi,
>
> I'm posting some simple build patches that we applied in the Debian packages of ser 2.0 snapshots. However I don't know to what extent they apply to non-Debian systems, so use with caution.
Thanks a lot. I've applied some of them to 2.1. I won't touch 2.0 unless
someone expressly requests it.
However I think some of them won't work in 2.0 (ser won't be able to load
the corresponding modules). It looks like you removed all the linking to
libraries provided by ser (cds, presence or xcap), but:
- the dialog module needs cds (-l_ser_cds)
- pa needs cds, xcap and presence
- presence_b2b needs cds and presence (doesn't need xcap)
- rls needs cds, xcap and presence
(I've compared the undefined symbols from the modules with the symbols
defined in the libraries)
Andrei
>
> Our current patches can always be found at:
> http://svn.debian.org/wsvn/pkg-voip/ser/trunk/debian/patches/
>
> Cheers,
>
> Marcus
>
> ===================================================================
>
> The sercmd utility and some of the modules were being linked against
> some unneeded shared libraries.
>
> --- a/modules/dialog/Makefile
> +++ b/modules/dialog/Makefile
> @@ -12,7 +12,6 @@ NAME = dialog.so
> # and root ser directory must be in include directories
>
> DEFS += -Wall -I../../lib -DSER -I../..
> -LIBS += -L../../lib/cds -l_ser_cds
>
> #DEFS = -I../.. -I/usr/include/libxml2 -I$(LOCALBASE)/include/libxml2 -Wall -I../../lib -DSER $(DEFS)
> #LIBS = -L../../lib/cds -L$(LOCALBASE)/lib -L/usr/pkg/lib -lxml2 -lcurl -lcds $(LIBS)
> --- a/modules/mysql/Makefile
> +++ b/modules/mysql/Makefile
> @@ -17,6 +17,6 @@ LIBS=-L/usr/lib/mysql -L$(LOCALBASE)/lib
> -L$(LOCALBASE)/mysql/lib/mysql/ \
> -L$(LOCALBASE)/mysql/lib \
> -L/usr/lib64/mysql \
> - -lmysqlclient -lz
> + -lmysqlclient
>
> include ../../Makefile.modules
> --- a/modules/pa/Makefile
> +++ b/modules/pa/Makefile
> @@ -16,6 +16,6 @@ LIBS=
> # experimental (vku)
> DEFS += -I/usr/include/libxml2 -I$(LOCALBASE)/include/libxml2 -I$(LOCALBASE)/include -Wall -I../../lib -DSER -I../..
> # LIBS += -L$(LOCALBASE)/lib -L/usr/pkg/lib -L../../lib/xcap -L../../lib/presence -L../../lib/cds -lxcap -lpresence -lcds -lxml2 -lcurl
> -LIBS += -L$(LOCALBASE)/lib -L/usr/pkg/lib -L../../lib/xcap -L../../lib/presence -L../../lib/cds -l_ser_xcap -l_ser_presence -l_ser_cds
> +LIBS += -L$(LOCALBASE)/lib -L/usr/pkg/lib
>
> include ../../Makefile.modules
> --- a/modules/presence_b2b/Makefile
> +++ b/modules/presence_b2b/Makefile
> @@ -24,7 +24,7 @@ NAME = presence_b2b.so
> # and root ser directory must be in include directories
>
> DEFS += -I/usr/include/libxml2 -I$(LOCALBASE)/include/libxml2 -I$(LOCALBASE)/include -Wall -I../../lib -DSER -I../..
> -LIBS += -L$(LOCALBASE)/lib -L/usr/pkg/lib -lxml2 -L../../lib/presence -L../../lib/cds -L../../lib/xcap -l_ser_xcap -l_ser_presence -l_ser_cds
> +LIBS += -L$(LOCALBASE)/lib -L/usr/pkg/lib -lxml2
>
> #DEFS = -I../.. -I/usr/include/libxml2 -I$(LOCALBASE)/include/libxml2 -Wall -I../../lib -DSER $(DEFS)
> #LIBS = -L../../lib/cds -L$(LOCALBASE)/lib -L/usr/pkg/lib -lxml2 -lcurl -lcds $(LIBS)
> --- a/modules/rls/Makefile
> +++ b/modules/rls/Makefile
> @@ -24,7 +24,7 @@ NAME = rls.so
> # and root ser directory must be in include directories
>
> DEFS += -I/usr/include/libxml2 -I$(LOCALBASE)/include/libxml2 -I$(LOCALBASE)/include -Wall -I../../lib -DSER -I../..
> -LIBS += -L$(LOCALBASE)/lib -L/usr/pkg/lib -lxml2 -L../../lib/presence -L../../lib/cds -L../../lib/xcap -l_ser_xcap -l_ser_presence -l_ser_cds
> +LIBS += -L$(LOCALBASE)/lib -L/usr/pkg/lib -lxml2
>
> #DEFS = -I../.. -I/usr/include/libxml2 -I$(LOCALBASE)/include/libxml2 -Wall -I../../lib -DSER $(DEFS)
> #LIBS = -L../../lib/cds -L$(LOCALBASE)/lib -L/usr/pkg/lib -lxml2 -lcurl -lcds $(LIBS)
> --- a/modules/xcap/Makefile
> +++ b/modules/xcap/Makefile
> @@ -24,7 +24,7 @@ NAME = xcap.so
> # and root ser directory must be in include directories
>
> DEFS += -I/usr/include/libxml2 -I$(LOCALBASE)/include/libxml2 -I$(LOCALBASE)/include -Wall -I../../lib -DSER -I../..
> -LIBS += -L$(LOCALBASE)/lib -L/usr/pkg/lib -lxml2 -lcurl -L../../lib/presence -L../../lib/cds -L../../lib/xcap -l_ser_xcap -l_ser_presence -l_ser_cds
> +LIBS += -L$(LOCALBASE)/lib -L/usr/pkg/lib -lxml2 -lcurl
>
> #DEFS = -I../.. -I/usr/include/libxml2 -I$(LOCALBASE)/include/libxml2 -Wall -I../../lib -DSER $(DEFS)
> #LIBS = -L../../lib/cds -L$(LOCALBASE)/lib -L/usr/pkg/lib -lxml2 -lcurl -lcds $(LIBS)
> --- a/utils/sercmd/Makefile
> +++ b/utils/sercmd/Makefile
> @@ -12,7 +12,7 @@ use_readline ?=
>
> DEFS:= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' \
> $(filter -D%HAVE -DARCH% -DOS% -D__CPU% -D__OS%, $(DEFS))
> -LIBS:=$(filter-out -lfl -ldl -lpthread -lssl -lcrypto, $(LIBS))
> +LIBS:=$(filter-out -lfl -ldl -lresolv -lpthread -lssl -lcrypto, $(LIBS))
>
> ifeq ($(use_readline),)
> readline_path := $(shell \
> @@ -27,7 +27,7 @@ endif
>
> ifeq ($(use_readline),1)
> DEFS+=-DUSE_READLINE
> - LIBS+=-lreadline -lncurses
> + LIBS+=-lreadline
> endif
>
>
> --- a/Makefile.modules
> +++ b/Makefile.modules
> @@ -43,3 +43,5 @@ LDFLAGS:=$(MOD_LDFLAGS)
> endif
>
> include $(COREPATH)/Makefile.rules
> +
> +LIBS:=$(filter-out -ldl -lresolv, $(LIBS))
> --- a/modules/osp/Makefile
> +++ b/modules/osp/Makefile
> @@ -41,7 +41,7 @@ NAME=osp.so
> DEFS+=-D_POSIX_THREADS
>
> LIBS=$(shell if [ -f /usr/local/lib/libosptk.a ]; then echo "-losptk" ; else echo "-losp" ; fi)
> -LIBS+=-lssl -lcrypto -lpthread -lm
> +LIBS+=-lpthread
>
>
>
>
> _______________________________________________
> Serdev mailing list
> Serdev at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serdev
More information about the Serdev
mailing list