Home > Backend Development > C++ > Why Am I Getting 'Relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object' Error While Compiling ffmpeg?

Why Am I Getting 'Relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object' Error While Compiling ffmpeg?

Barbara Streisand
Release: 2024-11-10 14:37:03
Original
477 people have browsed it

Why Am I Getting

Error While Compiling with ffmpeg: "Relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC"

While attempting to reinstall ffmpeg on an ARM Ubuntu system, a compilation error was encountered when using a program that utilized the ffmpeg library. The error message indicated:

/usr/bin/ld: /usr/local/lib/libavcodec.a(amrnbdec.o): relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
Copy after login

This error arises from an attempt to link a static library (.a) with a dynamic one (.so). To resolve this issue, it is necessary to recompile ffmpeg with the -fPIC flag.

Recompiling with -fPIC

Adding the --enable-shared flag during ./configure will instruct ffmpeg to build as a dynamic library. Alternatively, you can choose to disable static libraries completely if preferred.

Once the ffmpeg library has been recompiled with -fPIC, the compilation should proceed successfully without the aforementioned error.

The above is the detailed content of Why Am I Getting 'Relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object' Error While Compiling ffmpeg?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template