问题陈述
在编译C++程序时,出现如下所示的错误:
relocation R_X86_64_32 against ‘.rodata’ can not be used when making a PIE object: recompile with fPIC
电脑版本
Linux:Ubuntu 18.04
解决方法
从Ubuntu16.10开始默认启用PIE,而makefile的库不支持PIE。故在CMakeliststxt中加入如下语句:
set(CMAKE_C_FLAGS “KaTeX parse error: Double subscript at position 9: {CMAKE_C_̲FLAGS} -fPIC -n…{CMAKE_CXX_FLAGS} -fPIC -no-pie”)
参考文档
1.https://blog.csdn.net/qq_33530592/article/details/106011826
2.https://blog.csdn.net/googler_offer/article/details/95243150