[SOLVED] No bzip2-static package?

Issues related to applications and software problems
Post Reply
jake1138
Posts: 11
Joined: 2015/04/16 23:41:51

[SOLVED] No bzip2-static package?

Post by jake1138 » 2015/04/16 23:52:36

I need libbz2.a to compile something statically. I was able to hunt down the static packages for other libraries I need (dw,dl,elf,z,c) but I cannot find a static package for bz2. Doing "yum provides "*libbz2.a" reports no matches found. Does anyone know where I can find it? Or can I grab the source and compile my own libbz2.a? How would I go about doing that? Any help is much appreciated.

CentOS Linux release 7.0.1406 (Core)

Packages Installed (none provide libbz2.a):
bzip2-1.0.6-12.el7.x86_64
bzip2-devel-1.0.6-12.el7.x86_64
bzip2-libs-1.0.6-12.el7.x86_64
Last edited by jake1138 on 2015/04/23 22:16:57, edited 2 times in total.

scottro
Forum Moderator
Posts: 2555
Joined: 2007/09/03 21:18:09
Location: NYC
Contact:

Re: No bzip2-static package?

Post by scottro » 2015/04/17 01:58:33

I haven't looked with CentOS-7, but are you familiar with yum provides? It can let you know what package would included the needed library


http://srobb.net/yumprovides.html


Anyway, the command would be


yum provides */libbz2.a


And see if you get a result.
New users should check the FAQ and Read Me First pages

jake1138
Posts: 11
Joined: 2015/04/16 23:41:51

Re: No bzip2-static package?

Post by jake1138 » 2015/04/17 17:55:37

I already did that (as mentioned in my post). In fact, taking it a step further, I grabbed the RPM source and saw this in the spec file's changelog:

* Tue Mar 17 2009 Ivana Varekova <varekova@redhat.com> 1.0.5-5
- remove static library

Why they removed it is beyond me. It is necessary for a package that I want to compile statically. Like I said before, every other library that I need has the static library available except for bzip2. It seems like a pretty stupid decision to not at least provide a static version of the library. I also found a related bug report (Bug 530766) and they just flatly state "static libraries are removed". No explanation at all.

But that is just me complaining about a (seemingly) stupid decision someone at RedHat made. What is important to me right now is finding a way to create a libbz2.a that I can use to complete my goal. If anyone has some insights on how to do that, please let me know. I'll keep plugging at it in the meantime. Thanks.

scottro
Forum Moderator
Posts: 2555
Joined: 2007/09/03 21:18:09
Location: NYC
Contact:

Re: No bzip2-static package?

Post by scottro » 2015/04/17 20:11:00

Sorry you did mention you'd tried that, and I missed it. It doesn't seem to be available in CentOS-6.x either.

About all you can do is file a bugzilla request, which will probably be ignored by RedHat but only takes a few minutes to do.
New users should check the FAQ and Read Me First pages

giulix63
Posts: 1305
Joined: 2014/05/14 10:06:37
Location: UK

Re: No bzip2-static package?

Post by giulix63 » 2015/04/18 09:43:26

jake1138 wrote: What is important to me right now is finding a way to create a libbz2.a that I can use to complete my goal. If anyone has some insights on how to do that, please let me know. I'll keep plugging at it in the meantime. Thanks.
That's easy because the Makefile still knows how to build the static library:

Code: Select all

mkdir libbz2_TEMP && cd libbz2_TEMP
yumdownloader --source bzip2-devel
rpm2cpio bzip2-1.0.6-12.el7.src.rpm |cpio -idv
patch -p0 < bzip2-1.0.4-saneso.patch
patch -p0 < bzip2-1.0.4-cflags.patch
cd bzip2-1.0.6
patch -p1 < ../bzip2-1.0.4-bzip2recover.patch
make libbz2.a
Run all above commands as your normal unprivileged user, not as root.

You need to have Development Tools and yum-utils installed

Code: Select all

yum groupinstall "Development Tools"
yum install yum-utils
these two you have to run as root.

P.S. You may have a point in opening that bugzilla request, since the static library may be useful to package self-extracting software and such, but this is an exception.
Root is evil: Do not use root (sudo) to run any of the commands specified in my posts unless explicitly indicated. Please, provide the necessary amount of context to understand your problem/question.

jake1138
Posts: 11
Joined: 2015/04/16 23:41:51

Re: No bzip2-static package?

Post by jake1138 » 2015/04/21 22:01:02

Thanks for the reply. Before I read this, I ended up creating the .a manually from the .o files using the ar rcs libbz2.a *.o command in the /home/centos/rpmbuild/BUILD/bzip2-1.0.6 directory after having downloaded and installed the source RPM and built the spec file. Your method is a lot easier. Here is the full command order (you were missing the extraction of the tarball):

Code: Select all

mkdir libbz2_TEMP && cd libbz2_TEMP
yumdownloader --source bzip2-devel
rpm2cpio bzip2-1.0.6-12.el7.src.rpm |cpio -idv
tar xf bzip2-1.0.6.tar.gz
patch -p0 < bzip2-1.0.4-saneso.patch
patch -p0 < bzip2-1.0.4-cflags.patch
cd bzip2-1.0.6
patch -p1 < ../bzip2-1.0.4-bzip2recover.patch
make libbz2.a
This static library works but I ran into an issue with another library but I'll make a new post for that.

Post Reply