What does the -fPIC compilation flag does?

10,621

A good explaination for -fPIC can be found here.

I think the main question here is whether if you can still go ahead and install OpenSfM without rebuilding Ceres Solver. As far as I know, you can't.

The most straightforward thing you can do is rebuild Ceres Solver and reinstall the PIC version.

cmake .. -DCMAKE_C_FLAGS=fPIC \
   -DCMAKE_CXX_FLAGS=-fPIC \ 
   -DSOMEOTHERARGUMENTSTHATYOUMIGHTHAVE

Let us know how it worked out for you. :)

Share:
10,621
Hafiz Hilman Mohammad Sofian
Author by

Hafiz Hilman Mohammad Sofian

I am a student that is right now learning programming pretty much by myself. Now is learning Python and OpenCV. Looking forward to immerse myself inside the programming world.

Updated on June 04, 2022

Comments

  • Hafiz Hilman Mohammad Sofian
    Hafiz Hilman Mohammad Sofian almost 2 years

    What the -fpic flag does? I want to install a library (OpenSFM) and it is stated that it will need the Ceres Solver built and installed with the -fPIC compilation flag.

    The problem is I already installed the Ceres Solver without the -fPIC flag and other library already depended on it. How can I solve this?