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

查看:2661
本文介绍了如何重新编译-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 选项中添加 - enable-shared
,甚至你可以尝试禁用共享(或静态)库...你选择适合你!

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天全站免登陆