4 ms·
Worked for me (glibc 2.40)! I'm honestly surprised (and impressed). Every time I've tried to statically compile a major glib project like X11, the answer the i
by apitman 2y ago
Worked for me (glibc 2.40)! I'm honestly surprised (and impressed).
Every time I've tried to statically compile a major glib project like X11, the answer the internet has given back is "don't do it".
In terms of practicality, what would the runtime requirements of this be? Obviously compatible glibc, but also compatible X api? Though I'm assuming that hasn't changed much in years.
- kragen 2y agothank you! i very much appreciate the information the x11 library doesn't use glib; maybe you meant 'a major glib project like gtk' this binary requires neither compatible glibc nor compatible x api, because it's statically linked. (i just tried it in a chroot with neither glibc nor any x api installed.) it does require a compatible x protocol, including, in particular, the shared memory extension, and yeso also (rather nonportably) assumes that the server's pixel format is 32-bit bgra (i.e. little-endian argb, with the blue byte first). so it won't work over a network (but works fine talking to a local vnc server which can then talk over the network), it won't work in a 16-bit video mode (unless you interpose vnc or something), it won't work in a paletted video mode (ditto), and it won't work in a monochrome video mode. but i don't think it will have any software incompatibilities with any x-windows server from the last 30 years or so the procedure for setting up the testing chroot was to build a static μpaint as above, install the debian `bash-static` package, and: : yeso; mkdir chroot : yeso; cp μpaint /bin/bash-static ~/.Xauthority chroot/. : yeso; XAUTHORITY=/.Xauthority sudo chroot chroot /bash-static bash-static-5.2# it's really a very bare chroot, with very little of the usual unix amenities: bash-static-5.2# ls bash-static: ls: command not found bash-static-5.2# echo * bash-static μpaint bash-static-5.2# echo /* /bash-static /μpaint bash-static-5.2# echo /.* /.Xauthority bash-static-5.2# cd .. # this does nothing bash-static-5.2# echo * bash-static μpaint bash-static-5.2# ./\316\274paint # bash defaults to not supporting utf-8 at this point the program opens a window and i can run it, painting in the window with the mouse, until i close the window X connection to :0.0 broken (explicit kill or server shutdown). bash-static-5.2# echo $DISPLAY :0.0 bash-static-5.2# exit : chroot; this suggests that in fact it does not use getaddrinfo() or dlopen(), for which the linker warned me it would need to have the corresponding glibc version installed at runtime; as you can see, no glibc version at all was installed at runtime, nor any /etc, /dev, /proc, /bin, /usr, or /home. just three files it took me a while to figure out how to get it to find the xauth file correctly; it doesn't use $HOME or /etc/passwd