On 11/03/2011 14:34, Vincent Danjean wrote:
> I will send one message per patch I applied with some comment and a last
> one with global comments and questions.
The sixth patch is about linkage. The upstream build-system links
to many libraries when creating new libraries and/or programs.
This patch modifies configure.ac so that each detected external
libraries are puts in separate variables and it modifies Makefile.am
to remove systematic linkage with all libraries (and add specific
libraries when required).
Note that I do not test this patch with another system that Debian.
So, it is perfectly possible that other OS (Mac, ...) will be broken
with this patch.
Note also that this patch is not perfect, even on Debian. Some
libraries are still too heavily linked. But this come from buggy
external tools (python-config, ...) that report too muc libraries.
Here is the situation detected by Debian tools with this patch
applied:
dh_shlibdeps -a -- --warnings=7
dpkg-shlibdeps -Tdebian/libow-2.8-7.substvars --warnings=7
debian/libow-2.8-7/usr/lib/libow-2.8.so.7.0.0
dpkg-shlibdeps -Tdebian/libowcapi-2.8-7.substvars --warnings=7
debian/libowcapi-2.8-7/usr/lib/libowcapi-2.8.so.7.0.0
dpkg-shlibdeps -Tdebian/libownet-2.8-7.substvars --warnings=7
debian/libownet-2.8-7/usr/lib/libownet-2.8.so.7.0.0
dpkg-shlibdeps -Tdebian/owserver.substvars --warnings=7
debian/owserver/usr/bin/owserver
dpkg-shlibdeps -Tdebian/ow-shell.substvars --warnings=7
debian/ow-shell/usr/bin/owpresent debian/ow-shell/usr/bin/owget
debian/ow-shell/usr/bin/owdir debian/ow-shell/usr/bin/owread
debian/ow-shell/usr/bin/owwrite
dpkg-shlibdeps -Tdebian/owfs-fuse.substvars --warnings=7
debian/owfs-fuse/usr/bin/owfs
dpkg-shlibdeps -Tdebian/owhttpd.substvars --warnings=7
debian/owhttpd/usr/bin/owhttpd
dpkg-shlibdeps -Tdebian/owftpd.substvars --warnings=7
debian/owftpd/usr/bin/owftpd
dpkg-shlibdeps -Tdebian/libow-php5.substvars --warnings=7
debian/libow-php5/usr/lib/php5/20090626/libowphp.so.0.0.0
dpkg-shlibdeps: warning:
debian/libow-php5/usr/lib/php5/20090626/libowphp.so.0.0.0 contains an
unresolvable reference to symbol _estrndup: it's probably a plugin.
dpkg-shlibdeps: warning: 13 other similar warnings have been skipped (use -v to
see them all).
dpkg-shlibdeps: warning:
debian/libow-php5/usr/lib/php5/20090626/libowphp.so.0.0.0 shouldn't be linked
with libpthread.so.0 (it uses none of its symbols).
dpkg-shlibdeps: warning: dependency on libpthread.so.0 could be avoided if
"debian/libow-php5/usr/lib/php5/20090626/libowphp.so.0.0.0" were not uselessly
linked against it (they use none of its symbols).
dpkg-shlibdeps -Tdebian/libow-perl.substvars --warnings=7
debian/libow-perl/usr/lib/perl5/auto/OW/OW.so
dpkg-shlibdeps -Tdebian/python-ow.substvars --warnings=7
debian/python-ow/usr/lib/python2.6/dist-packages/ow/_OW.so
dpkg-shlibdeps: warning:
debian/python-ow/usr/lib/python2.6/dist-packages/ow/_OW.so shouldn't be linked
with libpthread.so.0 (it uses none of its symbols).
dpkg-shlibdeps: warning:
debian/python-ow/usr/lib/python2.6/dist-packages/ow/_OW.so shouldn't be linked
with libdl.so.2 (it uses none of its symbols).
dpkg-shlibdeps: warning:
debian/python-ow/usr/lib/python2.6/dist-packages/ow/_OW.so shouldn't be linked
with libutil.so.1 (it uses none of its symbols).
dpkg-shlibdeps: warning:
debian/python-ow/usr/lib/python2.6/dist-packages/ow/_OW.so shouldn't be linked
with libm.so.6 (it uses none of its symbols).
dpkg-shlibdeps: warning: dependency on libdl.so.2 could be avoided if
"debian/python-ow/usr/lib/python2.6/dist-packages/ow/_OW.so" were not uselessly
linked against it (they use none of its symbols).
dpkg-shlibdeps: warning: dependency on libm.so.6 could be avoided if
"debian/python-ow/usr/lib/python2.6/dist-packages/ow/_OW.so" were not uselessly
linked against it (they use none of its symbols).
dpkg-shlibdeps: warning: dependency on libutil.so.1 could be avoided if
"debian/python-ow/usr/lib/python2.6/dist-packages/ow/_OW.so" were not uselessly
linked against it (they use none of its symbols).
dpkg-shlibdeps: warning: dependency on libpthread.so.0 could be avoided if
"debian/python-ow/usr/lib/python2.6/dist-packages/ow/_OW.so" were not uselessly
linked against it (they use none of its symbols).
dpkg-shlibdeps -Tdebian/libow-tcl.substvars --warnings=7
debian/libow-tcl/usr/lib/tcltk/owtcl-1.0/ow-1.0.so
dpkg-shlibdeps: warning: debian/libow-tcl/usr/lib/tcltk/owtcl-1.0/ow-1.0.so
shouldn't be linked with libdl.so.2 (it uses none of its symbols).
dpkg-shlibdeps: warning: debian/libow-tcl/usr/lib/tcltk/owtcl-1.0/ow-1.0.so
shouldn't be linked with libpthread.so.0 (it uses none of its symbols).
dpkg-shlibdeps: warning: debian/libow-tcl/usr/lib/tcltk/owtcl-1.0/ow-1.0.so
shouldn't be linked with libm.so.6 (it uses none of its symbols).
dpkg-shlibdeps: warning: dependency on libdl.so.2 could be avoided if
"debian/libow-tcl/usr/lib/tcltk/owtcl-1.0/ow-1.0.so" were not uselessly linked
against it (they use none of its symbols).
dpkg-shlibdeps: warning: dependency on libm.so.6 could be avoided if
"debian/libow-tcl/usr/lib/tcltk/owtcl-1.0/ow-1.0.so" were not uselessly linked
against it (they use none of its symbols).
dpkg-shlibdeps: warning: dependency on libpthread.so.0 could be avoided if
"debian/libow-tcl/usr/lib/tcltk/owtcl-1.0/ow-1.0.so" were not uselessly linked
against it (they use none of its symbols).
Regards,
Vincent
Do not use -rpath for /usr/lib
--- a/module/swig/perl5/OW/Makefile.linux.in
+++ b/module/swig/perl5/OW/Makefile.linux.in
@@ -12,8 +12,8 @@
'INC' => q[-I../../../../src/include -I../../../owlib/src/include @CPPFLAGS@],
# Default value for LDDLFLAGS is $Config{lddlflags}="-shared -L/usr/local/lib"
# but we want rpath to be @libdir@ or @exec_prefix@/lib
- 'LDDLFLAGS' => q[-shared -L../../../owlib/src/c/.libs -Wl,-rpath=@prefix@/lib],
- 'LIBS' => q[-L../../../owlib/src/c/.libs -low @PTHREAD_LIBS@ @LIBS@],
+ 'LDDLFLAGS' => q[-shared -L../../../owlib/src/c/.libs],
+ 'LIBS' => q[-L../../../owlib/src/c/.libs -low],
'OBJECT' => 'ow_wrap.o',
'NAME' => 'OW',
'POLLUTE' => 1,
--- a/module/swig/perl5/Makefile.am
+++ b/module/swig/perl5/Makefile.am
@@ -18,6 +18,8 @@
else
if HAVE_DEBIAN
( cd OW; $(PERL) Makefile.PL INSTALLDIRS=vendor )
+ cd OW ; for i in `grep -wl ^LD_RUN_PATH Makefile Makefile.[^P]*` ; do sed -i 's@^LD_RUN_PATH.*@LD_RUN_PATH=@' $$i ; done
+
else
( cd OW; $(PERL) Makefile.PL )
endif
--- a/module/owcapi/src/c/Makefile.am
+++ b/module/owcapi/src/c/Makefile.am
@@ -9,7 +9,7 @@
if HAVE_CYGWIN
libowcapi_la_LDFLAGS = -low ${LD_EXTRALIBS} -shared -no-undefined
else
-libowcapi_la_LDFLAGS = -low -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} ${LIBUSB_LIBS} ${LD_EXTRALIBS} -shared -shrext .so
+libowcapi_la_LDFLAGS = -low -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} ${LD_EXTRALIBS} -shared -shrext .so
endif
AM_CFLAGS = -I../include \
--- a/module/owserver/src/c/Makefile.am
+++ b/module/owserver/src/c/Makefile.am
@@ -30,11 +30,9 @@
-Wcast-align \
-Wstrict-prototypes \
-Wredundant-decls \
- ${EXTRACFLAGS} \
- ${PTHREAD_CFLAGS} \
- ${LIBUSB_CFLAGS}
+ ${EXTRACFLAGS}
-LDADD = -low ${LIBUSB_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS}
+LDADD = -low ${LD_EXTRALIBS} ${OSLIBS}
clean-generic:
--- a/module/owftpd/src/c/Makefile.am
+++ b/module/owftpd/src/c/Makefile.am
@@ -25,11 +25,9 @@
-Wcast-align \
-Wstrict-prototypes \
-Wredundant-decls \
- ${EXTRACFLAGS} \
- ${LIBUSB_CFLAGS} \
- ${PTHREAD_CFLAGS}
+ ${EXTRACFLAGS}
-LDADD = -low ${LIBUSB_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS}
+LDADD = -low ${LD_EXTRALIBS} ${OSLIBS}
clean-generic:
--- a/module/owhttpd/src/c/Makefile.am
+++ b/module/owhttpd/src/c/Makefile.am
@@ -25,11 +25,9 @@
-Wcast-align \
-Wstrict-prototypes \
-Wredundant-decls \
- ${EXTRACFLAGS} \
- ${PTHREAD_CFLAGS} \
- ${LIBUSB_CFLAGS}
+ ${EXTRACFLAGS}
-LDADD = -low ${LIBUSB_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS}
+LDADD = -low ${LD_EXTRALIBS} ${OSLIBS}
clean-generic:
--- a/module/owshell/src/c/Makefile.am
+++ b/module/owshell/src/c/Makefile.am
@@ -42,7 +42,7 @@
-Wredundant-decls \
${EXTRACFLAGS}
-LDADD = ${LD_EXTRALIBS} ${OSLIBS}
+LDADD = ${DL_LIBS} ${LD_EXTRALIBS} ${OSLIBS}
clean-generic:
--- a/module/owlib/src/c/Makefile.am
+++ b/module/owlib/src/c/Makefile.am
@@ -197,7 +197,7 @@
if HAVE_CYGWIN
libow_la_LDFLAGS = ${PTHREAD_LIBS} -shared -no-undefined ${LIBUSB_LIBS} ${LD_EXTRALIBS}
else
-libow_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} -shared -shrext .so ${LIBUSB_LIBS} ${LD_EXTRALIBS}
+libow_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} -shared -shrext .so ${LIBUSB_LIBS} ${LD_EXTRALIBS} ${M_LIBS} ${DL_LIBS}
endif
# Maybe need this for MacOS X
--- a/module/owfs/src/c/Makefile.am
+++ b/module/owfs/src/c/Makefile.am
@@ -20,10 +20,9 @@
-Wstrict-prototypes \
-Wredundant-decls \
${EXTRACFLAGS} \
- ${LIBUSB_CFLAGS} \
${PTHREAD_CFLAGS}
-LDADD = -low ${FUSE_LIBS} ${LIBUSB_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS}
+LDADD = -low ${FUSE_LIBS} ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS}
clean-generic:
--- a/module/ownet/c/src/c/Makefile.am
+++ b/module/ownet/c/src/c/Makefile.am
@@ -32,7 +32,7 @@
if HAVE_CYGWIN
libownet_la_LDFLAGS = ${PTHREAD_LIBS} ${LD_EXTRALIBS} -shared -no-undefined
else
-libownet_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} ${LD_EXTRALIBS} -shared -shrext .so
+libownet_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) ${PTHREAD_LIBS} ${LD_EXTRALIBS} -shared -shrext .so ${DL_LIBS}
endif
# Maybe need this for MacOS X
--- a/module/swig/python/Makefile.am
+++ b/module/swig/python/Makefile.am
@@ -11,7 +11,7 @@
$(SWIG) -python -o $@ ../ow.i
OW.py: ow_wrap.c setup.py
- LDFLAGS="$(PYLDFLAGS) ${PTHREAD_LIBS} ${LIBUSB_LIBS} ${LD_EXTRALIBS}" CFLAGS="$(PYCFLAGS) $(PIC_FLAGS)" $(PYTHON) setup.py build
+ LDFLAGS="$(PYLDFLAGS)" CFLAGS="$(PYCFLAGS) $(PIC_FLAGS)" $(PYTHON) setup.py build
# $(PYTHON) setup.py build
install-data-local:
--- a/configure.ac
+++ b/configure.ac
@@ -1634,11 +1634,23 @@
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([accept daemon getaddrinfo freeaddrinfo gethostbyname2_r gethostbyaddr_r gethostbyname_r getservbyname_r getopt getopt_long gettimeofday inet_ntop inet_pton memchr memset select socket strcasecmp strchr strdup strncasecmp strtol strtoul twalk tsearch tfind tdelete tdestroy vasprintf strsep vsprintf vsnprintf writev getline])
+save_LIBS="$LIBS"
+DL_LIBS=""
if test "${ENABLE_ZERO}" = "true" ; then
- AC_SEARCH_LIBS(dlopen, dl, AC_DEFINE(HAVE_DLOPEN, 1, [Define if you have dlopen]))
+ AC_SEARCH_LIBS(dlopen, dl,
+ DL_LIBS="-ldl"
+ AC_DEFINE(HAVE_DLOPEN, 1, [Define if you have dlopen]))
fi
+AC_SUBST([DL_LIBS])
+LIBS="$save_LIBS"
-AC_SEARCH_LIBS(lrint, m, AC_DEFINE(HAVE_LRINT, 1, [Define if you have lrint]))
+save_LIBS="$LIBS"
+M_LIBS=""
+AC_SEARCH_LIBS(lrint, m,
+ M_LIBS="-lm"
+ AC_DEFINE(HAVE_LRINT, 1, [Define if you have lrint]))
+AC_SUBST([M_LIBS])
+LIBS="$save_LIBS"
AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have nanosleep]))
# clock_gettime needed if real-time wait is needed for sem_timedwait. gettimeofday is enough.
--- a/module/swig/php/Makefile.am
+++ b/module/swig/php/Makefile.am
@@ -27,7 +27,7 @@
${PTHREAD_CFLAGS} \
@PHPINC@
-LDADD = -L../../owlib/src/c -low ${PTHREAD_LIBS} ${LD_EXTRALIBS} ${OSLIBS}
+LDADD = -L../../owlib/src/c -low
libowphp_la_SOURCES = ow_wrap.c php_OW.h
--- a/module/swig/python/setup.py.in
+++ b/module/swig/python/setup.py.in
@@ -97,18 +97,10 @@
if len('@LIBUSB_CFLAGS@') > 1:
my_extra_compile_args = my_extra_compile_args + string.split('@LIBUSB_CFLAGS@', ' ')
-if enable_usb == 'true':
- if len('@LIBUSB_LIBS@') > 1:
- my_extra_link_args = my_extra_link_args + string.split('@LIBUSB_LIBS@', ' ')
-
if enable_mt == 'true':
if len('@PTHREAD_CFLAGS@') > 1:
my_extra_compile_args = my_extra_compile_args + string.split('@PTHREAD_CFLAGS@', ' ')
-if enable_mt == 'true':
- if len('@PTHREAD_LIBS@') > 1:
- my_extra_link_args = my_extra_link_args + string.split('@PTHREAD_LIBS@', ' ')
-
if have_darwin == 'true':
my_extra_link_args = my_extra_link_args + string.split('../../owlib/src/c/.libs/libow.so', ' ')
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers