Software⏱️ 3 min read📅 2026-06-19

How to Fix: error linking ffmpeg library

Error linking ffmpeg library on Ubuntu 11.04 64-bit, relocation R_X86_64_PC32 against symbol `ff_cos_32' can not be used when making a shared object.

Quick Answer: Recompile with -fPIC flag to fix the issue.

The error 'relocation R_X86_64_PC32 against symbol `ff_cos_32' can not be used when making a shared object; recompile with -fPIC' occurs while linking libavcodec.a, affecting users who have installed ffmpeg on Ubuntu 11.04 64-bit. This issue can be frustrating for developers as it prevents them from compiling their projects successfully.

This error is particularly problematic because it indicates that the ffmpeg library was not configured correctly to produce position-independent code (PIC), which is necessary for creating shared libraries.

🔍 Why This Happens

  • The primary reason for this error is that the ffmpeg library was not configured with the --enable-pic option, which enables position-independent code generation. This means that the libavcodec.a library was not compiled to produce a shared object that can be loaded by other programs.
  • An alternative cause could be that the system's linker (ld) is not capable of handling PIC symbols, or that there are other issues with the system's configuration.

✅ Best Solutions to Fix It

Enabling Position-Independent Code Generation

  1. Step 1: To fix this issue, re-run the ffmpeg configure script with the --enable-pic option. This will enable position-independent code generation and ensure that libavcodec.a is compiled correctly.
  2. Step 2: Run the command `./configure --enable-pic` to re-configure the ffmpeg build process.
  3. Step 3: Once re-configuration is complete, run `make` to rebuild the library.

Using a Different Compiler

  1. Step 1: As an alternative solution, try using a different compiler that supports PIC symbols. This may involve switching from the default system compiler to a compiler like GCC or Clang.
  2. Step 2: Run `gcc --version` and `clang --version` to check which compilers are available on your system.

✨ Wrapping Up

By following these steps, users should be able to resolve the 'error linking ffmpeg library' issue and successfully compile their projects. Remember to re-run the configure script with the --enable-pic option and rebuild the library as necessary.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions