2

I've been trying to determine if my Ubuntu (linux) system has -static libraries. When would they be located, and what suffix would identify them?

1 Answer 1

2

On debian-derived systems like Ubuntu, the static libraries that come with the system (installed by apt/dpkg, not by hand) usually go in /usr/lib/<target-triplet>/ and have the suffix .a.

Example, on my x86-64 debian system:

$ ls /usr/lib/x86_64-linux-gnu/*.a /usr/lib/x86_64-linux-gnu/libBrokenLocale.a /usr/lib/x86_64-linux-gnu/libFS.a /usr/lib/x86_64-linux-gnu/libGLU.a /usr/lib/x86_64-linux-gnu/libICE.a /usr/lib/x86_64-linux-gnu/libImlib2.a ... 

apt-get install <package>-dev will usually install such libraries in addition to the dynamic *.so ones.

There are still packages which install their libraries directly under /usr/lib though, eg. libgraphicsmagick1-dev.

Compilers like gcc and clang will also install some "internal" libraries (libstdc++, etc) under /usr/lib/<compiler-name>/..., eg:

/usr/lib/gcc/x86_64-linux-gnu/6.3.0/libgcc.a 

Other distros may follow different conventions; for instance, in rhel/centos, all the development libraries go under /usr/lib64/ or /usr/lib32/ and they're provided by <package>-devel-*. Compiling a file with gcc -v will always tell you where exactly the compiler is looking for libraries, whether static or dynamic.

1
  • THANK YOU. That's exactly what I needed! Commented Jun 24, 2019 at 16:40

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.