[vlc-devel] [PATCH] chromaprint: pass -Bsymbolic to fix static link on Linux.

Konstantin Pavlov thresh at videolan.org
Tue May 15 11:38:56 CEST 2018


When using contribs, chromaprint links to static ffmpeg, which results
in the following linking error:

CXXLD    libstream_out_chromaprint_plugin.la
/usr/bin/ld: /vlc/contrib/x86_64-linux-gnu/lib/libavcodec.a(fft.o):
relocation R_X86_64_PC32 against symbol `ff_cos_32' can not be used when
making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value

Even though ffmpeg is compiled as PIC. The solution to the problem is
documented in [1].

[1] https://ffmpeg.org/platform.html#Advanced-linking-configuration
---
 configure.ac                   | 5 ++++-
 modules/stream_out/Makefile.am | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4a53c2ea2c..f75e696604 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3622,7 +3622,10 @@ dnl  chromaprint audio track fingerprinter
 dnl
 m4_pushdef([libchromaprint_version], 0.6.0)
 PKG_WITH_MODULES([CHROMAPRINT],[libchromaprint >= libchromaprint_version],
-    VLC_ADD_PLUGIN([stream_out_chromaprint]),
+    VLC_ADD_PLUGIN([stream_out_chromaprint])
+    AS_IF([test -n "${ac_cv_ld_bsymbolic}"], [
+      VLC_ADD_LDFLAGS([chromaprint],[${ac_cv_ld_bsymbolic}])
+    ]),
     AS_IF([test "${enable_chromaprint}" = "yes"],
         [AC_MSG_ERROR(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)],
         [AC_MSG_WARN(Library [libchromaprint >= libchromaprint_version] needed for [chromaprint] was not found)]
diff --git a/modules/stream_out/Makefile.am b/modules/stream_out/Makefile.am
index 8a1b42d34d..02aa672c42 100644
--- a/modules/stream_out/Makefile.am
+++ b/modules/stream_out/Makefile.am
@@ -62,7 +62,7 @@ endif
 # Chromaprint plugin
 libstream_out_chromaprint_plugin_la_SOURCES = stream_out/chromaprint.c stream_out/chromaprint_data.h dummy.cpp
 libstream_out_chromaprint_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(CHROMAPRINT_CFLAGS)
-libstream_out_chromaprint_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(soutdir)'
+libstream_out_chromaprint_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(soutdir)' $(LDFLAGS_chromaprint)
 libstream_out_chromaprint_plugin_la_LIBADD = $(CHROMAPRINT_LIBS)
 EXTRA_LTLIBRARIES += libstream_out_chromaprint_plugin.la
 sout_LTLIBRARIES += $(LTLIBstream_out_chromaprint)
-- 
2.17.0



More information about the vlc-devel mailing list