gstreamer-full: Fix link with x264
authorStéphane Cerveau <scerveau@collabora.com>
Tue, 7 Jul 2020 09:13:49 +0000 (11:13 +0200)
committerStéphane Cerveau <scerveau@collabora.com>
Wed, 22 Jul 2020 10:40:00 +0000 (12:40 +0200)
If a static build is requested and x264 plugin has been enabled
the full link fails with:

/usr/bin/ld: subprojects/x264/libx264.a(cabac-a.o): relocation
R_X86_64_PC32 against symbol `x264_cabac_range_lps' can not be used when
making a shared object; recompile with -fPIC

Fixes #108

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/169>

meson.build

index aaf19f4..41a2a04 100644 (file)
@@ -246,6 +246,14 @@ if get_option('default_library') == 'static'
   )
   install_headers('gstinitstaticplugins.h', subdir : 'gstreamer-1.0/gst')
 
+  # Avoid a x264 link issue described here: https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/108
+  # Similar issue has been found with VLC: https://mailman.videolan.org/pipermail/vlc-devel/2009-March/057640.html
+  gstfull_link_args = []
+  if cc.has_link_argument('-Wl,-Bsymbolic')
+    gstfull_link_args += ['-Wl,-Bsymbolic']
+  endif
+
+
   gst_dep = subproject('gstreamer').get_variable('gst_dep')
 
   # Get a list of libraries that needs to be exposed in the ABI.
@@ -272,6 +280,7 @@ if get_option('default_library') == 'static'
   gstfull = both_libraries('gstreamer-full-1.0',
     init_static_plugins_c,
     link_with : all_plugins,
+    link_args: gstfull_link_args,
     link_whole : exposed_libs,
     dependencies : gst_dep,
     install : true,