Subject: Re: bug#15392: xorg-server FTBFS

From: Andreas Enge <[email-masked]>
Date: Sun, 22 Sep 2013 11:01:12 +0200

On Sat, Sep 21, 2013 at 10:02:03PM +0200, Ludovic Courtès wrote:
> Looking at configure.ac, I think you have to do just that.  Then you can
> check the value of XKB_BASE_DIRECTORY in config.log, to make sure
> everything’s right.

I checked this already before, the attached header file looks good
(maybe not XKM_OUTPUT_DIR in the long run, but I thought that for the
tests that should be fine). Wait, could this be a typo in the build system?
One would rather expect XKB_OUTPUT_DIR with a B instead of an M.

Running xtest outside of the chroot of the guix build system, there is an
error message that xkbcomp does not find the file evdev, which is part of
the xkeyboard-config package. So I added a configure flag
       (list (string-append "--with-xkb-config-root="
                            (assoc-ref %build-inputs "xkeyboard-config")
                            "/share/X11/xkb"))))
to xkbcomp. Now xkeyboard-config needs xkbcomp, so I added an additional
package xkbcomp-tmp to build xkeyboard-config, then the final xkbcomp can
use xkeyboard-config as an input. See the attached patch.

>From guix, the tests fail with the same error message as before.

When I become root outside the chroot, source the environment variables and
run ./xtest, the tests succeed. The strace output ends like this:
open("/nix/store/hylfnc1nxg7b8rgnz5iyh0xpszkikaf0-xkeyboard-config-2.6/share/X11/xkb/rules/evdev", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=39508, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7feab8a26000
read(3, "// DO NOT EDIT THIS FILE - IT WA"..., 4096) = 4096
read(3, "\n  $azerty       =       +aliase"..., 4096) = 4096
read(3, "pl_altquotes)\t\t\t=\tpc+pl(dvorak_a"..., 4096) = 4096
read(3, "v[1])\n  *\t\tkan\t\t\t=\tpc+in(kan)\n  "..., 4096) = 4096
read(3, "\tro\t\tacademic\t\t=\tpc+ro(std)\n  *\t"..., 4096) = 4096
read(3, "_probhat):3\n  *\t\tdev(basic)\t=\t+i"..., 4096) = 4096
brk(0x1f3e000)                          = 0x1f3e000
read(3, "4\n  *\t\tyu(unicode)\t=\t+srp(latinu"..., 4096) = 4096
read(3, "s):4\n  *\t\tdzdwi\t\tbasic\t=\t+bt(bas"..., 4096) = 4096
read(3, "ft_caps_toggle)\n  grp:shift_caps"..., 4096) = 4096
read(3, "pdl:momayyezoss      =\t+kpdl(mom"..., 4096) = 2644
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x7feab8a26000, 4096)            = 0
brk(0x1f0d000)                          = 0x1f0d000
brk(0x1f0c000)                          = 0x1f0c000
access("/tmp/", W_OK|X_OK)              = 0
pipe([3, 4])                            = 0
rt_sigaction(SIGALRM, {SIG_IGN, [], SA_RESTORER, 0x7feab7e1c350}, {SIG_DFL, [], 0}, 8) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7feab8a27b50) = 24792
rt_sigprocmask(SIG_BLOCK, [ALRM CHLD TSTP TTIN TTOU VTALRM WINCH IO], [], 8) = 0
fcntl(4, F_GETFL)                       = 0x1 (flags O_WRONLY)
fstat(4, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7feab8a26000
lseek(4, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
close(3)                                = 0
write(4, "xkb_keymap \"default\" {\n    xkb_k"..., 314) = 314
close(4)                                = 0
munmap(0x7feab8a26000, 4096)            = 0
wait4(24792, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 24792
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
access("/tmp/", W_OK|X_OK)              = 0
open("/tmp/server-(null).xkm", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=11248, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7feab8a26000
read(3, "\17mkx\26\10\377\7\177\0\0\0\6\0\1\0\214\0D\0\4\0\1\0\f\5\320\0\0\0\1\0"..., 4096) = 4096
lseek(3, 0, SEEK_SET)                   = 0
read(3, "\17mkx\26\10\377\7\177\0\0\0\6\0\1\0\214\0D\0\4\0\1\0\f\5\320\0\0\0\1\0"..., 4096) = 4096
lseek(3, 4096, SEEK_SET)                = 4096
lseek(3, 4096, SEEK_SET)                = 4096
lseek(3, 4096, SEEK_SET)                = 4096
read(3, "\n\376\0\0\377\201\t\0\6\0\377\0\0\0\0\0\f\376\0\0\377\1\377\0\6\4\0\0\0\0\0\0"..., 4096) = 4096
lseek(3, 8192, SEEK_SET)                = 8192
read(3, "\1\1\0\0V\377\10\20\0\0\0\0\0\0\0\0\1\1\0\0x\377\10\20\1\1\0\0y\377\10\20"..., 4096) = 3056
lseek(3, 11248, SEEK_SET)               = 11248
lseek(3, 11248, SEEK_SET)               = 11248
close(3)                                = 0
munmap(0x7feab8a26000, 4096)            = 0
unlink("/tmp/server-(null).xkm")        = 0
exit_group(0)                           = ?

So it looks like XKM is the right prefix in the header file, since a file
named /tmp/server-(null).xkm is used.

Andreas

diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 9a0e3e2..4ac8acc 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -3109,9 +3109,9 @@ tracking.")
     (license license:x11)))

-(define-public xkbcomp
+(define xkbcomp-tmp ; used as input for xkeyboard-config
   (package
-    (name "xkbcomp")
+    (name "xkbcomp-tmp")
     (version "1.2.4")
     (source
       (origin
@@ -3134,6 +3134,37 @@ tracking.")
     (description "X.org provides an implementation of the X Window System")
     (license license:x11)))
 
+(define-public xkbcomp ; using xkeyboard-config as input
+  (package
+    (name "xkbcomp")
+    (version "1.2.4")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append
+               "mirror://xorg/X11R7.7/src/everything/xkbcomp-"
+               version
+               ".tar.bz2"))
+        (sha256
+          (base32
+            "0bas1d2wjiy5zy9d0g92d2p9pwv4aapfbfidi7hxy8ax8jmwkl4i"))))
+    (build-system gnu-build-system)
+    (inputs
+      `(("xproto" ,xproto)
+        ("libxkbfile" ,libxkbfile)
+        ("libx11" ,libx11)
+        ("pkg-config" ,pkg-config)
+        ("xkeyboard-config" ,xkeyboard-config)))
+    (arguments
+     `(#:configure-flags
+       (list (string-append "--with-xkb-config-root="
+                            (assoc-ref %build-inputs "xkeyboard-config")
+                            "/share/X11/xkb"))))
+    (home-page "http://www.x.org/wiki/")
+    (synopsis "xorg implementation of the X Window System")
+    (description "X.org provides an implementation of the X Window System")
+    (license license:x11)))
+
 
 (define-public xkbevd
   (package
@@ -3207,7 +3238,7 @@ tracking.")
         ("intltool" ,intltool)
         ("libx11" ,libx11)
         ("pkg-config" ,pkg-config)
-        ("xkbcomp" ,xkbcomp)))
+        ("xkbcomp-tmp" ,xkbcomp-tmp)))
     (home-page "http://www.x.org/wiki/")
     (synopsis "xorg implementation of the X Window System")
     (description "X.org provides an implementation of the X Window System")
@@ -4279,10 +4310,23 @@ emulation to complete hardware acceleration for modern GPUs.")
         ("xf86dgaproto" ,xf86dgaproto)
         ("xf86driproto" ,xf86driproto)
         ("xf86vidmodeproto" ,xf86vidmodeproto)
-;;        ("xkbutils" ,xkbutils)
-;;        ("xkeyboard-config" ,xkeyboard-config)
-        ("xtrans" ,xtrans)
-        ("zlib" ,zlib)))
+("setxkbmap" ,setxkbmap)
+("xkbcomp" ,xkbcomp)
+("xkbevd" ,xkbevd)
+("xkbutils" ,xkbutils)
+("xkeyboard-config" ,xkeyboard-config)
+       ("xtrans" ,xtrans)
+       ("zlib" ,zlib)))
+    (arguments
+     `(#:configure-flags
+       (list (string-append "--with-xkb-path="
+                            (assoc-ref %build-inputs "xkeyboard-config")
+                            "/share/X11/xkb")
+             (string-append "--with-xkb-output="
+                            "/tmp")
+             (string-append "--with-xkb-bin-directory="
+                            (assoc-ref %build-inputs "xkbcomp")
+                            "/bin"))))
     (home-page "http://www.x.org/wiki/")
     (synopsis "xorg implementation of the X Window System")
     (description "X.org provides an implementation of the X Window System")