Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 176264 - app-mobilephone/obexftp-0.21 fails to build with -Wl,--as-needed
Summary: app-mobilephone/obexftp-0.21 fails to build with -Wl,--as-needed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Alin Năstac (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: as-needed
  Show dependency tree
 
Reported: 2007-04-27 17:03 UTC by Matěj Laitl
Modified: 2007-05-01 06:30 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
my patch that worked for me (obexftp-0.21-as-needed.patch,419 bytes, patch)
2007-04-28 20:20 UTC, Matěj Laitl
Details | Diff
obexftp-0.21-as-needed.patch (obexftp-0.21-as-needed.patch,396 bytes, patch)
2007-04-28 20:46 UTC, Matěj Laitl
Details | Diff
obexftp-0.21-as-needed.patch (obexftp-0.21-as-needed.patch,1.07 KB, patch)
2007-04-30 13:54 UTC, Matěj Laitl
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matěj Laitl 2007-04-27 17:03:50 UTC
app-mobilephone/obexftp-0.21 fails when compiling with --as-needed LDFLAG on. When not using --as-needed, compiles and works fine. obexftp-0.19-r1 has same problems. While I'am not a dev, I'll try to investigate it deeper according to Gentoo --as-needed introduction and fixing guide.

emerge -pvt obexftp
[ebuild   R   ] app-mobilephone/obexftp-0.21  USE="bluetooth nls perl python -debug -swig -tcl" 0 kB


make[2]: Entering directory `/var/tmp/portage/app-mobilephone/obexftp-0.21/work/obexftp-0.21/apps'
if i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../includes    -O2 -march=pentium3 -pipe -fomit-frame-pointer -fno-strict-aliasing -W -Wundef -Wmissing-declarations -Wmissing-prototypes -Wall -MT obexftp.o -MD -MP -MF ".deps/obexftp.Tpo" -c -o obexftp.o obexftp.c; \
        then mv -f ".deps/obexftp.Tpo" ".deps/obexftp.Po"; else rm -f ".deps/obexftp.Tpo"; exit 1; fi
obexftp.c:134: warning: pointer targets in initialization differ in signedness
obexftp.c:135: warning: pointer targets in initialization differ in signedness
obexftp.c:136: warning: pointer targets in initialization differ in signedness
obexftp.c:184: warning: pointer targets in initialization differ in signedness
obexftp.c: In function ‘cli_connect_uuid’:
obexftp.c:214: warning: pointer targets in passing argument 4 of ‘obexftp_connect_uuid’ differ in signedness
obexftp.c: In function ‘probe_device’:
obexftp.c:327: warning: pointer targets in passing argument 1 of ‘probe_device_uuid’ differ in signedness
obexftp.c:330: warning: pointer targets in passing argument 1 of ‘probe_device_uuid’ differ in signedness
if i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../includes    -O2 -march=pentium3 -pipe -fomit-frame-pointer -fno-strict-aliasing -W -Wundef -Wmissing-declarations -Wmissing-prototypes -Wall -MT bt_discovery.o -MD -MP -MF ".deps/bt_discovery.Tpo" -c -o bt_discovery.o bt_discovery.c; \
        then mv -f ".deps/bt_discovery.Tpo" ".deps/bt_discovery.Po"; else rm -f ".deps/bt_discovery.Tpo"; exit 1; fi
/bin/sh ../libtool --tag=CC --mode=link i686-pc-linux-gnu-gcc  -O2 -march=pentium3 -pipe -fomit-frame-pointer -fno-strict-aliasing -W -Wundef -Wmissing-declarations -Wmissing-prototypes -Wall  -Wl,-O1 -Wl,--as-needed -o obexftp  obexftp.o bt_discovery.o ../obexftp/libobexftp.la ../multicobex/libmulticobex.la ../bfb/libbfb.la -lopenobex -lbluetooth -lusb
mkdir .libs
i686-pc-linux-gnu-gcc -O2 -march=pentium3 -pipe -fomit-frame-pointer -fno-strict-aliasing -W -Wundef -Wmissing-declarations -Wmissing-prototypes -Wall -Wl,-O1 -Wl,--as-needed -o .libs/obexftp obexftp.o bt_discovery.o  ../obexftp/.libs/libobexftp.so ../multicobex/.libs/libmulticobex.so ../bfb/.libs/libbfb.so /usr/lib/libopenobex.so /usr/lib/libbluetooth.so /usr/lib/libusb.so
../obexftp/.libs/libobexftp.so: undefined reference to `cobex_ctrans'
collect2: ld returned 1 exit status
make[2]: *** [obexftp] Error 1
make[2]: Leaving directory `/var/tmp/portage/app-mobilephone/obexftp-0.21/work/obexftp-0.21/apps'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/app-mobilephone/obexftp-0.21/work/obexftp-0.21'
make: *** [all] Error 2

!!! ERROR: app-mobilephone/obexftp-0.21 failed.
Call stack:
  ebuild.sh, line 1614:   Called dyn_compile
  ebuild.sh, line 971:   Called qa_call 'src_compile'
  environment, line 3978:   Called src_compile
  obexftp-0.21.ebuild, line 56:   Called die

Reproducible: Always

Steps to Reproduce:
1. LDFLAGS="-Wl,--as-needed" emerge obexftp
Actual Results:  
build fails

Expected Results:  
compile okay. WORKAROUND: LDFLAGS="" emerge obexftp

nb-matej ~ # emerge --info
Portage 2.1.2.2 (default-linux/x86/2006.1/desktop, gcc-4.1.1, glibc-2.5-r0, 2.6.20-suspend2-r4 i686)
=================================================================
System uname: 2.6.20-suspend2-r4 i686 Pentium III (Coppermine)
Gentoo Base System release 1.12.9
Timestamp of tree: Fri, 27 Apr 2007 15:00:10 +0000
dev-java/java-config: 1.3.7, 2.0.31-r5
dev-lang/python:     2.4.3-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.15-r1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=pentium3 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/php/apache1-php5/ext-active/ /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -march=pentium3 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict userpriv"
GENTOO_MIRRORS="http://mirror.switch.ch/ftp/mirror/gentoo/ http://gentoo.inode.at/ http://gentoo.intergenia.de"
LANG="${LC_ALL}"
LC_ALL="cs_CZ.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="cs en_GB fr"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/overlays/shl"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac aalib acl acpi alsa asf automount bash-completion berkdb bitmap-fonts bluetooth branding bzip2 cdparanoia cdr charconv cli cpudetection cracklib crypt cups dbus dri dts dvd dvdr dvdread eds emboss fam fat firefox fortran ftp gd gdbm gif gimp glibc-omitfp gpm gtk hal iconv icq ipod irc irda isdnlog java javascript jpeg kde kdeenablefinal kdehiddenvisibility libg++ logrotate mad midi mikmod mmap mmx mozilla mp3 mpeg msn musicbrainz ncurses network nls no-old-linux noamazon nptl nptlonly nsplugin ntfs ogg opengl optimisememory pam pcmcia pcre perl png pppd python qt qt3 quicktime rdesktop readline reflection reiserfs rtc samba scenarios session slang spell spl sse ssl svg symlink syslog theora threads tiff toolbar truetype truetype-fonts type1-fonts unicode usb userlocales utempter vchroot visualization vorbis vroot win32codecs x264 x86 xcb xcomposite xine xml xorg xosd xv xvid zlib" ALSA_CARDS="cs46xx intel8x0" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="cs en_GB fr" USERLAND="GNU" VIDEO_CARDS="savage vesa"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Alin Năstac (RETIRED) gentoo-dev 2007-04-28 13:33:05 UTC
I always verify my ebuilds with --as-needed. 
I can't reproduce it, even if I set your USE flags.
Comment 2 Matěj Laitl 2007-04-28 20:20:18 UTC
Created attachment 117579 [details, diff]
my patch that worked for me

I've found out that libobexftp.so should be linked against another 2 libs from this package and possibly against openobex. (in order to build with --as-needed)

Patch rationale:
The LDADD in patched Makefile.am is ingnored in generated Makefile.in and Makefile. I just took the 3 libs and added them into libobexftp_la_LIBADD, as automake info page suggests.

One weird thing is that you cannont reproduce. I'll try to attract more people to test it. (it could be my misconfiguration, but i can't think of any possible cause)
Comment 3 Matěj Laitl 2007-04-28 20:46:35 UTC
Created attachment 117583 [details, diff]
obexftp-0.21-as-needed.patch

@OPENOBEX_LIBS@ is not needed, checked. Other 2 are, or linking of obexftp binary fails with unresolved symbols.
Fix patch name.
Comment 4 Alin Năstac (RETIRED) gentoo-dev 2007-04-29 07:18:59 UTC
(In reply to comment #2)
> One weird thing is that you cannont reproduce. I'll try to attract more people
> to test it. (it could be my misconfiguration, but i can't think of any possible
> cause)

What I find as even stranger is your error. According to the failing linking command, parameter ../obexftp/.libs/libobexftp.so (the lib that requires cobex_ctrans symbol) is before ../multicobex/.libs/libmulticobex.so (the lib that defines cobex_ctrans). Since libmulticobex.so shouldn't be discarded by --as-needed because one obj/lib file passed before it require one of its symbols.

Please check that cobex_ctrans is really defined in libmulticobex.so by running the following command:
mrness@alin /var/tmp/portage/app-mobilephone/obexftp-0.21/work/obexftp-0.21/multicobex/.libs $ objdump --dynamic-syms libmulticobex.so | grep cobex_ctrans
0000000000000d90 g    DF .text  0000000000000085  Base        cobex_ctrans
Comment 5 Matěj Laitl 2007-04-29 09:07:44 UTC
(In reply to comment #4)
> What I find as even stranger is your error. According to the failing linking
> command, parameter ../obexftp/.libs/libobexftp.so (the lib that requires
> cobex_ctrans symbol) is before ../multicobex/.libs/libmulticobex.so (the lib
> that defines cobex_ctrans). Since libmulticobex.so shouldn't be discarded by
> --as-needed because one obj/lib file passed before it require one of its
> symbols.
I absolutely agree. I tried to reproduce it witout -Wl,-O1, but it failed with the same error.

> Please check that cobex_ctrans is really defined in libmulticobex.so by running
> the following command:
> mrness@alin
> /var/tmp/portage/app-mobilephone/obexftp-0.21/work/obexftp-0.21/multicobex/.libs
> $ objdump --dynamic-syms libmulticobex.so | grep cobex_ctrans
> 0000000000000d90 g    DF .text  0000000000000085  Base        cobex_ctrans
> 
nb-matej /var/tmp/portage/app-mobilephone/obexftp-0.21/work/obexftp-0.21 # objdump --dynamic-syms multicobex/.libs/libmulticobex.so | grep cobex_ctrans
000009d0 g    DF .text  0000009d  Base        cobex_ctrans
nb-matej /var/tmp/portage/app-mobilephone/obexftp-0.21/work/obexftp-0.21 # objdump --dynamic-syms obexftp/.libs/libobexftp.so | grep cobex_ctrans
00000000      D  *UND*  00000000              cobex_ctrans

Which looks correct to me.


Looks to me that you are on amd64. Maybe x86-specific bug?
Comment 6 Daniel Golka 2007-04-29 09:24:49 UTC
I was able to reproduce that with following setup: LDFLAGS="-Wl,--as-needed" emerge -avt obexftp 

[ebuild   R   ] app-mobilephone/obexftp-0.21  USE="bluetooth nls perl python -debug -swig -tcl"

../obexftp/.libs/libobexftp.so: undefined reference to `cobex_ctrans'
collect2: ld returned 1 exit status
make[2]: *** [obexftp] Error 1
make[2]: *** Waiting for unfinished jobs....
creating discovery
make[2]: Leaving directory `/var/tmp/portage/app-mobilephone/obexftp-0.21/work/obexftp-0.21/apps'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/app-mobilephone/obexftp-0.21/work/obexftp-0.21'
make: *** [all] Error 2

!!! ERROR: app-mobilephone/obexftp-0.21 failed.
Call stack:
  ebuild.sh, line 1614:   Called dyn_compile
  ebuild.sh, line 971:   Called qa_call 'src_compile'
  ebuild.sh, line 44:   Called src_compile
  obexftp-0.21.ebuild, line 56:   Called die

emerge --info
Portage 2.1.2.4 (default-linux/x86/2006.1, gcc-4.1.2, glibc-2.5-r1, 2.6.20-suspend2 i686)
=================================================================
System uname: 2.6.20-suspend2 i686 AMD Athlon(tm) XP 1800+
Gentoo Base System release 1.12.10
Timestamp of tree: Thu, 26 Apr 2007 13:50:01 +0000
ccache version 2.4 [enabled]
dev-lang/python:     2.4.4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r7
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.23b
virtual/os-headers:  2.6.20-r2
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=athlon-xp -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/php/apache1-php5/ext-active/ /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-O2 -march=athlon-xp -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict"
GENTOO_MIRRORS="http://gentoo.supp.name/ "
LANG="cs_CZ.UTF8"
LC_ALL="cs_CZ.UTF8"
LINGUAS="cs"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X aac acpi alsa apache2 berkdb bitmap-fonts bluetooth bzip2 cdparanoia cdr cli cracklib cups dri dvd dvdread encode exif ffmpeg foomaticdb fortran gdbm gif glitz gphoto2 gpm hal hplip iconv imagemagick isdnlog jabber jfs jpeg kde kdehiddenvisibility lcms libg++ logrotate mad midi mmx mp3 mpeg musicbrainz ncurses nls nptl nptlonly ntfs ogg opengl pam pcre perl png ppds pppd python qt3 quicktime readline reflection reiserfs scanner sdl session spl sse ssl svg symlink tcpd tetex tiff truetype truetype-fonts type1-fonts unicode usb vim vim-syntax vorbis win32codecs x264 x86 xcomposite xorg xscreensaver xv xvid xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" CAMERAS="panasonic" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="cs" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 7 Alin Năstac (RETIRED) gentoo-dev 2007-04-29 21:30:20 UTC
(In reply to comment #5)
> nb-matej /var/tmp/portage/app-mobilephone/obexftp-0.21/work/obexftp-0.21 #
> objdump --dynamic-syms obexftp/.libs/libobexftp.so | grep cobex_ctrans
> 00000000      D  *UND*  00000000              cobex_ctrans

Ah, I didn't looked for UND symbols in libobexftp.so. Now I don't understand why I cannot reproduce. It must be another symbol from libmulticobex.so that keep it from being discarded (at least for me).

Your patch has been added to obexftp-0.21 (no revision bump). Thanks!
Comment 8 Matěj Laitl 2007-04-29 21:37:08 UTC
Thank you for your great work!
Comment 9 Matěj Laitl 2007-04-30 13:47:04 UTC
Ah, reopening, sorry.
The patch I posted only solved build of obexftp, not all dynamic lib dependencies. It is reproducible (whith the current patch in portage): LDFLAGS="-Wl,--as-needed" emerge obexftp obexfs

obexfs executable could not be linked, due to unresolved symbols in libobexftp.so, and due to unresolved symbols in libmulticobex.so

Following patch will fix this once for all.
Comment 10 Matěj Laitl 2007-04-30 13:54:57 UTC
Created attachment 117733 [details, diff]
obexftp-0.21-as-needed.patch

This patch pulls all dependencies to libobexftp.so and libmulticobex.so. These dependencies were somehow mentioned in original Makefile.am's, but not used in build. (only @USB_LIBS@ is discarded by this patch, because it is no longer used)

Please trash my old patch and replace it witch this one. Sorry for this inconvenience.
Comment 11 Matěj Laitl 2007-04-30 16:31:51 UTC
Upstream went the same way, so it should not be a problem, and will be fixed in next version. http://dev.zuckschwerdt.org/obexftp/changeset?new=trunk%2Fobexftp%2FMakefile.am%40114&old=trunk%2Fobexftp%2FMakefile.am%40112
Comment 12 Alin Năstac (RETIRED) gentoo-dev 2007-05-01 06:30:02 UTC
done. thanks!