[vlc-devel] [PATCH 1/2] configure: Do not use -no-undefined with sanitizers on darwin
Marvin Scholz
epirat07 at gmail.com
Wed Oct 4 01:54:59 CEST 2017
Using sanitizer and no-undefined will cause linker errors on darwin due
to undefined symbols of the sanitizer.
This is adapted from a patch by Filip Roséen.
---
configure.ac | 6 ++++++
lib/Makefile.am | 2 +-
modules/audio_output/Makefile.am | 2 +-
modules/common.am | 2 +-
modules/hw/vdpau/Makefile.am | 2 +-
modules/video_output/Makefile.am | 2 +-
src/Makefile.am | 2 +-
7 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0230807515..f997f083d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1136,6 +1136,12 @@ AC_CACHE_CHECK([if linker supports -z,defs], [ac_cv_ld_z_defs], [
])
AS_IF([test "${ac_cv_ld_z_defs}" = "no" -o "x$with_sanitizer" != xno], [VLC_RESTORE_FLAGS])
+AM_COND_IF([HAVE_DARWIN], [], [
+ AS_IF([test "${with_sanitizer}" = "no"], [
+ AC_SUBST([LDFLAGS_no_undefined], [-no-undefined])
+ ])
+])
+
dnl Check for __attribute__((packed))
AC_CACHE_CHECK([for __attribute__((packed))],
[ac_cv_c_attribute_packed],
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 59571d8df5..f0060e17d8 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -60,7 +60,7 @@ libvlc_la_LIBADD = \
../src/libvlccore.la ../compat/libcompat.la $(LIBPTHREAD) $(LIBM)
libvlc_la_LDFLAGS = \
$(LDFLAGS_libvlc) \
- -no-undefined \
+ $(LDFLAGS_no_undefined) \
-version-info 10:0:5 \
-export-symbols $(srcdir)/libvlc.sym
libvlc_la_DEPENDENCIES = libvlc.sym
diff --git a/modules/audio_output/Makefile.am b/modules/audio_output/Makefile.am
index 4cffed51bb..908008311b 100644
--- a/modules/audio_output/Makefile.am
+++ b/modules/audio_output/Makefile.am
@@ -42,7 +42,7 @@ libvlc_pulse_la_CPPFLAGS = -DMODULE_STRING=\"pulse\"
libvlc_pulse_la_CFLAGS = $(AM_CFLAGS) $(PULSE_CFLAGS)
libvlc_pulse_la_LIBADD = $(PULSE_LIBS) $(LTLIBVLCCORE)
libvlc_pulse_la_LDFLAGS = \
- -no-undefined \
+ $(LDFLAGS_no_undefined) \
-export-symbols-regex ^vlc_pa_ \
-version-info 0:0:0
libpulse_plugin_la_SOURCES = audio_output/pulse.c
diff --git a/modules/common.am b/modules/common.am
index 7d3ce16978..97ff8f22b3 100644
--- a/modules/common.am
+++ b/modules/common.am
@@ -30,7 +30,7 @@ AM_LDFLAGS = \
-avoid-version -module \
-export-symbols-regex ^vlc_entry \
-shrext $(LIBEXT) \
- -no-undefined \
+ $(LDFLAGS_no_undefined) \
$(top_builddir)/compat/libcompat.la $(LTLIBVLCCORE)
if HAVE_WIN32
AM_LDFLAGS += $(top_builddir)/modules/module.rc.lo -Wc,-static
diff --git a/modules/hw/vdpau/Makefile.am b/modules/hw/vdpau/Makefile.am
index 0c527cf156..6164b88a1b 100644
--- a/modules/hw/vdpau/Makefile.am
+++ b/modules/hw/vdpau/Makefile.am
@@ -5,7 +5,7 @@ libvlc_vdpau_la_CFLAGS = $(VDPAU_CFLAGS)
libvlc_vdpau_la_LIBADD = $(X_LIBS) $(X_PRE_LIBS) -lX11 \
$(LIBDL) $(LIBPTHREAD)
libvlc_vdpau_la_LDFLAGS = \
- -no-undefined \
+ $(LDFLAGS_no_undefined) \
-export-symbols-regex ^vdp_ \
-version-info 0:0:0
diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index b77824944d..166eddeb89 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -114,7 +114,7 @@ libvlc_xcb_events_la_SOURCES = \
libvlc_xcb_events_la_CPPFLAGS = -DMODULE_STRING=\"xcb\"
libvlc_xcb_events_la_CFLAGS = $(AM_CFLAGS) $(XCB_CFLAGS)
libvlc_xcb_events_la_LDFLAGS = \
- -no-undefined \
+ $(LDFLAGS_no_undefined) \
-export-symbols-regex ^vlc_xcb_ \
-version-info 0:0:0
libvlc_xcb_events_la_LIBADD = $(XCB_LIBS) $(LTLIBVLCCORE)
diff --git a/src/Makefile.am b/src/Makefile.am
index 87ea540f69..42b6235230 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -462,7 +462,7 @@ endif
libvlccore_la_LDFLAGS = \
$(LDFLAGS_libvlccore) \
- -no-undefined \
+ $(LDFLAGS_no_undefined) \
-export-symbols $(srcdir)/libvlccore.sym \
-version-info 8:0:0
libvlccore_la_DEPENDENCIES = libvlccore.sym
--
2.13.5 (Apple Git-94)
More information about the vlc-devel
mailing list