LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Where is libX11.a ? ... error building static executable (http://www.linuxquestions.org/questions/slackware-14/where-is-libx11-a-error-building-static-executable-4175498419/)

comet.berkeley 03-16-2014 04:32 PM

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?

gengisdave 03-16-2014 04:39 PM

all x11 tree is built with --disable-static configure option, no .a files, you need to do it by yourself

comet.berkeley 03-16-2014 05:46 PM

Quote:

Originally Posted by gengisdave (Post 5135751)
all x11 tree is built with --disable-static configure option, no .a files, you need to do it by yourself

Thanks.

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.

Richard Cranium 03-16-2014 08:24 PM

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.

Didier Spaier 03-17-2014 02:17 AM

Two ways:
  1. (have the maintainer) Fix the application you compile so it requests the shared library instead of the static one.
  2. Re-build libX11 enabling building of static libraries.
To follow way #2, remove the line
Code:

  --disable-static \
in /path/to/slackware<your version>/source/x/x11/configure/libX11, then run
Code:

/path/to/slackware<your version>/source/x/x11/x11.SlackBuild  lib libX11
PS Google told me that many distributions don't ship static libraries for libX11 and that recommended way is #1.

comet.berkeley 03-17-2014 06:41 PM

Quote:

Originally Posted by Didier Spaier (Post 5135924)
Two ways:
  1. (have the maintainer) Fix the application you compile so it requests the shared library instead of the static one.
  2. Re-build libX11 enabling building of static libraries.
To follow way #2, remove the line
Code:

  --disable-static \
in /path/to/slackware<your version>/source/x/x11/configure/libX11, then run
Code:

/path/to/slackware<your version>/source/x/x11/x11.SlackBuild  lib libX11
PS Google told me that many distributions don't ship static libraries for libX11 and that recommended way is #1.

Thanks Didier.

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.

55020 03-17-2014 07:49 PM

Quote:

Originally Posted by comet.berkeley (Post 5136388)
I don't want to have to copy run time libraries to the chroot sandbox every time I update or upgrade Slackware.

Mmm-hmm. And so you won't get the security fixes ("X Security: It's worse than it looks") that come with a new xorg. Mmm-hmm. So, if an xorg CVE turns up in April, everyone's stuff gets patched except yours. Mmm-hmm. So, uh, why do you want a chroot environment again? so that the Syrian Electronic Army hopefully won't trash too much when you get pwned?

TommyC7 03-17-2014 09:48 PM

Quote:

comet.berkeley:
I don't want to have to copy run time libraries to the chroot sandbox every time I update or upgrade Slackware.
No need for that. You can simply use installpkg's "--root" option and point it to your chroot.

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:

P.S. I don't belong to the church of Google.
I think he meant that it could be found via any search engine, Google just happens to be the most common.

comet.berkeley 03-18-2014 01:19 AM

These are good questions.

Quote:

Originally Posted by 55020 (Post 5136417)
Mmm-hmm. And so you won't get the security fixes ("X Security: It's worse than it looks") that come with a new xorg. Mmm-hmm. So, if an xorg CVE turns up in April, everyone's stuff gets patched except yours.

I'm not actually running full blown Xorg in the chroot environment. But if a relevant CVE or other bug turns up then I expect to recompile my static program and copy this single file back into my chroot environment.

Quote:

Originally Posted by 55020 (Post 5136417)
Mmm-hmm. So, uh, why do you want a chroot environment again? so that the Syrian Electronic Army hopefully won't trash too much when you get pwned?

Yes, OpenBSD Apache is automatically configured with chroot and it is a good security practice for web servers. Chroot or jail or virtual machine are all better choices than doing nothing.

NeoMetal 03-18-2014 09:52 AM

You could also bind mount the dynamic libs into the chroot I guess

comet.berkeley 03-19-2014 03:53 PM

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.

comet.berkeley 03-19-2014 07:56 PM

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
I rebuilt libX11, libXau, libXdmcp and libxcb to create static libraries.

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
#sh x11.SlackBuild lib libXau
#sh x11.SlackBuild lib libXdmcp
#sh x11.SlackBuild xcb libxcb

The build puts the packages in /tmp/x11-build. The old packages were removed and the new packages installed.

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.

comet.berkeley 03-19-2014 08:29 PM

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

gnashley 03-20-2014 03:58 AM

Using some static lib from another distro is not really a proper solution.

comet.berkeley 03-21-2014 05:32 AM

Quote:

Originally Posted by gnashley (Post 5137920)
Using some static lib from another distro is not really a proper solution.

True. What I did do though is install Debian on a spare partition. Then I was able to verify that my program would indeed compile there.

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?


All times are GMT -5. The time now is 05:51 PM.