Linux: Compile static libs without -fPIC by default

Issue #88 resolved
djcj created an issue

The static libraries are compiled with -fPIC on Linux (GCC). This is bad however, it will be impossible to link those static libraries against other programs since most programs are compiled as non-PIC. Can you deactivate -fPIC on static libraries by default?

Comments (3)

  1. Steve Borho

    We link the shared library and the static library from the same object files, so this fairly complicated. Rafaël Carré added a patch about a year ago that always used -fPIC when building for 64bits to resolve link problems on his platform. In my experience, there are often link errors when -fPIC is not enabled.

    The best we could probably do would be to make -fPIC a cmake option that defaults to ON for 64bit builds. Package maintainers will have to build x265 twice if they want the shared lib to have PIC and the static lib to not have PIC.

  2. djcj reporter

    The best we could probably do would be to make -fPIC a cmake option that defaults to ON for 64bit builds. That would be great.

    Package maintainers will have to build x265 twice if they want the shared lib to have PIC and the static lib to not have PIC. Yes, but this is relatively common.

  3. Log in to comment