Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run example failed #3

Open
wangshankun opened this issue Jan 6, 2020 · 3 comments
Open

run example failed #3

wangshankun opened this issue Jan 6, 2020 · 3 comments

Comments

@wangshankun
Copy link

cargo run --example h264_video_dec

ffmpeg-dev-rs/target/debug/deps/libffmpeg_dev-def21d6af90e43d1.rlib(allcodecs.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC

@colbyn
Copy link
Member

colbyn commented Jan 8, 2020

Can you give me the full output, as well as your OS?

From what you provided I don't know if this is an issue with Cargo/rustc or compiling FFmpeg C source files.

@runfalk
Copy link

runfalk commented Jan 20, 2020

I have same issue. I run Fedora 31 with the following packages installed:

  • llvm (9.0)
  • llvm-devel
  • clang (9.0)
  • make

Rust version is 1.40.

Log (I've removed 750 lines that were repeated for different functions):

   Compiling ffmpeg-dev v0.3.8 (/home/<redacted>/dev/ffmpeg-dev-rs)
warning: cbits/img_utils.c: In function ‘mp4_packager’:
warning: cbits/img_utils.c:248: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
warning:   248 |         #pragma clang diagnostic ignored "-Wdeprecated-declarations"
warning:       |
warning: cbits/img_utils.c:249:14: warning: ‘codec’ is deprecated [-Wdeprecated-declarations]
warning:   249 |         enum AVCodecID codec_id = ifmt_ctx->streams[stream_index]->codec->codec_id;
warning:       |              ^~~~~~~~~
warning: In file included from cbits/img_utils.c:26:
warning: /home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libavformat/avformat.h:885:21: note: declared here
warning:   885 |     AVCodecContext *codec;
warning:       |                     ^~~~~
warning: cbits/img_utils.c: At top level:
warning: cbits/img_utils.c:477: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
warning:   477 | #pragma clang diagnostic ignored "-Wunused-parameter"
warning:       |
warning: cbits/img_utils.c: In function ‘decode_packet’:
warning: cbits/img_utils.c:488: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
warning:   488 |         #pragma clang diagnostic ignored "-Wdeprecated-declarations"
warning:       |
warning: cbits/img_utils.c:489:9: warning: ‘avcodec_decode_video2’ is deprecated [-Wdeprecated-declarations]
warning:   489 |         int res = avcodec_decode_video2(
warning:       |         ^~~
warning: In file included from /home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libavformat/avformat.h:317,
warning:                  from cbits/img_utils.c:26:
warning: /home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libavcodec/avcodec.h:4828:5: note: declared here
warning:  4828 | int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
warning:       |     ^~~~~~~~~~~~~~~~~~~~~
warning: cbits/img_utils.c:482:9: warning: unused parameter ‘cached’ [-Wunused-parameter]
warning:   482 |     int cached,
warning:       |     ~~~~^~~~~~
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.1a8no36a90z3hcmg.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.1d61my7gjy3z8d2q.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.1mw3w21l9rn7xuct.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.1pigp6p5k1mu1ww1.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.1zht1aluxy3xre4k.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.23fggphb7mq833q1.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.2blphq0gxelevwf9.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.2ks1yk2pf6hlplix.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.2nesbchceuqulkul.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.2qpla8462t19dlqb.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.2xq9pnogv9wbs1zh.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.3286ufqx1gzjfasi.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.32fxi55kt2yt48mp.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.33zdsr4vuuvhgbjp.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.35iti2ik04yd0c1x.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.3c7xbdudwqpqkbef.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.3ibegbm8uitwxdtn.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.3o57p8oy67s9oy2x.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.409k68riaxm8wj18.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.43tpp96r2i22rmfd.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.455x3cljdqojd5at.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.46z90g57199ngy7l.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.497rpn5vq3l6da0c.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.4j3qy5n8m0ma7or6.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.4lpd3rfdrotqksso.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.4n63po549xra3s1a.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.4qp01hxls96kazwb.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.4upmq93n8qpvbhmu.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.4uxwxa0pbqrsqdkn.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.52tbwj9e9l72vjjt.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.5dwi768kji5frpou.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.ad4qhfvdmvvghb3.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.djvg3cgqav1odp.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.hlmfljp9t1ud1kw.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.hx4lopwmdwetol5.rcgu.o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.oy1eo0iv926l14y.rcgu.o" "-o" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/examples/h264_video_dec-1fa5fbb20a3fe943.1ttqzqaq48r232gv.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/deps" "-L" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2" "-L" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libavcodec" "-L" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libavdevice" "-L" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libavfilter" "-L" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libavformat" "-L" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libavresample" "-L" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libavutil" "-L" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libpostproc" "-L" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libswresample" "-L" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libswscale" "-L" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out" "-L" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/deps/libffmpeg_dev-9a74f2e39a617786.rlib" "/home/<redacted>/dev/ffmpeg-dev-rs/target/debug/deps/liblibc-52f675a24655d4b8.rlib" "-Wl,--start-group" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-74488c47a41eb313.rlib" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-efbc2c947951b8cc.rlib" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-b177382d9a04ffbe.rlib" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-ba7d2244d33447d5.rlib" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace-39569dc87e4ea301.rlib" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-cd9e255bd82ddb5c.rlib" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-f83165e777dccb8d.rlib" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-10b085de263b1750.rlib" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-9a4a22edf44da957.rlib" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-68fabc677efa98de.rlib" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-026dc0061b48e8b6.rlib" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-7bf75bb619341145.rlib" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-ef54709e300503ed.rlib" "-Wl,--end-group" "/home/<redacted>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-4ed27d8420cb4abc.rlib" "-Wl,-Bdynamic" "-lutil" "-lutil" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /usr/bin/ld: /home/<redacted>/dev/ffmpeg-dev-rs/target/debug/deps/libffmpeg_dev-9a74f2e39a617786.rlib(allcodecs.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
          ... < this repeats for about 750 lines > ...
          /usr/bin/ld: /home/<redacted>/dev/ffmpeg-dev-rs/target/debug/deps/libffmpeg_dev-9a74f2e39a617786.rlib(v4l2_buffers.o): relocation R_X86_64_32S against `.rodata' can not be used when making a PIE object; recompile with -fPIC
          /usr/bin/ld: final link failed: nonrepresentable section on output
          collect2: error: ld returned 1 exit status

error: aborting due to previous error

The following warnings were emitted during compilation:

warning: cbits/img_utils.c: In function ‘mp4_packager’:
warning: cbits/img_utils.c:248: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
warning:   248 |         #pragma clang diagnostic ignored "-Wdeprecated-declarations"
warning:       |
warning: cbits/img_utils.c:249:14: warning: ‘codec’ is deprecated [-Wdeprecated-declarations]
warning:   249 |         enum AVCodecID codec_id = ifmt_ctx->streams[stream_index]->codec->codec_id;
warning:       |              ^~~~~~~~~
warning: In file included from cbits/img_utils.c:26:
warning: /home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libavformat/avformat.h:885:21: note: declared here
warning:   885 |     AVCodecContext *codec;
warning:       |                     ^~~~~
warning: cbits/img_utils.c: At top level:
warning: cbits/img_utils.c:477: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
warning:   477 | #pragma clang diagnostic ignored "-Wunused-parameter"
warning:       |
warning: cbits/img_utils.c: In function ‘decode_packet’:
warning: cbits/img_utils.c:488: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas]
warning:   488 |         #pragma clang diagnostic ignored "-Wdeprecated-declarations"
warning:       |
warning: cbits/img_utils.c:489:9: warning: ‘avcodec_decode_video2’ is deprecated [-Wdeprecated-declarations]
warning:   489 |         int res = avcodec_decode_video2(
warning:       |         ^~~
warning: In file included from /home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libavformat/avformat.h:317,
warning:                  from cbits/img_utils.c:26:
warning: /home/<redacted>/dev/ffmpeg-dev-rs/target/debug/build/ffmpeg-dev-3320b23ae77d27ac/out/FFmpeg-FFmpeg-2722fc2/libavcodec/avcodec.h:4828:5: note: declared here
warning:  4828 | int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
warning:       |     ^~~~~~~~~~~~~~~~~~~~~
warning: cbits/img_utils.c:482:9: warning: unused parameter ‘cached’ [-Wunused-parameter]
warning:   482 |     int cached,
warning:       |     ~~~~^~~~~~

error: could not compile `ffmpeg-dev`.

To learn more, run the command again with --verbose.

@runfalk
Copy link

runfalk commented Jan 20, 2020

I managed to get it to compile using RUSTFLAGS='-C relocation-model=dynamic-no-pic -C link-args=-no-pie' cargo run, but I'd prefer if it worked without these flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants