What does the -fPIC compilation flag does?

落花浮王杯 提交于 2019-12-11 01:47:23

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/39198826/what-does-the-fpic-compilation-flag-does

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!