Position-independent code is not tied to a specific address. This independence allows the code to execute efficiently at a different address in each process that uses the code. Position-independent code is recommended for the creation of shared objects.
On some architectures, including x86, -fPIC generates much worse code (i.e. a function call) for loads/stores of data. While this is tolerable for libraries, it is undesirable for executables.
If the object is to be linked as a shared library, or a static library that will in turn be linked in a shared library, use -fPIC. If the object is to be linked as a position indenpendent executable, or astatic library that will in turn be linked in position independent executable, use -fPIE.
PIC
flag was introduced in previous mediasoup gyp build system: https://github.com/versatica/mediasoup/commit/bbc35146468990648fc4925f4d852955b32091b7, it was needed for mediasoup to build on Ubuntu 18.04: https://github.com/versatica/mediasoup/issues/315.More details
In https://mesonbuild.com/Builtin-options.html#base-options:
Somewhere else: