mpv-player / mpv-build

🔨 Helper scripts to compile mpv on Linux
http://mpv.io
414 stars 108 forks source link

Cannot build with ld error undefined reference to symbol 'FcConfigCreate' #152

Closed tester1969 closed 3 years ago

tester1969 commented 3 years ago

fedora 33 updated to latest out.txt , latest I guess mpv since it updates before build

[265/266] Compiling osdep/main-fn-unix.c [266/266] Linking build/mpv /usr/bin/ld: /home/theodore/mpv-build/build_libs/lib/libass.a(ass_fontconfig.o): undefined reference to symbol 'FcConfigCreate' /usr/bin/ld: /usr/lib64/libfontconfig.so.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status

Waf: Leaving directory `/home/theodore/mpv-build/mpv/build' Build failed -> task in 'mpv' failed with exit status 1 (run with -v to display more information)

twilson90 commented 3 years ago

I have the same issue but when compiling ffmpeg:

Using ffmpeg options: --enable-gpl --disable-debug --disable-doc --enable-nonfree --enable-gpl --enable-version3 --enable-vdpau --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libpulse --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-nonfree --enable-openssl
License: nonfree and unredistributable
config.h is unchanged
config.asm is unchanged
libavutil/avconfig.h is unchanged
libavfilter/filter_list.c is unchanged
libavcodec/codec_list.c is unchanged
libavcodec/parser_list.c is unchanged
libavcodec/bsf_list.c is unchanged
libavformat/demuxer_list.c is unchanged
libavformat/muxer_list.c is unchanged
libavdevice/indev_list.c is unchanged
libavdevice/outdev_list.c is unchanged
libavformat/protocol_list.c is unchanged
ffbuild/config.sh is unchanged
make: Entering directory '/opt/mpv-build/ffmpeg_build'
CC      libavfilter/vf_subtitles.o
src/libavfilter/vf_subtitles.c: In function 'config_input':
src/libavfilter/vf_subtitles.c:149:9: warning: 'ass_set_aspect_ratio' is deprecated: use 'ass_set_pixel_aspect' instead [-Wdeprecated-declarations]
  149 |         ass_set_aspect_ratio(ass->renderer, (double)inlink->w / inlink->h,
      |         ^~~~~~~~~~~~~~~~~~~~
In file included from src/libavfilter/vf_subtitles.c:30:
/opt/mpv-build/build_libs/include/ass/ass.h:421:59: note: declared here
  421 | ASS_DEPRECATED("use 'ass_set_pixel_aspect' instead") void ass_set_aspect_ratio(ASS_Renderer *priv, double dar, double sar);
      |                                                           ^~~~~~~~~~~~~~~~~~~~
AR      libavfilter/libavfilter.a
LD      ffmpeg_g
/usr/bin/ld: /opt/mpv-build/build_libs/lib/libass.a(ass_fontconfig.o): undefined reference to symbol 'FcConfigCreate'
/usr/bin/ld: /lib/x86_64-linux-gnu/libfontconfig.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [src/Makefile:124: ffmpeg_g] Error 1
make: Leaving directory '/opt/mpv-build/ffmpeg_build'

I removed '--enable-libass' and now I get the same error as @tester1969 when trying to compile mpv.

tester1969 commented 3 years ago

$ nm -D /usr/lib64/libfontconfig.so |grep FcConfigCreate 0000000000009620 T FcConfigCreate

so i guess we must include this library somehow in libass compiling but I don't know how

twilson90 commented 3 years ago

As a temporary fix I checked out commit d1903f5a404ec9f2e5cb4f4fb139333361a4811d [fontselect: warn when no fallback can be found] and ffmpeg and mpv compiled correctly.

zluo01 commented 3 years ago

As a temporary fix I checked out commit d1903f5a404ec9f2e5cb4f4fb139333361a4811d [fontselect: warn when no fallback can be found] and ffmpeg and mpv compiled correctly.

Where is the commit? I am not able to find them in both mpv and mpv-build repo. Thank you.

zeromind commented 3 years ago

As a temporary fix I checked out commit d1903f5a404ec9f2e5cb4f4fb139333361a4811d [fontselect: warn when no fallback can be found] and ffmpeg and mpv compiled correctly.

Where is the commit? I am not able to find them in both mpv and mpv-build repo. Thank you.

That's the commit for libass: https://github.com/libass/libass/commit/d1903f5a404ec9f2e5cb4f4fb139333361a4811d In the mpv-build directory: ./use-libass-custom d1903f5a404ec9f2e5cb4f4fb139333361a4811d

avih commented 3 years ago

As a temporary fix I checked out commit d1903f5a404ec9f2e5cb4f4fb139333361a4811d [fontselect: warn when no fallback can be found]

Why this commit specifically? As far as I can tell the the next commit - https://github.com/libass/libass/commit/b06cd8c482f297ede7cba660f9fff9179e38038b shouldn't affect the build.

Did you check which is the first commit which causes issues?

twilson90 commented 3 years ago

@avih I just tried rolling it back to this commit on a hunch and it worked, didn't check to see if later commits also worked or investigate the issue further.

tester1969 commented 3 years ago

Suggestion from hedgehog90 and zeromind does compile.

twilson90 commented 3 years ago

This issue still exists for me when trying to compile ffmpeg with --enable-libass.

I tried adding export LDFLAGS="$LDFLAGS $(pkg-config --libs fontconfig harfbuzz fribidi)" to ffmpeg-config but it doesn't work. I get exactly the same error as I did 7 months ago (see above).