Ask Your Question

fedora 19 and avaliable static libraries

asked 2014-01-02 10:52:25 -0500

oran gravatar image

I using the following shared libraries:
/lib64/ =>
/lib64/ =>

Are the corresponding static libraries available?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-01-04 08:54:21 -0500

marcindulak gravatar image

updated 2014-01-13 02:08:02 -0500

You can use repoquery --whatprovides. Based on the so.* filenames provide guess for the .a library names. Note that repoquery --whatprovides, while searching for a library files, requires full path as an argument, e.g. repoquery --whatprovides /usr/lib64/librt.a returns glibc-static, but repoquery --whatprovides /lib64/librt.a does not work, so check for both /lib*.a (there may be some) and /usr/lib.*a candidates. Example for sh:

SO=`ldd /usr/bin/sh | cut -d ">" -f2 | cut -d"(" -f 1`

echo $SO
# result: /lib64/ /lib64/ /lib64/ /lib64/

A=$(for f in $SO; do a=`echo $f | sed 's/.so.*/.a/'`; echo $a; echo $a | sed 's#/lib#/usr/lib#'; done)

echo $A
# result: /lib64/libtinfo.a /usr/lib64/libtinfo.a /lib64/libdl.a /usr/lib64/libdl.a /lib64/libc.a /usr/lib64/libc.a /lib64/ld-linux-x86-64.a /usr/lib64/ld-linux-x86-64.a

for f in $A; do repoquery --whatprovides $f; done | LC_ALL=C sort | uniq
# or if you want to print information which package provides given .a
for f in `echo $A | LC_ALL=C sort | uniq`; do repoquery --whatprovides $f | xargs -I PKG sh -c "echo -n PKG:; repoquery --list PKG | grep $f"; done

# result:
# ncurses-static-0:5.9-12.20130511.fc20.x86_64:/usr/lib64/libtinfo.a
# glibc-static-0:2.18-11.fc20.x86_64:/usr/lib64/libdl.a
# glibc-static-0:2.18-11.fc20.x86_64:/usr/lib64/libc.a

In your case you need to link statically glibc (install yum install glibc-static). Search e.g. for static linking of glibc.

edit flag offensive delete link more


I wanted to point out that the Fedora packaging guidelines discourage package maintainers from shipping static libraries:

FranciscoD_ gravatar imageFranciscoD_ ( 2014-01-13 20:32:00 -0500 )edit

I would also start to worry about licenses.

If software is protected by GPL, then you must release your own software as GPL if you ship with statically linked libraries.

hmaarrfk gravatar imagehmaarrfk ( 2014-01-14 00:10:47 -0500 )edit

I have learned from that one can use glob in yum provides, e.g. : yum provides */libc.a, or more explicit yum provides /usr/lib64/libc.a, the latter has a very similar functionality to repoquery --whatprovides /usr/lib64/libc.a

marcindulak gravatar imagemarcindulak ( 2014-02-01 09:00:42 -0500 )edit

answered 2014-01-02 22:31:25 -0500

You can find libraries like this:

$ yum provides
Loaded plugins: langpacks, refresh-packagekit
glibc-2.18.90-18.fc21.i686 : The GNU libc libraries
Repo        : fedora
Matched from:
Provides    :

I don't know of a way to find out if a specific file is available from the Fedora repos without actually installing Fedora, though.

edit flag offensive delete link more

Question Tools


Asked: 2014-01-02 10:52:25 -0500

Seen: 2,251 times

Last updated: Jan 13 '14