0
点赞
收藏
分享

微信扫一扫

libevent 静态库编译 -fPIC问题

一葉_code 2022-03-24 阅读 57
linux

之前一直使用libevent 动态库。发现每次都带很多歌so比较麻烦。决定使用静态库。
我使用一个动态库加载libevent。后面只发布我的动态库。感觉清爽了许多。

我的动态编译是报错
    relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
    
我使用libevent-release-2.1.12-stable版本
通过修改libevent-release-2.1.12-stable/CMakeLists.txt 实现
在文件中添加:
    add_compiler_flags(-fPIC)

et

举报

相关推荐

0 条评论