如何重新编译-fPIC [英] how to recompile with -fPIC

查看:297
本文介绍了如何重新编译-fPIC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试重新安装我的ffmpeg,遵循我的ARM Ubuntu上的指南机。
Unfortunatley,当我编译一个使用这个lib的程序时,我得到以下失败:

I was trying to reinstall my ffmpeg, following this guide, on my ARM Ubuntu machine. Unfortunatley, when I compile a program which uses this lib I get the following failure:

/usr/bin/ld: /usr/local/lib/libavcodec.a(amrnbdec.o): relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

现在我想用-fPIC重新编译,就像编译器所建议的那样,但我不知道如何。任何帮助是赞赏。

Now I would like to recompile it with -fPIC like the compiler is suggesting but I have no idea how. Any help is appreciated.

推荐答案

简而言之,错误意味着您不能使用静态库来链接动态一个。
正确的方法是将libavcodec编译为.so而不是.a,所以您尝试构建的另一个.so库链接很好。

in brief, the error means that you can't use a static library to be linked w/ a dynamic one. The correct way is to have a libavcodec compiled into .so instead of .a, so the other .so library you are trying to build will link well.

最短的方法是在 ./ configure 选项中添加 - 启用共享
甚至你可以尝试禁用共享(或静态)库...你选择什么适合你!

the shortest way to do so is to add --enable-shared at ./configure options. or even you may try to disable shared (or static) libraries at all... you choose what is suitable for you!

这篇关于如何重新编译-fPIC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆