libav possible overflow error when linking on android
I am attempting to link libav into an Android application (via Flutter framework, version 3.16.8). I'm using GStreamer 1.22, Android NDK version 21.4.7075529, and SDK version 21 (minimum). The build is assisted by CMake, using version 3.18. I am building on an Apple M1 machine running Sonoma 14.2.1.
I used pkgconfig in a CMakeLists.txt in a way that works for all the other packages I am linking, but I get this error (and many others like it):
requires dynamic R_X86_64_PC32 reloc against 'ff_pw_1' which may overflow at runtime; recompile with -fPIC
From what I can tell from folks who have had this error in other situations, the solution is to recompile libav with -fPIC flag.
You can try to reproduce the issue by cloning a repo I made specifically for this: https://github.com/bgreenbones/gstreamerAndroidLibavIssue