1

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

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.

  • THANK YOU. That's exactly what I needed! – Dickster Jun 24 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.