Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 123318 - net-dns/avahi won't build w/o X connection (related to pygtk)
Summary: net-dns/avahi won't build w/o X connection (related to pygtk)
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Anthony Basile
: 147476 177895 187260 189695 190419 208852 (view as bug list)
Depends on:
Reported: 2006-02-18 14:37 UTC by Colin Macdonald
Modified: 2013-01-14 12:28 UTC (History)
12 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Colin Macdonald 2006-02-18 14:37:58 UTC
When I tried to emerge avahi while sshed into my box, I got the following:
checking for python extension module directory... ${exec_prefix}/lib/python2.4/site-packages
checking for python module gtk... no
configure: error: Could not find Python module gtk

!!! Please attach the following file when filing a report to
!!! /var/tmp/portage/avahi-0.6.4/work/avahi-0.6.4/config.log

!!! ERROR: net-dns/avahi-0.6.4 failed.
Call stack:, line 1894:   Called dyn_compile, line 941:   Called src_compile
  avahi-0.6.4.ebuild, line 84:   Called econf 'compile' '--localstatedir=/var' '--with-distro=gentoo' '--disable-qt4' '--disable-python-dbus' '--disable-pygtk' '--disable-xmltoman' '--disable-monodoc' '--disable-compat-libdns_sd' '--disable-compat-howl' '--disable-doxygen-doc' '--enable-mono' '--enable-dbus' '--enable-python' '--enable-gtk' '--enable-qt3' '--enable-glib' '--enable-gdbm' '--enable-python-dbus'

!!! econf failed
!!! If you need support, post the topmost build error, and the call stack if relevant.

But at a local terminal, there was no problem:
checking for python extension module directory... ${exec_prefix}/lib/python2.4/site-packages
checking for python module gtk... yes
checking for python module dbus... yes
checking for python module socket... yes
checking for python module gdbm... yes
checking for mcs... /usr/bin/mcs
checking for gacutil... /usr/bin/gacutil

This is on my ~x86 box with emerge info:
Portage 2.1_pre4-r1 (default-linux/x86/2005.0, gcc-3.4.5, glibc-2.3.6-r2, i686)
System uname: i686 AMD Athlon(tm) Processor
Gentoo Base System version 1.12.0_pre16
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
dev-lang/python:     2.4.2-r1
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r3
CFLAGS="-march=i686 -O3 -pipe -fomit-frame-pointer"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/texmf/web2c /etc/env.d"
CXXFLAGS="-march=i686 -O3 -pipe -fomit-frame-pointer"
FEATURES="autoconfig collision-protection distcc distlocks sandbox sfperms strict userpriv usersandbox"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/ag-portage"
USE="x86 3dnow X Xaw3d a52 aac aalib acpi alsa apache2 apm arts audiofile avi berkdb bitmap-fonts bzip2 cairo cdr cjk crypt cups curl dbus dga dts dv dvb dvd dvdr eds emacs emboss encode esd exif expat f77 faad fbcon ffmpeg fftw flac fortran gcj gd gdbm gif gimpprint ginac gmp gnome gnustep gnutls gphoto2 gpm gstreamer gtk gtk2 gtkhtml hal idn imagemagick imlib jack java jpeg lcms ldap leim libcaca libg++ libwww lirc live mad matroska mikmod mmx mng mono motif mozilla mp3 mpeg mysql nas ncurses nls nptl objc offensive ogg oggvorbis openal opengl oss pam pdf pdflib perl plotutils png ppds python qhull qt quicktime radeon readline rtc samba scanner sdk sdl slang speex spell sqlite sse ssl svg tcltk tcpd tetex theora threads tiff truetype truetype-fonts type1-fonts unicode usb v4l v4l2 vcd vorbis wmf wxwindows xinerama xml xml2 xmms xosd xprint xv xvid zlib elibc_glibc kernel_linux userland_GNU video_cards_ati"
Comment 1 Sven Wegener gentoo-dev 2006-02-23 13:27:11 UTC
If I unset DISPLAY and try to compile all is good, and the configure code is clean. It checks if the module raised an ImportError. That there's no display is completely ignored. What does:

python -c 'import gtk'

print when you're logged in remotely?

Comment 2 Colin Macdonald 2006-02-23 14:09:41 UTC
That command normally exits silently.

Unless I unset DISPLAY:
$ export DISPLAY=""
$ python -c 'import gtk'
Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/gtk-2.0/gtk/", line 38, in ?    from _gtk import *
RuntimeError: could not open display

which seems reasonable.

More info: when I ssh in I have X11 forwarding turned on (for example, I can open an xterm).

Emerging the new avahi-0.6.7, I get:

 checking for python extension module directory... ${exec_prefix}/lib/python2.4/s ite-packages
checking for python module gtk... X11 connection rejected because of wrong authe ntication.
configure: error: Could not find Python module gtk

I think this has something to do with portage running as user portage instead of root (root has the correct X-auth stuff to open windows over the ssh connection but user portage doesn't).  Thats my guess anyway.
Comment 3 Sven Wegener gentoo-dev 2006-02-23 15:05:30 UTC
Yes, that might be a problem, but configure only checks for ImportError's and not for other weirdness. Normally it should work, even if gtk fails to establish a connection to the X server.
Comment 4 Colin Macdonald 2006-02-24 02:35:05 UTC
Seems to me a quick fix would be to just put a DISPLAY="" somewhere in the ebuild.  I suppose there is a deeper issue here though.
Comment 5 Sven Wegener gentoo-dev 2006-02-24 11:30:36 UTC
Nope, no way, that is guly.
Comment 6 Sven Wegener gentoo-dev 2006-03-02 15:06:51 UTC
This problem seems to be known to the avahi developers. Please bear with me until I have further information from them. :)
Comment 7 Robert Persson 2006-03-25 22:07:36 UTC
I encountered the same gtk configure error trying to emerge avahi-0.6.9, and I also came across another error in compilation which looks like it is related to the configure error. In both cases the workaround was to emerge in an sux shell rather than an su shell--a variation on the workaround used by the original bug reporter.

The second error gave the following output:

Making all in avahi-sharp
make[2]: Entering directory `/var/tmp/portage/avahi-0.6.9/work/avahi-0.6.9/avahi-sharp'
/usr/bin/mdassembler --out avahi-sharp-docs --ecma ./en
mcs -keyfile:./avahi.snk -target:library -out:avahi-sharp.dll -debug ./AddressResolver.cs ./AssemblyInfo.cs ./BrowserBase.cs ./Client.cs ./ClientException.cs ./DomainBrowser.cs ./EntryGroup.cs ./HostNameResolver.cs ./RecordBrowser.cs ./ResolverBase.cs ./ServiceBrowser.cs ./ServiceResolver.cs ./ServiceTypeBrowser.cs ./Utility.cs -r:Mono.Posix
./ ../avahi-client/ \
../avahi-common/ \
../avahi-glib/ < > avahi-sharp.dll.config
./ line 7: ../avahi-glib/ No such file or directory
make[2]: *** [avahi-sharp.dll.config] Error 1
make[2]: *** Waiting for unfinished jobs....
Processing namespace Avahi
    Processing input file AddressResolver.xml
    Processing input file BrowserBase.xml
    Processing input file Client.xml
    Processing input file ClientException.xml
    Processing input file ClientFlags.xml
    Processing input file ClientState.xml
    Processing input file ClientStateArgs.xml
    Processing input file ClientStateHandler.xml
    Processing input file DomainBrowser.xml
    Processing input file DomainBrowserType.xml
    Processing input file DomainInfo.xml
    Processing input file DomainInfoArgs.xml
    Processing input file DomainInfoHandler.xml
    Processing input file EntryGroup.xml
    Processing input file EntryGroupState.xml
    Processing input file EntryGroupStateArgs.xml
    Processing input file EntryGroupStateHandler.xml
    Processing input file ErrorCode.xml
    Processing input file ErrorCodeArgs.xml
    Processing input file ErrorCodeHandler.xml
    Processing input file HostAddressArgs.xml
    Processing input file HostAddressHandler.xml
    Processing input file HostNameResolver.xml
    Processing input file LookupFlags.xml
    Processing input file LookupResultFlags.xml
    Processing input file Protocol.xml
    Processing input file PublishFlags.xml
    Processing input file RecordBrowser.xml
    Processing input file RecordClass.xml
    Processing input file RecordInfo.xml
    Processing input file RecordInfoArgs.xml
    Processing input file RecordInfoHandler.xml
    Processing input file RecordType.xml
    Processing input file ResolverBase.xml
    Processing input file ServiceBrowser.xml
    Processing input file ServiceInfo.xml
    Processing input file ServiceInfoArgs.xml
    Processing input file ServiceInfoHandler.xml
    Processing input file ServiceResolver.xml
    Processing input file ServiceTypeBrowser.xml
    Processing input file ServiceTypeInfo.xml
    Processing input file ServiceTypeInfoArgs.xml
    Processing input file ServiceTypeInfoHandler.xml
Have 43 elements in the Avahi
make[2]: Leaving directory `/var/tmp/portage/avahi-0.6.9/work/avahi-0.6.9/avahi-sharp'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/avahi-0.6.9/work/avahi-0.6.9'
make: *** [all] Error 2

!!! ERROR: net-dns/avahi-0.6.9 failed.
!!! Function src_compile, Line 100, Exitcode 2
!!! emake failed
!!! If you need support, post the topmost build error, NOT this status message.

As I said, the emerge was succesful when I did it in an sux shell. The only thing different apart from that was that the successful build was USE=gtk, while the unsuccesful one was USE=-gtk (in order to get around the earlier configure error).
Comment 8 Ed Catmur 2006-04-12 14:05:57 UTC
swegener: any progress?

One possible workaround is to set XAUTHORITY=/root/.Xauthority.


$ ssh localhost env XAUTHORITY= xclock
X11 connection rejected because of wrong authentication.
X connection to localhost:10.0 broken (explicit kill or server shutdown).
$ env XAUTHORITY= xclock
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified
Error: Can't open display: :0.0

i.e. if authentication is not available when connecting to a local X server the application can recover, but when connecting via a ssh -X tunnel Xlib crashes the application.
Comment 9 Sven Wegener gentoo-dev 2006-04-17 12:19:58 UTC
Nothing new, been busy with private stuff and still can't reproduce it here. The code itself is sane and behaves well for me while setting XAUTHORITY to /dev/null for example.
Comment 10 Ed Catmur 2006-04-17 14:31:48 UTC
Have you checked tried reproducing it under a ssh X tunnel?

$ env XAUTHORITY=/dev/null python -c "'import gtk'"
$ ssh -X localhost env XAUTHORITY=/dev/null python -c "'import gtk'"
X11 connection rejected because of wrong authentication.
The application '-c' lost its connection to the display localhost:10.0;
most likely the X server was shut down or you killed/destroyed
the application.
Comment 11 Stefan Schweizer (RETIRED) gentoo-dev 2006-06-09 11:24:38 UTC
I cannot test the other bug without avahi being installed. What is the correct workaround? Why is the workaround not in the ebuild until the upstream bug has been resolved?
Can we please get this fixed?
Comment 12 Sven Wegener gentoo-dev 2006-06-10 06:32:17 UTC
I added the unset DISPLAY workaround. The problem is in gtk itself, which forcibly termintates the application in certain cases.
Comment 13 CraigMAllen 2006-07-19 07:56:27 UTC
I tried the fix suggested in comment#8


to no avail.  The best fix is to emerge through SSH.  That worked like a charm.
Comment 14 Jakub Moc (RETIRED) gentoo-dev 2006-09-13 11:13:25 UTC
*** Bug 147476 has been marked as a duplicate of this bug. ***
Comment 15 chad heuschober 2006-12-18 09:20:32 UTC
This exact bug is affecting me with avahi 0.6.15 which is being emerged through ssh without X forwarding. Has any stable workaround been determined?
Comment 16 Jakub Moc (RETIRED) gentoo-dev 2007-05-07 21:18:40 UTC
Shrug; re-emerging dev-python/pygtk fixed the issue for me. No idea about this.
Comment 17 Jakub Moc (RETIRED) gentoo-dev 2007-05-10 07:58:05 UTC
*** Bug 177895 has been marked as a duplicate of this bug. ***
Comment 18 Matteo Azzali (RETIRED) gentoo-dev 2007-05-10 10:23:45 UTC
Same issue in 0.6.19 here.
Comment 19 Matteo Azzali (RETIRED) gentoo-dev 2007-05-10 11:56:50 UTC
Hum, false report,sorry: my issue in 0.6.19 was caused by #177866 bug for 
dev-lang/python, re-emerging it with threads flag on solved the issue.
Comment 20 Sven Wegener gentoo-dev 2007-05-10 20:04:23 UTC

*** This bug has been marked as a duplicate of bug 177866 ***
Comment 21 Sven Wegener gentoo-dev 2007-05-10 20:05:14 UTC
bleh, sorry
Comment 22 Chuck Wegrzyn 2007-06-23 15:02:07 UTC
It didn't happen when I installed 0.6.19 but does happen with 0.6.20.
Comment 23 Jakub Moc (RETIRED) gentoo-dev 2007-07-31 19:11:36 UTC
*** Bug 187260 has been marked as a duplicate of this bug. ***
Comment 24 Jakub Moc (RETIRED) gentoo-dev 2007-08-21 12:37:38 UTC
*** Bug 189695 has been marked as a duplicate of this bug. ***
Comment 25 Jakub Moc (RETIRED) gentoo-dev 2007-08-27 16:47:20 UTC
*** Bug 190419 has been marked as a duplicate of this bug. ***
Comment 26 Michael Short 2007-10-06 16:31:32 UTC
The solution to this problem is to rebuild pycairo

I found the solution here:
Comment 27 Petr Kočmíd 2007-11-12 00:59:02 UTC
I can confirm that reemerging pycairo did the fix for me. However, I still believe an interference of vector graphics library with a network dicovery service is beyond any sanity and should be pursued upstream, preferably into pygtk.
Comment 28 Synesios Christou 2007-12-27 17:44:18 UTC
nostris ~ # python -c 'import gtk'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.5/site-packages/gtk-2.0/gtk/", line 48, in <module>
    from gtk import _gtk
ImportError: /usr/lib64/python2.5/site-packages/gtk-2.0/gtk/ undefined symbol: PyUnicodeUCS4_DecodeUTF8

Comment 29 Jakub Moc (RETIRED) gentoo-dev 2008-02-04 15:12:08 UTC
*** Bug 208852 has been marked as a duplicate of this bug. ***
Comment 30 Piotr Brzozowski 2008-02-25 11:02:33 UTC
I had problems with Avahi.
emerge pygobject pycairo 
solved my problems
Comment 31 Norberto Bensa 2008-04-30 01:00:05 UTC
Any progress on this one? I'm currently doing a chroot for a laptop where ubuntu decided to die and I'm stuck here. Any workaround?

Comment 32 Kensuke Kaneko 2008-05-11 15:01:18 UTC
Workaround does not fix my avahi problem.
I try to update net-dns/avahi from 0.6.19-r2 to 0.6.22-r1.
pycairo, pygobject, pygtk are up to date.

my emerge --info:

Portage 2.1.5_rc6 (default-linux/x86/2007.0, gcc-4.1.2, glibc-2.7-r1, 2.6.22-gentoo-r5 i686)
System uname: 2.6.22-gentoo-r5 i686 Mobile Intel(R) Pentium(R) III CPU - M 1200MHz
Timestamp of tree: Fri, 09 May 2008 15:45:01 +0000
app-shells/bash:     3.2_p33
dev-java/java-config: 1.3.7, 2.1.6
dev-lang/python:     2.4.4-r6, 2.5.1-r5
dev-python/pycrypto: 2.0.1-r6
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.24
CFLAGS="-O2 -march=i686 -pipe"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /var/qmail/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=i686 -pipe"
FEATURES="distlocks parallel-fetch sandbox sfperms strict unmerge-orphans userfetch"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
USE="X a52 aac acl acpi alsa apache2 arts avahi bash-completion berkdb cdr chasen cjk cli cracklib crypt cups dbus doc dri dvd emacs encode examples fastcgi ffmpeg flac fortran gdbm gif glitz gnome gpm gtk hal iconv immqt ipod ipv6 isdnlog jpeg kakasi kde mecab midi mmx modperl mozdevelop mp4 mpeg mudflap mysql ncurses nls nptl nptlonly ogg openmp oss pam pcre pdf perl png pppd python qt qt3 qt4 readline real reflection ruby session sound source spl sqlite ssl startup-notification svg symlink tcpd truetype unicode v4l vorbis x264 x86 xorg xscreensaver xvid 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" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd 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 dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="ja" USERLAND="GNU" VIDEO_CARDS="i810"

Comment 33 niki pratt 2008-12-05 02:33:53 UTC
I was trying to emerge avahi and it was failing during the configure portion of the install with the "cant find gtk module" error, so decided to try configuring the package by hand, it turned out that it was actually failing on the next check which was the python dbus check. After emerging dbus-python and monodoc the ./configure worked fine, so tried re-emeging avahi and it worked fine. I am using avahi-0.6.22-r1. Hopefully thats useful to somebody
Comment 34 Jonatan Antoni 2008-12-07 13:09:12 UTC
I solved the issue for avahi-0.6.22-r1 by remerging pygtk first and pycairo afterwards. The DISPLAY seems to be no problem, at least for me. Perhaps it helps out.
Comment 35 Chris Forsyth 2008-12-31 12:05:18 UTC
From what I can tell this is kernel related, and use variables that are used in your make.conf.

I am used "genkernel all", and my make.conf has the following:

use="doc examples tetex opengl cdr glibc Locales dbus gdbmalsa python gnome gdm kde xgl -dli -selinux qt3 -qt3 -arts X hal avahi"

Now I have installed quite a few packages in the mean time from portage, but ultimately speaking I kept receiving the same errors relating with python until I make sure that:

1: I recompiled the kernel with the "genkernel all"
2: Sifted through /etc/init.d, and made a symlink into /etc/runlevels/default for dbus.
3: Rebooted into the new kernel after making sure /boot/grub/grub.conf had the right info in it.

It still have direct rendering, and honestly the installation of packages from portage has become much easier, and seemly faster since the kernel rebuild (of course though! Now I'm not receiving python errors!!).
-- I assume dbus needs to be started as a service. After I got pyGTK to be recognized as a module [installed (without gui)], I started to get the message of dbus-python not being installed as a module, which I found rather odd - regardless I did a few things such as recompiling pygtk, pycairo, cairo, pygobject, dbus-python, dbus, and so fourth.... as well as "genkernel all" before I rebooted.

Figured I could drop in my 2 cents.

genkernel is a nifty lil tool....
Comment 36 Chris Bruner 2009-05-12 15:19:27 UTC
When I emerge pygtk (using python 2.6) it has the message 

 * Unable to establish /usr/lib64/python2.6/site-packages/ symlink
 * Unable to establish /usr/lib64/python2.6/site-packages/pygtk.pth symlink

There are simlinks in the /usr/lib64/python2.5/site-packages/ directory, but the file they simlink to is missing as well.
Comment 37 Colin DuPée 2010-02-24 15:18:36 UTC
I was seeing this as well, and importing gtk in python from the command line was giving me "undefined symbol: PyUnicodeUCS4_DecodeUTF8".

emerging dbus-python seemed like the least likely fix, but it actually fixed the problem where nothing else on this page did.
Comment 38 Pacho Ramos gentoo-dev 2012-11-27 18:18:02 UTC
Is this still valid with avahi-0.6.31?
Comment 39 Anthony Basile gentoo-dev 2012-11-27 20:06:44 UTC
(In reply to comment #38)
> Is this still valid with avahi-0.6.31?

Pacho, I just inherited this and in about one week I'll do a full audit of what's up with avahi.
Comment 40 Anthony Basile gentoo-dev 2013-01-14 12:28:28 UTC
(In reply to comment #39)
> (In reply to comment #38)
> > Is this still valid with avahi-0.6.31?
> Pacho, I just inherited this and in about one week I'll do a full audit of
> what's up with avahi.

I have not been able to reproduce this in even 0.6.30-r3.  The bug is all over the place in terms of what the cause is.  But if we focus on the original issue, that net-dns/avahi won't build w/o X connection (related to pygtk), then I simply can't reproduce it.

Its an old bug dating back to 2006.  I'm going to close it OBSOLETE and invite people to either reopen it, or even just start a fresh report.