在新公司工作第四天,依然要编译FFmpeg,不同的是难度大了,以前遇到什么参数编译不过的,就去掉,因为不是专业做视频的,但是新公司绕不过了。

编译FFmpeg动态库的时候发现链接某些静态库的时候会报错:

relocation R_X86_64_32S against `cmnMemAlloc' can not be used when making a shared object; recompile with -fPIC

基础不扎实,不知道make的时候还可以添加参数,查了很多资料,最后从一个回答中试出解决方案:

再编译存在问题的库时,调用“make”命令的时候,添加“CFLAGS='-fpic'”参数,就可以了。

举个栗子:

我编译FFmpeg时报这样的错:

/usr/bin/ld: /usr/local/lib/libvo-amrwbenc.a(wrapper.o): relocation R_X86_64_32S against `cmnMemAlloc' can not be used when making a shared object; recompile with -fPIC

意思是链接的“libvo-amrwbenc.a”库需要添加“-fPIC”重新编译,那我就在编译“libvo-amrwbenc.a”时,调用

make CFLAGS='$CFLAGS -fpic'

有的./configure 时也有这样的参数“CFLAGS”,也可以在这里添加

编译动态库要链接静态库才会出现这问题,编译静态库链接静态库则不会

有个回答如是说:

compile with -fPIC的更多相关文章

  1. Linux Overflow Vulnerability General Hardened Defense Technology、Grsecurity/PaX

    Catalog . Linux attack vector . Grsecurity/PaX . Hardened toolchain . Default addition of the Stack ...

  2. How to compile and install Snort from source code on Ubuntu

    http://www.tuicool.com/articles/v6j2Ab Snort is by far the most popular open-source network intrusio ...

  3. crosss compile VLC with OpenMAX on ARM board(RockChip RK3399),in order to use Hard Acceleration when decode video

    reference:http://www.x90x90x90.com/en/raspberry-pi-3-howto-compile-vlc-with-hardware-acceleration/ 1 ...

  4. Windows 10上源码编译glog和gflags 编写glog-config.cmake和gflags-config.cmake | compile glog and glags on windows from source

    本文首发于个人博客https://kezunlin.me/post/bb64e398/,欢迎阅读! compile glog v0.3.5 and glags on windows from sour ...

  5. Ubuntu 16.04上源码编译和安装pytorch教程,并编写C++ Demo CMakeLists.txt | tutorial to compile and use pytorch on ubuntu 16.04

    本文首发于个人博客https://kezunlin.me/post/54e7a3d8/,欢迎阅读最新内容! tutorial to compile and use pytorch on ubuntu ...

  6. Angular源码分析之$compile

    @(Angular) $compile,在Angular中即"编译"服务,它涉及到Angular应用的"编译"和"链接"两个阶段,根据从DO ...

  7. Compile FreeCAD on Windows

    Compile FreeCAD on Windows eryar@163.com 1.Introduction FreeCAD是一个参数化的三维造型软件,主要用于任意大小的实际模型的设计.参数化的建模 ...

  8. maven 加入json-lib.jar 报错 Missing artifact net.sf.json-lib:json-lib:jar:2.4:compile

    <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</art ...

  9. $compile

    <html ng-app="compile"> <head> <script src="http://apps.bdimg.com/libs ...

随机推荐

  1. Microsoft.Baidu.Ali.语音识别/人脸识别

    在第一篇博客里提过图片识别的底层.最精准的图片识别需要海量的数据磨炼.自己写的底层没有以亿为单位的数据支持其实也是个残废品. 此篇不是为了教学.而且在需要的时候抄下来就能用 在此介绍Microsoft ...

  2. 关于执行memcached报错问题

    执行#/usr/local/memcached/bin/memcached随后出现如下错误:./memcached: error while loading shared libraries: lib ...

  3. D - Back and Forth(模拟)

    Problem Statement Dolphin resides in two-dimensional Cartesian plane, with the positive x-axis point ...

  4. 【转】PHP微信上传永久图片素材

    $TOKEN="XXXX"; $file = "D:\www\weixin\game.jpg"; $data = array( 'media'=> new ...

  5. (原创)Codeforces Round #550 (Div. 3) D. Equalize Them All

    D. Equalize Them All time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  6. P2723 丑数 Humble Numbers

    题意:给你k个质数,定义丑数集合为k个质数随机(1--k)个相乘得到的数 求第n小的丑数 暴力...貌似不太可行,(把所有大量丑数求出来,sort   QAQ) 可以想到,对于第i个丑数f[i],它一 ...

  7. 洛谷 P1801 黑匣子_NOI导刊2010提高(06)

    题目描述 Black Box是一种原始的数据库.它可以储存一个整数数组,还有一个特别的变量i.最开始的时候Black Box是空的.而i等于0.这个Black Box要处理一串命令. 命令只有两种: ...

  8. 09. ajax跨域问题,同源策略

    有三个标签允许跨域加载资源 <img src=“”/> <link href=“”/> <script src=“”> 可以做防盗链图片功能   前端使用jsonp ...

  9. linux curl命令:curl: (7) couldn't connect to host ?

    linux curl命令:curl: (7) couldn't connect to host ? 使用linux命令 curl http://www.test.com 出现如下错误:curl: (7 ...

  10. Linux安全加固--系统相关

    一.系统相关 1.系统关键文件设置 1.1.设置文件初始权限 设置默认的umask值,增强安全性. [root@localhost ~]# umask 0022 /etc/profile最下面添加一行 ...