Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the -fPIC compilation flag does?

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?

like image 752
Hafiz Hilman Mohammad Sofian Avatar asked Aug 29 '16 05:08

Hafiz Hilman Mohammad Sofian


1 Answers

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. :)

like image 198
bot1131357 Avatar answered Sep 29 '22 23:09

bot1131357