After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 528582 - 0.14.3 won't build: undefined reference to 'floor'
0.14.3 won't build: undefined reference to 'floor'
Status: RESOLVED FIXED
Product: planner
Classification: Other
Component: General
0.14.x
Other Linux
: Normal normal
: ---
Assigned To: planner-maint
planner-maint
Depends on:
Blocks:
 
 
Reported: 2008-04-17 14:02 UTC by Patryk Zawadzki
Modified: 2008-04-20 14:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix build with --as-needed (474 bytes, patch)
2008-04-19 14:42 UTC, Marcin Banasiak
none Details | Review

Description Patryk Zawadzki 2008-04-17 14:02:59 UTC
i686-pld-linux-gcc -O2 -fno-strict-aliasing -fwrapv -march=i686 -mtune=pentium4 -gdwarf-2 -g2 -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,-combreloc -o .libs/time-test time-test.o -Wl,--export-dynamic -pthread  ./.libs/libselfcheck.a ../libplanner/.libs/libplanner-1.so /usr/lib/libgnomeui-2.so -L/usr/lib /usr/lib/libgio-2.0.so /usr/lib/libgnome-keyring.so /usr/lib/libjpeg.so /usr/lib/libbonoboui-2.so /usr/lib/libSM.so /usr/lib/libICE.so /usr/lib/libgnome-2.so /usr/lib/libesd.so /usr/lib/libasound.so /usr/lib/libaudiofile.so /usr/lib/libpopt.so /usr/lib/libbonobo-2.so /usr/lib/libbonobo-activation.so /usr/lib/libORBitCosNaming-2.so /usr/lib/libglade-2.0.so /usr/lib/libgnomeprintui-2-2.so /usr/lib/libgnomeprint-2-2.so /usr/lib/libgnomecanvas-2.so /usr/lib/libgailutil.so /usr/lib/libart_lgpl_2.so /usr/lib/libgtk-x11-2.0.so /usr/lib/libgdk-x11-2.0.so /usr/lib/libatk-1.0.so /usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libpangocairo-1.0.so /usr/lib/libXinerama.so /usr/lib/libXi.so /usr/lib/libXrandr.so /usr/lib/libXcursor.so /usr/lib/libXcomposite.so /usr/lib/libXext.so /usr/lib/libXdamage.so /usr/lib/libcairo.so -lpng12 /usr/lib/libxcb-render-util.so /usr/lib/libxcb-render.so /usr/lib/libXrender.so /usr/lib/libpixman-1.so /usr/lib/libpangoft2-1.0.so /usr/lib/libpango-1.0.so /usr/lib/libfontconfig.so /usr/lib/libfreetype.so /usr/lib/libexpat.so /usr/lib/libxcb-xlib.so /usr/lib/libxcb.so /usr/lib/libXfixes.so /usr/lib/libX11.so /usr/lib/libXau.so /usr/lib/libXdmcp.so /usr/lib/libgnomevfs-2.so /usr/lib/libxml2.so -lz -lm /usr/lib/libdbus-glib-1.so -lssl -lcrypto /usr/lib/libavahi-glib.so /usr/lib/libavahi-client.so /usr/lib/libdbus-1.so /usr/lib/libavahi-common.so /usr/lib/libssp.so -lresolv -lutil /usr/lib/libgconf-2.so /usr/lib/libORBit-2.so /usr/lib/libgmodule-2.0.so -ldl /usr/lib/libgthread-2.0.so -lpthread -lrt /usr/lib/libgobject-2.0.so -lselinux /usr/lib/libglib-2.0.so /usr/lib/libpcre.so 
../libplanner/.libs/libplanner-1.so: undefined reference to `floor'
Comment 1 Maurice van der Pot 2008-04-17 17:35:17 UTC
Can you provide the output of the following three commands?
In the last command replace N.M with whatever version that libm file has.

  ldd ../libplanner/.libs/libplanner-1.so
  nm ../libplanner/.libs/libplanner-1.so |grep floor
  nm /lib/libm-N.M.so |grep floor

Comment 2 Patryk Zawadzki 2008-04-17 19:05:56 UTC
[patrys@meaw planner-0.14.3]$ ldd libplanner/.libs/libplanner-1.so
	linux-gate.so.1 =>  (0xb7f94000)
	libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb7f48000)
	libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb7f10000)
	libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb7e66000)
	libpthread.so.0 => /lib/libpthread.so.0 (0xb7e4f000)
	libc.so.6 => /lib/libc.so.6 (0xb7d16000)
	libdl.so.2 => /lib/libdl.so.2 (0xb7d12000)
	libpcre.so.0 => /lib/libpcre.so.0 (0xb7ceb000)
	/lib/ld-linux.so.2 (0x80000000)

[patrys@meaw planner-0.14.3]$ nm libplanner/.libs/libplanner-1.so | grep floor
         U floor

[patrys@meaw planner-0.14.3]$ nm /lib/libm-2.7.so | grep floor
nm: /lib/libm-2.7.so: no symbols

Please note the --as-needed parameter we use to remove unneeded dependencies. It might happen that you forgot to specify some library and without --as-needed it gets pulled by another lib (here stripped by --as-needed).
Comment 3 Maurice van der Pot 2008-04-17 20:33:44 UTC
Can you also give me the commands you used to build planner?
So far I've been unable to reproduce this problem.
Comment 4 Patryk Zawadzki 2008-04-17 20:41:55 UTC
+ cd planner-0.14.3
+ cp -f /usr/share/automake/config.sub .
+ glib-gettextize --copy --force
+ intltoolize --copy --force
+ libtoolize --copy --force
+ aclocal
+ autoconf
+ automake -a -c -f --foreign
+ ./configure \
   LDFLAGS="-Wl,--as-needed -Wl,-z,relro -Wl,-z,-combreloc" \
   CFLAGS="-O2 -fno-strict-aliasing -fwrapv -march=i686 -mtune=pentium4 -gdwarf-2 -g2" \
   CXXFLAGS="-O2 -fno-strict-aliasing -fwrapv -march=i686 -mtune=pentium4 -gdwarf-2 -g2" \
   FFLAGS="-O2 -fno-strict-aliasing -fwrapv -march=i686 -mtune=pentium4 -gdwarf-2 -g2" \
   FCFLAGS="-O2 -fno-strict-aliasing -fwrapv -march=i686 -mtune=pentium4 -gdwarf-2 -g2" \
   CPPFLAGS= \
   CC=i686-pld-linux-gcc \
   CXX=i686-pld-linux-g++ \
  --host=i686-pld-linux \
  --build=i686-pld-linux \
  --prefix=/usr \
  --exec-prefix=/usr \
  --bindir=/usr/bin \
  --sbindir=/usr/sbin \
  --sysconfdir=/etc \
  --datadir=/usr/share \
  --includedir=/usr/include \
  --libdir=/usr/lib \
  --libexecdir=/usr/lib \
  --localstatedir=/var \
  --sharedstatedir=/var/lib \
  --mandir=/usr/share/man \
  --infodir=/usr/share/info \
  --x-libraries=/usr/lib \
  --disable-update-mimedb \
  --enable-eds \
  --enable-database \
  --enable-gtk-doc \
  --enable-python \
  --enable-python-plugin \
  --enable-timetable
Comment 5 Marcin Banasiak 2008-04-19 14:42:25 UTC
Created attachment 109543 [details] [review]
fix build with --as-needed

This patch adds to libplanner_1_la_LIBADD missing library (in this case libm), so linking won't fail anymore.
Comment 6 Maurice van der Pot 2008-04-20 10:51:18 UTC
I am still unable to reproduce this problem on Gentoo, but I've committed the suggested change. If you have any idea why you are seeing this problem and I'm not, please send me or the planner-dev list a mail.

The fix will be available in the next major software release. Thank you for your bug report.
Comment 7 Patryk Zawadzki 2008-04-20 14:20:12 UTC
I am not sure if you are familiar with gcc4's --as-needed switch. Sorry if you know all this:

--as-needed causes the linker to check each linked library for symbols used in the object files. If there are none then the library is dropped and the resulting binary does not link to it. This is very useful as most projects specify only one set of libraries for all the binaries they produce. This results in uneeded dependencies in some of them.

On the other hand when a project forgets to specify all the direct dependencies it can happen that without --as-needed one of the linked libraries accidentally pulls all the missing deps and linking works fine (in your case some other library pulls the libm dependency while it should not). After recompiling the library with --as-needed the libm dependency will go away and planner fails to link with unresolved symbols.

In any case if a project uses symbols from a particular library it should explicitly link against it, not depending on some other library pulling the necessary dependencies and this is what the above patch does.