Hi there, x11-misc/xdotool fails to compile, with many undefined reference errors to the required X11 libraries it needs: >>> Emerging (1 of 1) x11-misc/xdotool-20090609 * xdotool-20090609.tar.gz RMD160 SHA1 SHA256 size ;-) ... [ ok ] * checking ebuild checksums ;-) ... [ ok ] * checking auxfile checksums ;-) ... [ ok ] * checking miscfile checksums ;-) ... [ ok ] >>> Unpacking source... >>> Unpacking xdotool-20090609.tar.gz to /var/tmp/portage/x11-misc/xdotool-20090609/work >>> Source unpacked in /var/tmp/portage/x11-misc/xdotool-20090609/work >>> Compiling source in /var/tmp/portage/x11-misc/xdotool-20090609/work/xdotool-20090609 ... make -j5 cc -pipe -std=c99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -Wno-missing-field-initializers `pkg-config --cflags x11 xtst 2> /dev/null || echo "-I/usr/X11R6/include -I/usr/local/include"` -c xdotool.c cc -pipe -std=c99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -Wno-missing-field-initializers `pkg-config --cflags x11 xtst 2> /dev/null || echo "-I/usr/X11R6/include -I/usr/local/include"` -c xdo.c pod2man -c "" -r "" xdotool.pod > xdotool.1 cc1: warning: -funit-at-a-time is required for inlining of functions that are only called once cc1: warning: -funit-at-a-time is required for inlining of functions that are only called once xdotool.c:140: warning: unused parameter 'unused_argc' xdotool.c:140: warning: unused parameter 'unused_args' cc -pipe -std=c99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -Wno-missing-field-initializers `pkg-config --cflags x11 xtst 2> /dev/null || echo "-I/usr/X11R6/include -I/usr/local/include"` -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--as-needed `pkg-config --libs x11 xtst 2> /dev/null || echo "-L/usr/X11R6/lib -L/usr/local/lib -lX11 -lXtst"` xdotool.o xdo.o -o xdotool xdo.o: In function `xdo_new': xdo.c:(.text+0x11): undefined reference to `XOpenDisplay' xdo.o: In function `xdo_free': xdo.c:(.text+0x1a3): undefined reference to `XCloseDisplay' xdo.o: In function `xdo_window_map': xdo.c:(.text+0x1d5): undefined reference to `XMapWindow' xdo.c:(.text+0x1e4): undefined reference to `XFlush' xdo.o: In function `xdo_window_unmap': xdo.c:(.text+0x221): undefined reference to `XUnmapWindow' xdo.c:(.text+0x230): undefined reference to `XFlush' xdo.o: In function `xdo_window_move': xdo.c:(.text+0x4a4): undefined reference to `XConfigureWindow' xdo.o: In function `xdo_window_setsize': xdo.c:(.text+0x551): undefined reference to `XGetWMNormalHints' xdo.c:(.text+0x5ef): undefined reference to `XConfigureWindow' xdo.c:(.text+0x601): undefined reference to `XFlush' xdo.o: In function `xdo_window_focus': xdo.c:(.text+0x648): undefined reference to `XSetInputFocus' xdo.c:(.text+0x657): undefined reference to `XFlush' xdo.o: In function `xdo_window_activate': xdo.c:(.text+0x77f): undefined reference to `XInternAtom' xdo.c:(.text+0x7c3): undefined reference to `XGetWindowAttributes' xdo.c:(.text+0x7f1): undefined reference to `XSendEvent' xdo.o: In function `xdo_set_number_of_desktops': xdo.c:(.text+0x8e3): undefined reference to `XInternAtom' xdo.c:(.text+0x929): undefined reference to `XSendEvent' xdo.o: In function `xdo_get_number_of_desktops': xdo.c:(.text+0x9ad): undefined reference to `XInternAtom' xdo.c:(.text+0x9bd): undefined reference to `XDefaultRootWindow' xdo.o: In function `xdo_set_current_desktop': xdo.c:(.text+0xb04): undefined reference to `XInternAtom' xdo.c:(.text+0xb55): undefined reference to `XSendEvent' xdo.o: In function `xdo_get_current_desktop': xdo.c:(.text+0xbd9): undefined reference to `XInternAtom' xdo.c:(.text+0xbe9): undefined reference to `XDefaultRootWindow' xdo.o: In function `xdo_set_desktop_for_window': xdo.c:(.text+0xca8): undefined reference to `XGetWindowAttributes' xdo.c:(.text+0xd3f): undefined reference to `XInternAtom' xdo.c:(.text+0xd97): undefined reference to `XSendEvent' xdo.o: In function `xdo_get_desktop_for_window': xdo.c:(.text+0xe1f): undefined reference to `XInternAtom' xdo.o: In function `xdo_window_get_active': xdo.c:(.text+0xef9): undefined reference to `XInternAtom' xdo.c:(.text+0xf09): undefined reference to `XDefaultRootWindow' xdo.o: In function `xdo_window_raise': xdo.c:(.text+0xfaa): undefined reference to `XRaiseWindow' xdo.c:(.text+0xfb9): undefined reference to `XFlush' xdo.o: In function `xdo_mousemove': xdo.c:(.text+0x1005): undefined reference to `XTestFakeMotionEvent' xdo.c:(.text+0x1014): undefined reference to `XFlush' xdo.o: In function `xdo_mousemove_relative': xdo.c:(.text+0x105a): undefined reference to `XTestFakeRelativeMotionEvent' xdo.c:(.text+0x1069): undefined reference to `XFlush' xdo.o: In function `xdo_mousedown': xdo.c:(.text+0x10ae): undefined reference to `XTestFakeButtonEvent' xdo.c:(.text+0x10bd): undefined reference to `XFlush' xdo.o: In function `xdo_mouseup': xdo.c:(.text+0x1102): undefined reference to `XTestFakeButtonEvent' xdo.c:(.text+0x1111): undefined reference to `XFlush' xdo.o: In function `xdo_mouselocation': xdo.c:(.text+0x1203): undefined reference to `XQueryPointer' xdo.o: In function `xdo_type': xdo.c:(.text+0x138b): undefined reference to `XFlush' xdo.o: In function `_xdo_keysequence_do': xdo.c:(.text+0x14b7): undefined reference to `XFlush' xdo.o: In function `xdo_window_get_focus': xdo.c:(.text+0x1597): undefined reference to `XGetInputFocus' xdo.o: In function `xdo_window_sane_get_focus': xdo.c:(.text+0x15f2): undefined reference to `XGetClassHint' xdo.c:(.text+0x1627): undefined reference to `XQueryTree' xdo.c:(.text+0x1639): undefined reference to `XFree' xdo.c:(.text+0x164c): undefined reference to `XFree' xdo.c:(.text+0x1655): undefined reference to `XFree' xdo.o: In function `_xdo_has_xtest': xdo.c:(.text+0x17e7): undefined reference to `XTestQueryExtension' xdo.o: In function `_xdo_populate_charcode_map': xdo.c:(.text+0x1829): undefined reference to `XDisplayKeycodes' xdo.c:(.text+0x18a4): undefined reference to `XKeysymToKeycode' xdo.c:(.text+0x18f6): undefined reference to `XKeycodeToKeysym' xdo.c:(.text+0x18fe): undefined reference to `XKeysymToString' xdo.o: In function `_xdo_get_child_windows': xdo.c:(.text+0x1bce): undefined reference to `XQueryTree' xdo.c:(.text+0x1c9e): undefined reference to `XFree' xdo.o: In function `_xdo_keysequence_to_keycode_list': xdo.c:(.text+0x1d39): undefined reference to `XStringToKeysym' xdo.c:(.text+0x1d48): undefined reference to `XKeysymToKeycode' xdo.c:(.text+0x1def): undefined reference to `XStringToKeysym' xdo.c:(.text+0x1e29): undefined reference to `XKeysymToKeycode' xdo.c:(.text+0x1e69): undefined reference to `XKeycodeToKeysym' xdo.o: In function `_xdo_regex_match_window': xdo.c:(.text+0x1fbc): undefined reference to `XGetWindowAttributes' xdo.c:(.text+0x1fd9): undefined reference to `XGetWMName' xdo.c:(.text+0x2036): undefined reference to `XmbTextPropertyToTextList' xdo.c:(.text+0x2082): undefined reference to `XFreeStringList' xdo.c:(.text+0x209d): undefined reference to `XFreeStringList' xdo.c:(.text+0x20c9): undefined reference to `XGetClassHint' xdo.c:(.text+0x2120): undefined reference to `XFree' xdo.c:(.text+0x212c): undefined reference to `XFree' xdo.c:(.text+0x2144): undefined reference to `XFree' xdo.c:(.text+0x2193): undefined reference to `XFree' xdo.c:(.text+0x21ab): undefined reference to `XFree' xdo.o: In function `_xdo_is_window_visible': xdo.c:(.text+0x222a): undefined reference to `XGetWindowAttributes' xdo.o: In function `_xdo_getwinprop': xdo.c:(.text+0x22ce): undefined reference to `XGetWindowProperty' xdo.o: In function `_xdo_ewmh_is_supported': xdo.c:(.text+0x23eb): undefined reference to `XInternAtom' xdo.c:(.text+0x2404): undefined reference to `XInternAtom' xdo.o: In function `_xdo_send_key': xdo.c:(.text+0x254f): undefined reference to `XStringToKeysym' xdo.c:(.text+0x255e): undefined reference to `XKeysymToKeycode' xdo.c:(.text+0x2594): undefined reference to `XTestFakeKeyEvent' xdo.c:(.text+0x25b1): undefined reference to `XTestFakeKeyEvent' xdo.c:(.text+0x25d3): undefined reference to `XTestFakeKeyEvent' xdo.c:(.text+0x25fe): undefined reference to `XTestFakeKeyEvent' xdo.c:(.text+0x2670): undefined reference to `XSendEvent' collect2: ld returned 1 exit status make: *** [xdotool] Error 1 For reference, here is my emerge --info output: Portage 2.2_rc33 (default/linux/amd64/2008.0/no-multilib, gcc-4.3.3, glibc-2.9_p20081201-r2, 2.6.29-gentoo-r5 x86_64) ================================================================= System uname: Linux-2.6.29-gentoo-r5-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9400_@_2.66GHz-with-gentoo-2.0.0 Timestamp of tree: Tue, 16 Jun 2009 05:25:01 +0000 ccache version 2.4 [enabled] app-shells/bash: 4.0_p24 dev-java/java-config: 2.1.8-r1 dev-lang/python: 2.6.2-r1 dev-util/ccache: 2.4-r8 dev-util/cmake: 2.6.4 sys-apps/baselayout: 2.0.0-r2 sys-apps/openrc: 0.4.2-r1 sys-apps/sandbox: 2.0 sys-devel/autoconf: 2.13, 2.63-r1 sys-devel/automake: 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2, 1.11 sys-devel/binutils: 2.19.1-r1 sys-devel/gcc-config: 1.4.1 sys-devel/libtool: 2.2.6a virtual/os-headers: 2.6.29 ACCEPT_KEYWORDS="amd64 ~amd64" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O2 -pipe -msse4.1" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /var/lib/hsqldb" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d" CXXFLAGS="-march=native -O2 -pipe -msse4.1" DISTDIR="/usr/portage/distfiles" FEATURES="ccache distlocks fixpackages metadata-transfer noinfo parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-orphans userfetch userpriv usersandbox" FFLAGS="-march=native -O2 -pipe -msse4.1" GENTOO_MIRRORS="http://linux.anu.edu.au/gentoo http://mirror.internode.on.net/pub/gentoo http://mirror.aarnet.edu.au/pub/gentoo http://ftp.swin.edu.au/gentoo" LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--as-needed" LINGUAS="en" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage/layman/xfce-dev /usr/local/portage/layman/berkano /usr/local/portage/layman/ruby /usr/local/portage/layman/java-overlay /usr/local/portage/layman/ephemeral /usr/local/portage/layman/vmware /usr/local/portage/overlays/testing-gentoo-overlay /usr/local/portage/overlays/bugzilla-gentoo-overlay /usr/local/portage/overlays/misc-gentoo-overlay" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X a52 aac acl acpi alsa amd64 avahi bash-completion bzip2 cairo cdr cleartype cli cracklib crypt cups dbus dell dga directfb dri dvd dvdr dvdread encode fam fbcon fontconfig fortran gdbm gif glitz gmp gnutls gpm gs gstreamer gtk hal iconv icu isdnlog ithreads jpeg lcms ldap libnotify mad midi mmx mng mp3 mp4 mpeg mudflap ncurses nls nptl nptlonly nsplugin ogg opengl openmp pam pcre pdf perl png postscript pppd python readline reflection samba sasl session sndfile spell spl sse sse2 ssl ssse3 startup-notification svg sysfs tcpd theora threads tiff truetype unicode vorbis webkit xcb xcomposite xft xml xorg xpm xscreensaver xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci 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 mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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 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 authn_dbd dbd" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="intel vesa fbdev vmware" Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS I discovered this problem a few days ago upgrading my machine. I have an xdotool ebuild in my own overlay which had worked through these issues. Using this ebuild will fix the errors. I've attached it to this bug. This ebuild performs a bunch of substitutions into the xdotool Makefile. Please adjust and correct if necessary. Thanks and regards, Joshua Rich Reproducible: Always Steps to Reproduce:
Created attachment 195131 [details] ebuild that fixes library linking problems
Further to attached ebuild, here is a contents of the XDOTOOL license I am using, which was taken from the COPYRIGHT file in the source distribution. If you think that it is close enough to 'as-is', please adjust attached ebuild. Cheers, Joshua Copyright (c) 2007, 2008, 2009: Jordan Sissel. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Jordan Sissel nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY JORDAN SISSEL ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JORDAN SISSEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This looks like a standard '--as-needed' problem. A more simple fix would be to move the var with libs after the var with objects in that Makefile.
That was of course about order of vars in the build command, not order of apperance in the Makefile.
Created attachment 195237 [details] updated ebuild to fix compile issues Updated ebuild to fix issue where stripping '-std=c99' from CFLAGS leads to compile failure. Rafa?, I'm unsure exactly what you mean. Do you mean that '-lX11 -lXtst' should come after all the '-Wl' linker opts? In this case, the build will fail with my LDFLAGS. The substitution I made, where -lX11... comes before -Wl... works. Disclaimer though, I'm
(In reply to comment #5) > Created an attachment (id=195237) [edit] > updated ebuild to fix compile issues > > Updated ebuild to fix issue where stripping '-std=c99' from CFLAGS leads to > compile failure. > > Rafał, > > I'm unsure exactly what you mean. Do you mean that '-lX11 -lXtst' should come > after all the '-Wl' linker opts? In this case, the build will fail with my > LDFLAGS. The substitution I made, where -lX11... comes before -Wl... works. > Disclaimer though, I'm > ...no programmer. I code in Perl... Cheers, Josh
Not really programming stuff, more like an obscure technical detail... unless you've already seen a few dozen of that type. In that Makefile, there this line: LDFLAGS+=$(LIBS) and later this one: $(CC) $(CFLAGS) $(LDFLAGS) xdotool.o xdo.o -o $@ that works, unless --as-needed is used. Upstream should fix that too. I think the simplest way would be removing first line and changing second to: $(CC) $(CFLAGS) $(LDFLAGS) xdotool.o xdo.o $(LIBS) -o $@ (that's what I meant by "libs after objects")
Please attach unified diffs (diff -u) when you did changes to an ebuild. That would be much more handy for our devs.
Created attachment 195409 [details, diff] diff/patch against xdotool-20090609.ebuild As requested, diff/patch against xdotool-20090609.ebuild. Fixes 'as-needed' linking problems discussed in this bug.
Created attachment 197900 [details] Merged ebuild Can anyone agree on this? I'm keeping dobin (don't see why exeinto/doexe should be prefered) New description was too long (only 100 chars allowed) And some minor stuff like quoting ${S} etc.
Oh yes, we use /usr/share/doc not /usr/doc. Consider this changed when i commit.
Commited
Hi Christian, Cool, thanks for those fixes, will keep them in mind next time I send a bug. Sorry about the doc location, must have missed share when typing it out! And thanks for chasing this bug up. Cheers, Josh