From: Sergey V. <vs...@al...> - 2006-07-27 14:44:33
|
On Tue, Jul 25, 2006 at 05:38:12PM +0400, Artem Pastukhov wrote: > My distro : AltLinux Sisyphus, > openobex version is: 1.0.1, You won't be able to compile obexftp-0.21 with this openobex version: obexftpd.c: In function 'obex_event': obexftpd.c:834: error: 'OBEX_EV_REQCHECK' undeclared (first use in this fun= ction) (you can try to disable building of obexftpd, but you will need to hack apps/Makefile.am for that) > ../obexftp/.libs/libobexftp.so: undefined reference to `cobex_ctrans' However, this particular error can be fixed easily (and IMHO the patch to fix it should be applied upstream). The problem is that obexftp libraries are linked without specifying the list of other libraries which they use; this sloppy practice used to work (because symbols referenced by libobexftp.so.0 were resolved using all libraries specified when linking the executable which uses the library), however, with a newer toolchain which supports and uses the -Wl,--as-needed option this fails. (With -Wl,--as-needed the linker drops libraries which seems to be unused by the executable, and then symbols used by libobexftp.so become unresolved.) Missing dependencies when building shared libraries is also dangerous when versioned symbols are used: if you don't specify used libraries at link time, the linker cannot determine symbol versions which are used by the created library, and if the other library is later upgraded, the library with missing dependencies may use a wrong version for the symbols it uses, which will likely lead to a crash. An easy way to check for missing shared library dependencies is to run "ldd -r libNAME.so" - if this command complains about undefined symbols, the shared library was not linked with the proper list of used libraries, and therefore will not be usable with -Wl,--as-needed. (Although there are libraries which contain undefined symbols by design, this is very rare, and in most cases having such undefined symbols is really a bug.) The following patch to obexftp-0.21 adds missing dependencies to the shared libraries: --- obexftp-0.21/multicobex/Makefile.am.alt-build-with-as-needed 2005-11-16= 01:18:15 +0300 +++ obexftp-0.21/multicobex/Makefile.am 2006-07-27 16:09:23 +0400 @@ -16,3 +16,6 @@ multicobexinclude_HEADERS =3D multi_cobex. =20 libmulticobex_la_LDFLAGS =3D -version-info $(MULTICOBEX_VERSION) =20 +libmulticobex_la_LIBADD =3D @OPENOBEX_LIBS@ \ + ../bfb/libbfb.la + --- obexftp-0.21/obexftp/Makefile.am.alt-build-with-as-needed 2006-05-25 23= :34:26 +0400 +++ obexftp-0.21/obexftp/Makefile.am 2006-07-27 16:12:40 +0400 @@ -26,3 +26,9 @@ obexftpinclude_HEADERS =3D obexftp.h \ =09 libobexftp_la_LDFLAGS =3D -version-info $(OBEXFTP_VERSION) =20 +libobexftp_la_LIBADD =3D @OPENOBEX_LIBS@ \ + @BLUETOOTH_LIBS@ \ + @USB_LIBS@ \ + ../multicobex/libmulticobex.la \ + ../bfb/libbfb.la + |