GNOME Bugzilla – Bug 704985
anjuta fails to link with ld.gold
Last modified: 2013-08-04 09:57:46 UTC
Created attachment 250264 [details] build.log make[6]: Entering directory `/var/tmp/portage/dev-util/anjuta-3.8.4/work/anjuta-3.8.4/plugins/symbol-db/benchmark/symbol-db' x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../../../.. -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -pthread -I/usr/include/libgdl-3.0 -I/usr/include/libxml2 -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I../../../.. -I../../../../libanjuta -DPACKAGE_PIXMAPS_DIR=\""/usr/share/pixmaps/anjuta"\" -DPACKAGE_LIB_DIR=\""/usr/lib64/anjuta"\" -DPACKAGE_DATA_DIR=\""/usr/share/anjuta"\" -pthread -I/usr/include/libgda-5.0 -I/usr/include/libgda-5.0/libgda -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/libxml2 -DDEBUG -Wall -march=corei7-avx -O2 -pipe -frecord-gcc-switches -c benchmark.c /bin/sh ../../../../libtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc -Wall -march=corei7-avx -O2 -pipe -frecord-gcc-switches ../../../../libanjuta/libanjuta-3.la -lgthread-2.0 -pthread -Wl,--export-dynamic -lgmodule-2.0 -pthread -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgio-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lgda-5.0 -lgobject-2.0 -lgthread-2.0 -pthread -lglib-2.0 -lxml2 -Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common -o benchmark benchmark.o ../../libanjuta-symbol-db.la -lutil *** Warning: Linking the executable benchmark against the loadable module *** libanjuta-symbol-db.so is not portable! libtool: link: x86_64-pc-linux-gnu-gcc -Wall -march=corei7-avx -O2 -pipe -frecord-gcc-switches -pthread -Wl,--export-dynamic -pthread -pthread -Wl,-O1 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common -o .libs/benchmark benchmark.o ../../../../libanjuta/.libs/libanjuta-3.so -lgmodule-2.0 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgio-2.0 -lgdk_pixbuf-2.0 -lgda-5.0 -lgobject-2.0 -lgthread-2.0 -lglib-2.0 -lxml2 -Wl,--as-needed ../../.libs/libanjuta-symbol-db.so -lutil -pthread -Wl,-rpath -Wl,/usr/lib64/anjuta ../../.libs/libanjuta-symbol-db.so: error: undefined reference to 'shm_open' ../../.libs/libanjuta-symbol-db.so: error: undefined reference to 'shm_unlink' collect2: error: ld returned 1 exit status make[6]: *** [benchmark] Error 1 make[6]: Leaving directory `/var/tmp/portage/dev-util/anjuta-3.8.4/work/anjuta-3.8.4/plugins/symbol-db/benchmark/symbol-db' make[5]: *** [all-recursive] Error 1 make[5]: Leaving directory `/var/tmp/portage/dev-util/anjuta-3.8.4/work/anjuta-3.8.4/plugins/symbol-db/benchmark' make[4]: *** [all-recursive] Error 1 make[4]: Leaving directory `/var/tmp/portage/dev-util/anjuta-3.8.4/work/anjuta-3.8.4/plugins/symbol-db'
Portage 2.2.0_alpha188 (default/linux/amd64/13.0, gcc-4.8.1-asneeded, glibc-2.17, 3.9.11-lh x86_64) ================================================================= System uname: Linux-3.9.11-lh-x86_64-Intel-R-_Core-TM-_i7-2600_CPU_@_3.40GHz-with-gentoo-2.2 KiB Mem: 16345160 total, 9079112 free KiB Swap: 3987452 total, 3987452 free Timestamp of tree: Sat, 27 Jul 2013 13:00:01 +0000 ld GNU gold (GNU Binutils 2.23.1) 1.11 ccache version 3.1.9 [enabled] app-shells/bash: 4.2_p45 dev-java/java-config: 2.2.0 dev-lang/python: 2.6.8-r2, 2.7.5-r1, 3.1.5-r1, 3.2.5-r1, 3.3.2-r1 dev-util/ccache: 3.1.9-r1::science dev-util/cmake: 2.8.11.1 dev-util/pkgconfig: 0.28 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.11.8 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.13, 2.69 sys-devel/automake: 1.10.3, 1.11.6, 1.12.6, 1.13.4, 1.14 sys-devel/binutils: 2.23.1 sys-devel/gcc: 4.4.7, 4.5.4, 4.6.4, 4.7.3, 4.8.1 sys-devel/gcc-config: 1.8 sys-devel/libtool: 2.4.2 sys-devel/make: 3.82-r4 sys-kernel/linux-headers: 3.9 (virtual/os-headers) sys-libs/glibc: 2.17 Repositories: gentoo sunrise bicatali betagarden dummy Neurogeek science Raspberry-Pi-Overlay last-hope g-ctan ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -ftracer -march=native -frecord-gcc-switches -g -Wimplicit-function-declaration" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/lib/systemd/system /usr/share/eselect/ /usr/share/gnupg/qualified.txt /usr/share/nano/ /var/lib/hsqldb /var/spool/munin-async/.ssh" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -pipe -ftracer -march=native -frecord-gcc-switches -g -Wenum-compare" DISTDIR="/var/cache/portage/distfiles" EMERGE_DEFAULT_OPTS=" -vt --keep-going --autounmask-write --autounmask --quiet-build=n" FCFLAGS="-O2 -pipe -ftracer -march=native -frecord-gcc-switches -g" FEATURES="assume-digests binpkg-logs buildsyspkg candy ccache collision-protect compressdebug distlocks ebuild-locks fixlafiles merge-sync metadata-transfer multilib-strict news noinfo parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms sign split-log splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe -ftracer -march=native -frecord-gcc-switches -g" GENTOO_MIRRORS=" /mnt/tmpfs/ http://gentoo.j-schmitz.net/mirror/ ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo ftp://ftp.tu-clausthal.de/pub/linux/gentoo/" LANG="en_GB.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common" MAKEOPTS="-j12 -l9" PKGDIR="/var/cache/portage/packages" PORTAGE_COMPRESS="xz" PORTAGE_COMPRESS_FLAGS="-z -e -9 -v" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_EXTRA_OPTS="--omit-dir-times" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/var/cache/portage/tree" PORTDIR_OVERLAY="/local/overlays/sunrise-reviewed /local/overlays/bicatali /local/overlays/betagarden /local/overlays/dummy /local/overlays/neurogeek /local/overlays/sci /local/overlays/gen2pi /local/overlays/lh-overlay /local/overlays/g-ctan" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X acl alsa amd64 avx bash-completion berkdb branding bzip2 cairo caps cli cracklib crypt cxx dbus dri fortran gdbm gif gmp gnome gnome-keyring gpm gstreamer gtk iconv icu ipv6 jpeg jpeg2k mmx mmxext modules mudflap multilib ncurses network-cron nls nptl nsplugin numa opengl openmp pam pcre pgo png pulseaudio qt3support raw readline session smp sse sse2 sse2_4way sse2check sse3 sse4 sse41 sse4_1 sse4_2 sse4a ssl ssse3 startup-notification systemd tcpd threads tiff truetype unicode vaapi vdpau xattr xinerama zlib" ABI_X86="64" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="plymouth" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer pdfimport scripting-javascript wiki-publisher nlpsolver" LINGUAS="en" NGINX_MODULES_HTTP="access auth_basic autoindex browser charset empty_gif fastcgi geo gzip limit_conn limit_req map memcached proxy referer rewrite scgi split_clients ssi upstream_ip_hash userid uwsgi stub_status" OFFICE_IMPLEMENTATION="libreoffice" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_6 python2_7 python3_1 python3_2 python3_3 pypy1_9 pypy2_0" QEMU_SOFTMMU_TARGETS="i386 x86_64 arm armeb" QEMU_USER_TARGETS="i386 x86_64 arm armeb" RUBY_TARGETS="ruby19" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" USE_PYTHON="2.6 2.7 3.1 3.2 3.3 2.7-pypy-1.9 2.7-pypy-2.0" Unset: CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND
Created attachment 250319 [details] [review] proposed patch On Linux, shm_open()/shm_unlink() are not a part of the main libc, so anjuta's symbol-db needs to be linked with librt.
Review of attachment 250319 [details] [review]: Thank you for you patch. But isn't it better to replace dnl On Linux, need librt for shm_open/shm_unlink bck_LIBS="$LIBS" AC_SEARCH_LIBS(shm_open, rt, [SHM_LIBS="$LIBS"], [AC_MSG_ERROR([Failed to find library with shm_open()])]) AC_SUBST(SHM_LIBS) LIBS="$bck_LIBS" By AC_SEARCH_LIBS(shm_open, rt, [SHM_LIBS="-lrt"], [AC_MSG_ERROR([Failed to find library with shm_open()])]) AC_SUBST(SHM_LIBS) It looks a bit simpler for me?
(In reply to comment #3) > Review of attachment 250319 [details] [review]: > > Thank you for you patch. > > But isn't it better to replace > dnl On Linux, need librt for shm_open/shm_unlink > bck_LIBS="$LIBS" > AC_SEARCH_LIBS(shm_open, rt, [SHM_LIBS="$LIBS"], [AC_MSG_ERROR([Failed to > find library with shm_open()])]) > AC_SUBST(SHM_LIBS) > LIBS="$bck_LIBS" > By > AC_SEARCH_LIBS(shm_open, rt, [SHM_LIBS="-lrt"], [AC_MSG_ERROR([Failed to > find library with shm_open()])]) > AC_SUBST(SHM_LIBS) > It looks a bit simpler for me? See autoconf documentation: https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Libraries.html AC_SEARCH_LIBS always has the side effect of adding the found library to LIBS if it succeeds. And $LIBS is added to all linker arguments in all makefiles in the project. So your proposal would result in all Anjuta binaries, libraries, and plugins - not just libanjuta-symbol-db.so - getting linked with librt for no good reason. So it would work, and the patch would be simpler, but the effects of such a patch would be inelegant :(
(In reply to comment #5) > See autoconf documentation: > https://www.gnu.org/software/autoconf/manual/autoconf-2.65/html_node/Libraries.html > AC_SEARCH_LIBS always has the side effect of adding the found library to LIBS > if it succeeds. And $LIBS is added to all linker arguments in all makefiles in > the project. So your proposal would result in all Anjuta binaries, libraries, > and plugins - not just libanjuta-symbol-db.so - getting linked with librt for > no good reason. Yes, you are right. I have compared your patch with another one using AC_CHECK_LIB instead. > So it would work, and the patch would be simpler, but the effects of such a > patch would be inelegant :( I agree. However with your patch, as LIBS is not empty, you will add other libraries in the SHM_LIBS variable. These libraries should be already linked so I think it's better but not perfect. Then we can use AC_CHECK_LIBS but it will fail if librt is not available which I think could happen.Do you know a better solution? Else I will commit your patch as it is.
(In reply to comment #6) Using AC_CHECK_LIB for in this case would be wrong because on most non-Linux systems - FreeBSD, OSX etc. - shm_open() is part of the main libc, not librt. If you want to minimize SHM_LIBS, the best solution that I can think of is applying the same bck_LIBS trick to the existing AC_SEARCH_LIBS call which looks for forkpty(). That would ensure you don't get -lutil in SHM_LIBS.
(In reply to comment #7) > Using AC_CHECK_LIB for in this case would be wrong because on most non-Linux > systems - FreeBSD, OSX etc. - shm_open() is part of the main libc, not librt. Yes, I have seen it with a check of the operating system but I think your use of AC_SEARCH_LIBS is better. > If you want to minimize SHM_LIBS, the best solution that I can think of is > applying the same bck_LIBS trick to the existing AC_SEARCH_LIBS call which > looks for forkpty(). That would ensure you don't get -lutil in SHM_LIBS. I prefer to avoid tricks so I have committed your patch as it is. Thanks for it and your explanations.