CCExtractor / rusty_ffmpeg

FFI bindings for FFmpeg inner libraries.
https://crates.io/crates/rusty_ffmpeg
MIT License
164 stars 26 forks source link

Issue with ffmpeg 5 on Ubuntu 22.10 #95

Closed prateekmedia closed 1 year ago

prateekmedia commented 1 year ago

Compiling ccextractor with rusty_ffmpeg and ffmpeg 5.0 on Ubuntu 22.10 gives this error, can you check if something is missing:

/usr/bin/ld: ./libccx_rust.a(rsmpeg-d3dd6e1fa3ffc9ea.rsmpeg.d0068580-cgu.10.rcgu.o): in function `<rsmpeg::avfilter::avfilter::AVFilterGraph as core::ops::drop::Drop>::drop':
/home/cfsmp3/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.1+ffmpeg.6.0/src/avfilter/avfilter.rs:244: undefined reference to `avfilter_graph_free'
ldm0 commented 1 year ago

avfilter_graph_free is a fairly basic symbol, and there is a FFmpeg 5.0 compatibility test in rsmpeg's CI(link). I guess the ffmpeg build might be corrupted or something was missed. Any detailed error info?

cfsmp3 commented 1 year ago

Adding to this:

✦2 ❯ dpkg -l |grep -i ffmpeg
ii  ffmpeg                                      7:5.1.1-1ubuntu2.1                         amd64        Tools for transcoding, streaming and playing of multimedia files
ii  libavcodec-dev:amd64                        7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library with de/encoders for audio/video codecs - development files
ii  libavcodec59:amd64                          7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library with de/encoders for audio/video codecs - runtime files
ii  libavdevice-dev:amd64                       7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library for handling input and output devices - development files
ii  libavdevice59:amd64                         7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library for handling input and output devices - runtime files
ii  libavfilter-dev:amd64                       7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library containing media filters - development files
ii  libavfilter8:amd64                          7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library containing media filters - runtime files
ii  libavformat-dev:amd64                       7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library with (de)muxers for multimedia containers - development files
ii  libavformat59:amd64                         7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library with (de)muxers for multimedia containers - runtime files
ii  libavutil-dev:amd64                         7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library with functions for simplifying programming - development files
ii  libavutil57:amd64                           7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library with functions for simplifying programming - runtime files
ii  libffmpegthumbnailer4v5:amd64               2.2.2+git20220218+dfsg-1build1             amd64        shared library for ffmpegthumbnailer
ii  libpostproc-dev:amd64                       7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library for post processing - development files
ii  libpostproc56:amd64                         7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library for post processing - runtime files
ii  libswresample-dev:amd64                     7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library for audio resampling, rematrixing etc. - development files
ii  libswresample4:amd64                        7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library for audio resampling, rematrixing etc. - runtime files
ii  libswscale-dev:amd64                        7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library for image scaling and various conversions - development files
ii  libswscale6:amd64                           7:5.1.1-1ubuntu2.1                         amd64        FFmpeg library for image scaling and various conversions - runtime files

Full error:

cfsmp3 in framework in ccextractor/linux on  master [!] on ☁️  (us-east-1)
✦ ❯ ./build -debug -hardsubx
Running pre-build script...
Obtaining Git commit
Storing variables in file
Commit: 29562759d21413dde25295d1ea7569aa865bde2e
Date: 2023-03-22
Stored all in compile_info_real.h
Done.
Trying to compile...
Checking for cargo...
rustc >= MSRV(1.54.0)
Building rust files...
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
Building ccextractor
Compiled with errors
../src/lib_ccx/telxcc.c: In function 'telxcc_dump_prev_page':
../src/lib_ccx/telxcc.c:519:28: warning: '%.3u' directive output may be truncated writing between 3 and 5 bytes into a region of size 4 [-Wformat-truncation=]
  519 |         snprintf(info, 4, "%.3u", bcd_page_to_int(tlt_config.page));
      |                            ^~~~
../src/lib_ccx/telxcc.c:519:27: note: directive argument in the range [0, 65535]
  519 |         snprintf(info, 4, "%.3u", bcd_page_to_int(tlt_config.page));
      |                           ^~~~~~
../src/lib_ccx/telxcc.c:519:9: note: 'snprintf' output between 4 and 6 bytes into a destination of size 4
  519 |         snprintf(info, 4, "%.3u", bcd_page_to_int(tlt_config.page));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/lib_ccx/matroska.c:3:
../src/lib_ccx/matroska.c: In function 'generate_timestamp_ass_ssa':
../src/lib_ccx/matroska.h:23:13: warning: '%02ld' directive writing 2 bytes into a region of size between 1 and 13 [-Wformat-overflow=]
   23 | #define LLD "%ld"
      |             ^~~~~
../src/lib_ccx/matroska.c:256:22: note: in expansion of macro 'LLD'
  256 |         sprintf(buf, LLD ":%02" LLD_M ":%02" LLD_M ".%02" LLD_M, hours, minutes, seconds, millis);
      |                      ^~~
../src/lib_ccx/matroska.c:256:28: note: format string is defined here
  256 |         sprintf(buf, LLD ":%02" LLD_M ":%02" LLD_M ".%02" LLD_M, hours, minutes, seconds, millis);
../src/lib_ccx/matroska.h:23:13: note: directive argument in the range [0, 59]
   23 | #define LLD "%ld"
      |             ^~~~~
../src/lib_ccx/matroska.c:256:22: note: in expansion of macro 'LLD'
  256 |         sprintf(buf, LLD ":%02" LLD_M ":%02" LLD_M ".%02" LLD_M, hours, minutes, seconds, millis);
      |                      ^~~
../src/lib_ccx/matroska.h:23:13: note: directive argument in the range [0, 59]
   23 | #define LLD "%ld"
      |             ^~~~~
../src/lib_ccx/matroska.c:256:22: note: in expansion of macro 'LLD'
  256 |         sprintf(buf, LLD ":%02" LLD_M ":%02" LLD_M ".%02" LLD_M, hours, minutes, seconds, millis);
      |                      ^~~
../src/lib_ccx/matroska.h:23:13: note: directive argument in the range [0, 99]
   23 | #define LLD "%ld"
      |             ^~~~~
../src/lib_ccx/matroska.c:256:22: note: in expansion of macro 'LLD'
  256 |         sprintf(buf, LLD ":%02" LLD_M ":%02" LLD_M ".%02" LLD_M, hours, minutes, seconds, millis);
      |                      ^~~
../src/lib_ccx/matroska.c:256:9: note: 'sprintf' output between 11 and 23 bytes into a destination of size 15
  256 |         sprintf(buf, LLD ":%02" LLD_M ":%02" LLD_M ".%02" LLD_M, hours, minutes, seconds, millis);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/lib_ccx/matroska.c: In function 'save_sub_track':
../src/lib_ccx/matroska.c:1199:42: warning: '%d' directive writing between 1 and 10 bytes into a region of size 9 [-Wformat-overflow=]
 1199 |                         sprintf(number, "%d", i + 1);
      |                                          ^~
../src/lib_ccx/matroska.c:1199:41: note: directive argument in the range [1, 2147483647]
 1199 |                         sprintf(number, "%d", i + 1);
      |                                         ^~~~
../src/lib_ccx/matroska.c:1199:25: note: 'sprintf' output between 2 and 11 bytes into a destination of size 9
 1199 |                         sprintf(number, "%d", i + 1);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/lib_ccx/utility.c: In function 'change_filename':
../src/lib_ccx/utility.c:457:50: warning: '%d' directive writing between 1 and 10 bytes into a region of size 5 [-Wformat-overflow=]
  457 |                         sprintf(new_extension, ".%d", iter);
      |                                                  ^~
../src/lib_ccx/utility.c:457:48: note: directive argument in the range [1, 2147483647]
  457 |                         sprintf(new_extension, ".%d", iter);
      |                                                ^~~~~
../src/lib_ccx/utility.c:457:25: note: 'sprintf' output between 3 and 12 bytes into a destination of size 6
  457 |                         sprintf(new_extension, ".%d", iter);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/lib_ccx/ts_tables_epg.c: In function 'EPG_DVB_calc_start_time':
../src/lib_ccx/ts_tables_epg.c:85:57: warning: '%02ld' directive writing between 2 and 20 bytes into a region of size between 1 and 19 [-Wformat-overflow=]
   85 |                 sprintf(event->start_time_string, "%02ld%02ld%02ld%06" PRIu64 "+0000", y, m, d, time & 0xffffff);
      |                                                         ^~~~~
../src/lib_ccx/ts_tables_epg.c:85:51: note: directive argument in the range [-9223372036854775808, 9223372036854775806]
   85 |                 sprintf(event->start_time_string, "%02ld%02ld%02ld%06" PRIu64 "+0000", y, m, d, time & 0xffffff);
      |                                                   ^~~~~~~~~~~~~~~~~~~~
../src/lib_ccx/ts_tables_epg.c:85:51: note: using the range [-9223372036854775808, 9223372036854775807] for directive argument
../src/lib_ccx/ts_tables_epg.c:85:51: note: directive argument in the range [0, 16777215]
../src/lib_ccx/ts_tables_epg.c:85:17: note: 'sprintf' output between 18 and 74 bytes into a destination of size 21
   85 |                 sprintf(event->start_time_string, "%02ld%02ld%02ld%06" PRIu64 "+0000", y, m, d, time & 0xffffff);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/lib_ccx/ts_tables_epg.c: In function 'EPG_DVB_calc_end_time':
../src/lib_ccx/ts_tables_epg.c:116:54: warning: '%02d' directive writing between 2 and 11 bytes into a region of size between 10 and 19 [-Wformat-overflow=]
  116 |                 sprintf(event->end_time_string, "%02d%02d%02d%02d%02d%02d +0000", timeinfo.tm_year + 1900, timeinfo.tm_mon + 1, timeinfo.tm_mday, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec);
      |                                                      ^~~~
../src/lib_ccx/ts_tables_epg.c:116:49: note: directive argument in the range [-2147483647, 2147483647]
  116 |                 sprintf(event->end_time_string, "%02d%02d%02d%02d%02d%02d +0000", timeinfo.tm_year + 1900, timeinfo.tm_mon + 1, timeinfo.tm_mday, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec);
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/lib_ccx/ts_tables_epg.c:116:17: note: 'sprintf' output between 19 and 73 bytes into a destination of size 21
  116 |                 sprintf(event->end_time_string, "%02d%02d%02d%02d%02d%02d +0000", timeinfo.tm_year + 1900, timeinfo.tm_mon + 1, timeinfo.tm_mday, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: ./libccx_rust.a(rsmpeg-d3dd6e1fa3ffc9ea.rsmpeg.d0068580-cgu.10.rcgu.o): in function `rsmpeg::avfilter::avfilter::AVFilter::get_by_name':
/home/cfsmp3/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.1+ffmpeg.6.0/src/avfilter/avfilter.rs:20: undefined reference to `avfilter_get_by_name'
/usr/bin/ld: ./libccx_rust.a(rsmpeg-d3dd6e1fa3ffc9ea.rsmpeg.d0068580-cgu.10.rcgu.o): in function `rsmpeg::avfilter::avfilter::AVFilterContext::buffersrc_add_frame':
/home/cfsmp3/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.1+ffmpeg.6.0/src/avfilter/avfilter.rs:66: undefined reference to `av_buffersrc_add_frame_flags'
/usr/bin/ld: ./libccx_rust.a(rsmpeg-d3dd6e1fa3ffc9ea.rsmpeg.d0068580-cgu.10.rcgu.o): in function `rsmpeg::avfilter::avfilter::AVFilterContext::buffersink_get_frame':
/home/cfsmp3/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.1+ffmpeg.6.0/src/avfilter/avfilter.rs:78: undefined reference to `av_buffersink_get_frame_flags'
/usr/bin/ld: ./libccx_rust.a(rsmpeg-d3dd6e1fa3ffc9ea.rsmpeg.d0068580-cgu.10.rcgu.o): in function `rsmpeg::avfilter::avfilter::AVFilterInOut::new':
/home/cfsmp3/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.1+ffmpeg.6.0/src/avfilter/avfilter.rs:96: undefined reference to `avfilter_inout_alloc'
/usr/bin/ld: ./libccx_rust.a(rsmpeg-d3dd6e1fa3ffc9ea.rsmpeg.d0068580-cgu.10.rcgu.o): in function `<rsmpeg::avfilter::avfilter::AVFilterInOut as core::ops::drop::Drop>::drop':
/home/cfsmp3/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.1+ffmpeg.6.0/src/avfilter/avfilter.rs:113: undefined reference to `avfilter_inout_free'
/usr/bin/ld: ./libccx_rust.a(rsmpeg-d3dd6e1fa3ffc9ea.rsmpeg.d0068580-cgu.10.rcgu.o): in function `rsmpeg::avfilter::avfilter::AVFilterGraph::new':
/home/cfsmp3/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.1+ffmpeg.6.0/src/avfilter/avfilter.rs:123: undefined reference to `avfilter_graph_alloc'
/usr/bin/ld: ./libccx_rust.a(rsmpeg-d3dd6e1fa3ffc9ea.rsmpeg.d0068580-cgu.10.rcgu.o): in function `rsmpeg::avfilter::avfilter::AVFilterGraph::parse_ptr':
/home/cfsmp3/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.1+ffmpeg.6.0/src/avfilter/avfilter.rs:156: undefined reference to `avfilter_graph_parse_ptr'
/usr/bin/ld: ./libccx_rust.a(rsmpeg-d3dd6e1fa3ffc9ea.rsmpeg.d0068580-cgu.10.rcgu.o): in function `rsmpeg::avfilter::avfilter::AVFilterGraph::config':
/home/cfsmp3/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.1+ffmpeg.6.0/src/avfilter/avfilter.rs:185: undefined reference to `avfilter_graph_config'
/usr/bin/ld: ./libccx_rust.a(rsmpeg-d3dd6e1fa3ffc9ea.rsmpeg.d0068580-cgu.10.rcgu.o): in function `rsmpeg::avfilter::avfilter::AVFilterGraph::get_filter':
/home/cfsmp3/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.1+ffmpeg.6.0/src/avfilter/avfilter.rs:193: undefined reference to `avfilter_graph_get_filter'
/usr/bin/ld: ./libccx_rust.a(rsmpeg-d3dd6e1fa3ffc9ea.rsmpeg.d0068580-cgu.10.rcgu.o): in function `rsmpeg::avfilter::avfilter::AVFilterGraph::create_filter_context':
/home/cfsmp3/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.1+ffmpeg.6.0/src/avfilter/avfilter.rs:213: undefined reference to `avfilter_graph_create_filter'
/usr/bin/ld: ./libccx_rust.a(rsmpeg-d3dd6e1fa3ffc9ea.rsmpeg.d0068580-cgu.10.rcgu.o): in function `<rsmpeg::avfilter::avfilter::AVFilterGraph as core::ops::drop::Drop>::drop':
/home/cfsmp3/.cargo/registry/src/github.com-1ecc6299db9ec823/rsmpeg-0.14.1+ffmpeg.6.0/src/avfilter/avfilter.rs:244: undefined reference to `avfilter_graph_free'

System

✦ ❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.10
Release:    22.10
Codename:   kinetic

CCExtractor version

commit 29562759d21413dde25295d1ea7569aa865bde2e (HEAD -> master, origin/master, origin/HEAD)
✦ ❯ cat ../src/rust/Cargo.toml
[package]
name = "ccx_rust"
version = "0.1.0"
authors = ["PunitLodha <punitlodha@pm.me>"]
description = "Rust library for CCExtractor"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["staticlib"]

[dependencies]
log = "0.4.0"
env_logger = "0.8.4"
iconv = "0.1.1"
palette = "0.6.0"
rsmpeg = { version = "0.14.1", optional = true, features = ["link_system_ffmpeg", "ffmpeg5"] }
tesseract-sys = { version = "0.5.14", optional = true, default-features = false}
leptonica-sys = { version = "0.4.3", optional = true, default-features = false}

[build-dependencies]
bindgen = "0.58.1"

[features]
hardsubx_ocr = ["rsmpeg", "tesseract-sys", "leptonica-sys"]
cfsmp3 commented 1 year ago

avfilter_graph_free is a fairly basic symbol, and there is a FFmpeg 5.0 compatibility test in rsmpeg's CI(link). I guess the ffmpeg build might be corrupted or something was missed. Any detailed error info?

See previous comment @ldm0 :-)

ldm0 commented 1 year ago

Let me install a VirtualBox.

ldm0 commented 1 year ago

@cfsmp3 @prateekmedia I reproduced this problem and found that libavfilter is missing on linking. After tweaking linker flag, the compilation succeed. Here is the PR: https://github.com/CCExtractor/ccextractor/pull/1513