Home >Backend Development >C++ >Why do I get the error 'relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object'?
Recompilation with -fPIC Flag for ARM Ubuntu Machine
When rebuilding FFmpeg on an ARM Ubuntu machine, one may encounter the error:
relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
This error indicates that the system is attempting to link a static library with a dynamic library, which is incompatible. To resolve this, it is necessary to recompile the problematic library, such as FFmpeg, with the -fPIC flag.
Recompilation Process
The following steps can be taken to recompile a library with the -fPIC flag:
Specific Example for FFmpeg
For FFmpeg, the following command can be used to recompile it with the -fPIC flag:
./configure --enable-shared --disable-static make
By adding the --enable-shared flag, shared libraries will be generated instead of static ones. The --disable-static flag ensures that no static libraries are built.
After rebuilding FFmpeg with these options, the recompiled libraries can be installed into the appropriate system directories using make install. This will make the PIC-enabled FFmpeg libraries available for linking and use by other programs.
The above is the detailed content of Why do I get the error 'relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object'?. For more information, please follow other related articles on the PHP Chinese website!