Libsourcey 缺少 -fPIC 编译错误 [英] Libsourcey missing -fPIC compilation error

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

问题描述

我正在尝试运行 LibSourcey 以使用 Webrtc 流服务器.

问题是我似乎无法让它工作.我努力在我的 Ubuntu 16.04(cmake 文件中的 Regexp)上创建该项目,但现在它已修复 .我实际遇到的问题是编译时的共享对象错误:

usr/bin/ld:/home/kimmie/ffmpeg_build/lib/libswresample.a(options.o):重定位 R_X86_64_32 针对 `.rodata.str1.1' 不能在创建共享对象时使用;用 -fPIC 重新编译/home/kimmie/ffmpeg_build/lib/libswresample.a:添加符号时出错:值错误collect2: 错误: ld 返回 1 个退出状态av/CMakeFiles/av.dir/build.make:783: 目标av/libscy_av.so.1.0.2"的配方失败

非常感谢任何帮助,因为我现在不知道该怎么做.

解决方案

我在 Ubuntu 16.04 上遇到了同样的错误.

我最终用标志重新编译了 FFmpeg 以构建共享库.按照 FFmpeg Compilation Guide 中的代码示例框,我将以下两个标志添加到适用的 ./configure 行:

  • --启用图片

  • --启用共享

我也删除了 --disable-shared 标志.

我将 --enable-pic--enable-shared 添加到每个组件中,如果返回的消息表明该组件无法识别该标志,则删除该标志.至少需要--enable-shared libx264、libfdk-acc 和 libmp3lame.然后对于最终的 FFmpeg(从上面链接的 FFmpeg 指南中复制并粘贴):

PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \--prefix="$HOME/ffmpeg_build" \--pkg-config-flags="--static" \--extra-cflags="-I$HOME/ffmpeg_build/include" \--extra-ldflags="-L$HOME/ffmpeg_build/lib" \--bindir="$HOME/bin" \--启用-gpl \--enable-libass \--enable-libfdk-aac \--enable-libfreetype \--enable-libmp3lame \--enable-libopus \--启用-libtheora \--enable-libvorbis \--启用-libvpx \--启用-libx264 \--启用-libx265 \--enable-nonfree \--启用图片\--启用共享

<块引用>

请注意我的示例中的最后两行与 FFmpeg 不同指南.

完成所有这些操作后,最好删除 Libsourcey 源代码和构建文件夹,然后重新开始.

我花了大约 4-5 天的时间来最终编译并成功构建具有 FFmpeg 和 WebRTC 依赖项的 Libsourcey.我也遇到了一些其他问题,所以如果您有其他问题,请务必标记我.注意:我是 Linux 构建的菜鸟,对所有概念都不是很了解;这对我有用,也许对你有用.

I'am trying to run the LibSourcey to use the Webrtc Streaming Server.

The thing is that i can't seem to make it work. I struggled to cmake the project on my Ubuntu 16.04(Regexp in cmake files) but now its fixed . The problem that i actually got is a shared object bug at compiling time :

usr/bin/ld: /home/kimmie/ffmpeg_build/lib/libswresample.a(options.o): 
relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; 
recompile with -fPIC

/home/kimmie/ffmpeg_build/lib/libswresample.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

av/CMakeFiles/av.dir/build.make:783: recipe for target 'av/libscy_av.so.1.0.2' failed

Any help would be very much appreciated as i don't know what to do now.

解决方案

I hit this same error on Ubuntu 16.04.

I ended up recompiling FFmpeg with flags to build the shared libraries. Following the code example boxes in the FFmpeg Compilation Guide, I added the following two flags to the ./configure lines where applicable:

  • --enable-pic

  • --enable-shared

I removed the --disable-shared flags as well.

I added --enable-pic and --enable-shared to every component and removed the flag if it returned a message that it was unrecognized for that component. At least libx264, libfdk-acc, and libmp3lame needed --enable-shared. And then for the final FFmpeg (copy and pasted from FFmpeg guide linked to above):

PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
 --prefix="$HOME/ffmpeg_build" \
 --pkg-config-flags="--static" \
 --extra-cflags="-I$HOME/ffmpeg_build/include" \
 --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
 --bindir="$HOME/bin" \
 --enable-gpl \
 --enable-libass \
 --enable-libfdk-aac \
 --enable-libfreetype \
 --enable-libmp3lame \
 --enable-libopus \
 --enable-libtheora \
 --enable-libvorbis \
 --enable-libvpx \
 --enable-libx264 \
 --enable-libx265 \
 --enable-nonfree \
 --enable-pic \
 --enable-shared

Note the last two lines in my example are different than the FFmpeg guide.

After you do all of that, it's probably best to delete the Libsourcey source and build folder and start over with that.

It took me about 4-5 days off and on to finally compile and successfully build Libsourcey with FFmpeg and WebRTC dependencies. I hit some other snags as well, so be sure to tag me if you have other questions. Note: I am noob at Linux building and not solid on all of the concepts; this is just what worked for me and perhaps it will work for you.

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

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