LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-16-2014, 04:32 PM   #1
aaazen
Member
 
Registered: Dec 2009
Posts: 358

Rep: Reputation: Disabled
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?
 
Old 03-16-2014, 04:39 PM   #2
gengisdave
Member
 
Registered: Dec 2013
Location: Turin, Italy
Distribution: slackware
Posts: 328

Rep: Reputation: 74
all x11 tree is built with --disable-static configure option, no .a files, you need to do it by yourself
 
1 members found this post helpful.
Old 03-16-2014, 05:46 PM   #3
aaazen
Member
 
Registered: Dec 2009
Posts: 358

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by gengisdave View Post
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.
 
Old 03-16-2014, 08:24 PM   #4
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
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.
 
Old 03-17-2014, 02:17 AM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
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.

Last edited by Didier Spaier; 03-17-2014 at 02:21 AM.
 
1 members found this post helpful.
Old 03-17-2014, 06:41 PM   #6
aaazen
Member
 
Registered: Dec 2009
Posts: 358

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Didier Spaier View Post
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.

Last edited by aaazen; 03-17-2014 at 06:46 PM. Reason: make bold: Slackware used contain static binaries
 
Old 03-17-2014, 07:49 PM   #7
55020
Senior Member
 
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 1,307
Blog Entries: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by comet.berkeley View Post
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?
 
1 members found this post helpful.
Old 03-17-2014, 09:48 PM   #8
TommyC7
Member
 
Registered: Mar 2012
Distribution: Slackware, CentOS, OpenBSD, FreeBSD
Posts: 530

Rep: Reputation: Disabled
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.

Last edited by TommyC7; 03-18-2014 at 12:21 AM.
 
Old 03-18-2014, 01:19 AM   #9
aaazen
Member
 
Registered: Dec 2009
Posts: 358

Original Poster
Rep: Reputation: Disabled
These are good questions.

Quote:
Originally Posted by 55020 View Post
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 View Post
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.
 
Old 03-18-2014, 09:52 AM   #10
NeoMetal
Member
 
Registered: Aug 2004
Location: MD
Distribution: Slackware
Posts: 114

Rep: Reputation: 24
You could also bind mount the dynamic libs into the chroot I guess

Last edited by NeoMetal; 03-18-2014 at 09:53 AM.
 
Old 03-19-2014, 03:53 PM   #11
aaazen
Member
 
Registered: Dec 2009
Posts: 358

Original Poster
Rep: Reputation: Disabled
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.
 
Old 03-19-2014, 07:56 PM   #12
aaazen
Member
 
Registered: Dec 2009
Posts: 358

Original Poster
Rep: Reputation: Disabled
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.

Last edited by aaazen; 03-19-2014 at 07:58 PM. Reason: spelling
 
Old 03-19-2014, 08:29 PM   #13
aaazen
Member
 
Registered: Dec 2009
Posts: 358

Original Poster
Rep: Reputation: Disabled
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
 
Old 03-20-2014, 03:58 AM   #14
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Using some static lib from another distro is not really a proper solution.
 
Old 03-21-2014, 05:32 AM   #15
aaazen
Member
 
Registered: Dec 2009
Posts: 358

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by gnashley View Post
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?

Last edited by aaazen; 03-24-2014 at 10:44 AM. Reason: change font
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
install libX11 error! (xproto) totallybored Linux - Software 7 12-10-2019 05:02 PM
error in libX11 in blfs ankit0301 Linux From Scratch 26 05-02-2012 12:36 AM
error: *** libX11 not found. when installing GTK+-2.18.7 Prisp Linux - Newbie 4 02-23-2010 08:39 AM
KDevelop Executable->static link library lucky6969b Programming 1 02-13-2006 04:01 PM
Building executable for RH Ent 3 smallest Programming 1 06-09-2005 01:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration