Where is libX11.a ? ... error building static executable
I am trying to build a static executable to run on a chrooted server.
And the program needs the libX11.a library to build. In the older versions of Slackware there used to be a libX11.a file that came with the libX11 package. Now it seems to be gone. Is it hiding somewhere? |
all x11 tree is built with --disable-static configure option, no .a files, you need to do it by yourself
|
Quote:
This is very curious as Slackware used to have this file. The BSD distributions still have this file, but many of the Linux distributions do not. It makes it much harder for me to choose Linux as a server platform. |
Well, the problem would be on the server where you are creating the executable versus where you are running that executable after you create it.
|
Two ways:
Code:
--disable-static \ Code:
/path/to/slackware<your version>/source/x/x11/x11.SlackBuild lib libX11 |
Quote:
1) In this case I am the maintainer in that I changed the program (application) from dynamic to static. I am trying to run an old web /cgi-bin/ program which uses the graphics routines in X11. Since it runs in a chrooted environment the normal run time (shared) libraries are not available. I don't want to have to copy run time libraries to the chroot sandbox every time I update or upgrade Slackware. With a static binary, I create it and leave it and it runs forever. 2) Rebuilding X11 static libraries is not something I expect to have to do with any distribution. Slackware used to contain these static libraries. P.S. I don't belong to the church of Google. |
Quote:
|
Quote:
By the way, can I ask what the purpose of this rant is? I've looked through a few distributions (ebuild for Gentoo, spec file for CentOS/RHEL, even Fedora) and none of them seem to build with --enable-static (which as you said, is confirmed as a default in FreeBSD: http://svnweb.freebsd.org/ports/head...53&view=markup). What's the real reason you care so much about a statically built libX11? If it was VLC or LibreOffice (maybe even MPlayer) I could understand, but when it comes to libX11 I'm not quite sure what you're upset about. All of the Unix-like operating systems I'm currently using have a way to install a package into a separate directory. Quote:
|
These are good questions.
Quote:
Quote:
|
You could also bind mount the dynamic libs into the chroot I guess
|
I found that Suse Enterprise offers libX11.a in a "developer" package.
https://www.suse.com/LinuxPackages/p...1-libx11-devel Besides FreeBSD, OpenBSD also has a libX11.a and my program builds fine on these environments. I'm going to try and rebuild the libX11, libXau, and libXdmcp packages from source. So I will modify the package configure/configure and configure/libX11 files and remove the --disable-static parameters and then build the three packages. |
I was finally able to build a static binary by creating some x11 static libraries.
But first here is the LIBS used in the makefile for my program: Code:
LIBS = -static -lm -L/usr/X11R6/lib64 -lX11 -lxcb -lpthread -lXau -lXdmcp -ldl Inside the x11 source package directory configure/configure was changed to remove "--disable-static" Inside the x11 source package directory configure/libX11 was changed to remove "--disable-static" and add "--disable-loadable-xcursor" To build the new packages these commands were run Code:
#sh x11.SlackBuild lib libX11 The program now builds with warnings but runs cleanly. Without the "--disable-loadable-cursor" parameter of the libX11 build, the program runs ok but dies badly when doing a normal exit. It appears to be crashing somewhere in the libX11 CrGlCur.c code thus the "--disable-loadable-xcursor" option. |
Debian wheezy appears to have a developer package for libX11 too:
https://packages.debian.org/wheezy/libx11-dev Here is the list of files for amd64 including libX11.a https://packages.debian.org/wheezy/a...1-dev/filelist |
Using some static lib from another distro is not really a proper solution.
|
Quote:
Like Slackware, Debian does not distribute static libraries with a normal install. But the Debian package, libx11-dev, does provide the static libraries for developers like me. Slackware does not have such a package. My ultimate solution for Slackware was to take the x11 source package build and modify all of the config/ directory files to remove all of the "--disable-static" parameters. I left everything else alone and just rebuilt everything for x11. Then I updated all of my x11 packages. It works fine. I now have all the static libraries I need as well as the dynamic libraries. Maybe some day Slackware can provide a libx11-dev package like Debian? |
Quote:
|
I created a script to build the 4 static x11 libraries from the Slackware source code. I called it make-x11-static.
Code:
#! /bin/sh |
Quote:
While installing Slackware 11.0 (2006) on an old machine, I found a package called x11-devel containing the missing libX11.a file and other .a files. Quote:
the UGRADE.TXT: Code:
*** PACKAGE REMOVALS SINCE 11.0 *** |
Quote:
Were you successful obtaining the static libs, and linking into your program by now? I guess you were. So this is a request to have to already packaged for you? How large are the .a files you need? |
Quote:
Slackware has a policy of not using or providing static libraries unless software can not be compiled without the static library. This allows for easier upgrades of individual packages without requiring that all other packages which used a static library component have to be recompiled as well. Moreso, it saves space on the Slackware media when only shipping the shared libraries. A static libX11.a is not going to re-appear in Slackware. And you already found your solution by compiling the static library yourself. |
Quote:
Quote:
Alien Bob and others object to having an x11-devel package as part of the standard release because it can introduce static library dependencies between packages. I don't disagree with this. But other distributions get around this problem by supplying the x11-devel (libX11-devel) packages as optional and extra, not part of a standard release. Slackware could have an x11-devel package in the /extra release directory just for developers. Quote:
|
Quote:
Glad you figured out how to build them. IMHO, this should be marked solved. |
x11-devel.SlackBuild
I have created a replacement for my kludge above called x11-devel.SlackBuild.
http://sourceforge.net/projects/slac...ckbuild/files/ This was made from the existing x11.SlackBuild script. It writes all output packages and modified configuration files to the /tmp/x11-devel/ directory. It should leave the original x11 source files/scripts/configuration untouched. It builds multiple x11-devel packages. Use the script with Slackware 14.1 or newer by placing it in the source/x/x11 directory. Then to build and install all available x11 static libraries, run these 3 commands: #./x11-devel.SlackBuild xcb #./x11-devel.SlackBuild lib #./x11-devel.SlackBuild app compiz The created package files are put in the /tmp/x11-devel directory. To create the packages without installation, run the scripts like this: #UPGRADE_PACKAGES=no ./x11-devel.SlackBuild xcb #UPGRADE_PACKAGES=no ./x11-devel.SlackBuild lib #UPGRADE_PACKAGES=no ./x11-devel.SlackBuild app compiz |
README for x11-devel.SlackBuild
Here is the updated README for x11-devel.SlackBuild 1.1:
2018-05-18 x11-devel.SlackBuild 1.1 The Slackware x11-devel.SlackBuild script can create static libraries for use with the X Window system. Use the script with Slackware 14.1 or newer by placing it in the source/x/x11 directory. Then to build and install all available x11 static libraries, run these 3 commands: #./x11-devel.SlackBuild xcb #./x11-devel.SlackBuild lib #./x11-devel.SlackBuild app compiz The created package files are put in the /tmp/x11-devel directory. To create the packages without installation, run the scripts like this: #UPGRADE_PACKAGES=no ./x11-devel.SlackBuild xcb #UPGRADE_PACKAGES=no ./x11-devel.SlackBuild lib #UPGRADE_PACKAGES=no ./x11-devel.SlackBuild app compiz 47 packages are created: (When all installed they use less than 11 megabytes of disk) x11-devel-compiz-0.8.8-x86_64-2.txz x11-devel-libFS-1.0.6-x86_64-1.txz x11-devel-libICE-1.0.9-x86_64-1.txz x11-devel-libSM-1.2.2-x86_64-1.txz x11-devel-libX11-1.6.3-x86_64-1.txz x11-devel-libXScrnSaver-1.2.2-x86_64-1.txz x11-devel-libXau-1.0.8-x86_64-1.txz x11-devel-libXaw-1.0.12-x86_64-1.txz x11-devel-libXaw3d-1.6.2-x86_64-2.txz x11-devel-libXcomposite-0.4.4-x86_64-1.txz x11-devel-libXcursor-1.1.14-x86_64-1.txz x11-devel-libXdamage-1.1.4-x86_64-1.txz x11-devel-libXdmcp-1.1.2-x86_64-1.txz x11-devel-libXevie-1.0.3-x86_64-1.txz x11-devel-libXext-1.3.3-x86_64-1.txz x11-devel-libXfixes-5.0.1-x86_64-1.txz x11-devel-libXfont-1.5.1-x86_64-1.txz x11-devel-libXfontcache-1.0.5-x86_64-1.txz x11-devel-libXft-2.3.2-x86_64-2.txz x11-devel-libXi-1.7.4-x86_64-1.txz x11-devel-libXinerama-1.1.3-x86_64-1.txz x11-devel-libXmu-1.1.2-x86_64-1.txz x11-devel-libXp-1.0.3-x86_64-1.txz x11-devel-libXpm-3.5.11-x86_64-1.txz x11-devel-libXrandr-1.4.2-x86_64-1.txz x11-devel-libXrender-0.9.8-x86_64-1.txz x11-devel-libXres-1.0.7-x86_64-1.txz x11-devel-libXt-1.1.4-x86_64-1.txz x11-devel-libXtst-1.2.2-x86_64-1.txz x11-devel-libXv-1.0.10-x86_64-1.txz x11-devel-libXvMC-1.0.9-x86_64-1.txz x11-devel-libXxf86dga-1.1.4-x86_64-1.txz x11-devel-libXxf86misc-1.0.3-x86_64-1.txz x11-devel-libXxf86vm-1.1.4-x86_64-1.txz x11-devel-libdmx-1.1.3-x86_64-1.txz x11-devel-libfontenc-1.1.2-x86_64-1.txz x11-devel-libpciaccess-0.13.3-x86_64-1.txz x11-devel-libxcb-1.11-x86_64-1.txz x11-devel-libxkbfile-1.0.8-x86_64-1.txz x11-devel-libxshmfence-1.2-x86_64-1.txz x11-devel-pixman-0.32.6-x86_64-1.txz x11-devel-xcb-util-0.4.0-x86_64-1.txz x11-devel-xcb-util-cursor-0.1.2-x86_64-1.txz x11-devel-xcb-util-image-0.4.0-x86_64-1.txz x11-devel-xcb-util-keysyms-0.4.0-x86_64-1.txz x11-devel-xcb-util-renderutil-0.3.9-x86_64-1.txz x11-devel-xcb-util-wm-0.4.1-x86_64-1.txz ------------------------------------------------------------------------- Changelog: 2015-05-14 version 1.0 * Copy/modify x11.SlackBuild 2015-05-18 version 1.1 * include only libraries (*.a) in each package 2015-05-24 * Update this README |
All times are GMT -5. The time now is 08:48 PM. |