Ask Your Question
2

fedora 19 and avaliable static libraries

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

oran gravatar image

I using the following shared libraries:

linux-vdso.so.1
/lib64/librt.so.1
/lib64/libpthread.so.0
/usr/lib64/libdl.so.2
/lib64/libstdc++.so.6
/lib64/libm.so.6 =>
/lib64/libgcc_s.so.1
/lib64/libc.so.6 =>
/lib64/ld-linux-x86-64.so.2

Are the corresponding static libraries available?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

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

You can find libraries like this:

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

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
3

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/libtinfo.so.5 /lib64/libdl.so.2 /lib64/libc.so.6 /lib64/ld-linux-x86-64.so.2

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. http://stackoverflow.com for static linking of glibc.

edit flag offensive delete link more

Comments

I wanted to point out that the Fedora packaging guidelines discourage package maintainers from shipping static libraries: https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Static_Libraries_2

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

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 https://ask.fedoraproject.org/en/question/39951/fedora20static-link-cannot-find-lgcc_s/ 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

Question Tools

Stats

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

Seen: 2,252 times

Last updated: Jan 13 '14