[PATCH weston] automake: list static libraries before the shared ones

Emil Velikov emil.l.velikov at gmail.com
Fri Jul 22 13:52:42 UTC 2016


From: Emil Velikov <emil.velikov at collabora.com>

The linker processes those in the order that they are given. Thus
as-it we can get unresolved symbols.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
Some places in weston already follow this approach, and although I've
not had a problem it'll be nice to fix things.

Noticed while looking at the libweston link issues.
---
 Makefile.am | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 73ce22c..0f29981 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -146,9 +146,10 @@ weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON 		\
 				 -DMODULEDIR='"$(moduledir)"' \
 				 -DXSERVER_PATH='"@XSERVER_PATH@"'
 weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS)
-weston_LDADD = $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \
+weston_LDADD = libshared.la libweston- at LIBWESTON_MAJOR@.la \
+	$(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \
 	$(DLOPEN_LIBS) $(LIBINPUT_BACKEND_LIBS) \
-	-lm libshared.la libweston- at LIBWESTON_MAJOR@.la
+	-lm
 
 weston_SOURCES = 					\
 	compositor/main.c				\
@@ -852,7 +853,7 @@ desktop_shell_la_CPPFLAGS =			\
 	-DIN_WESTON
 
 desktop_shell_la_LDFLAGS = -module -avoid-version
-desktop_shell_la_LIBADD = $(COMPOSITOR_LIBS) libshared.la
+desktop_shell_la_LIBADD = libshared.la $(COMPOSITOR_LIBS)
 desktop_shell_la_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS)
 desktop_shell_la_SOURCES =				\
 	desktop-shell/shell.h				\
@@ -901,7 +902,7 @@ module_LTLIBRARIES +=				\
 
 ivi_shell = ivi-shell.la
 ivi_shell_la_LDFLAGS = -module -avoid-version
-ivi_shell_la_LIBADD = $(COMPOSITOR_LIBS) libshared.la
+ivi_shell_la_LIBADD = libshared.la $(COMPOSITOR_LIBS)
 ivi_shell_la_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS)
 ivi_shell_la_SOURCES =				\
 	ivi-shell/ivi-layout-export.h		\
@@ -921,7 +922,7 @@ BUILT_SOURCES += $(nodist_ivi_shell_la_SOURCES)
 
 hmi_controller = hmi-controller.la
 hmi_controller_la_LDFLAGS = -module -avoid-version
-hmi_controller_la_LIBADD = $(COMPOSITOR_LIBS) libshared.la
+hmi_controller_la_LIBADD = libshared.la $(COMPOSITOR_LIBS)
 hmi_controller_la_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS)
 hmi_controller_la_SOURCES =				\
 	ivi-shell/ivi-layout-export.h			\
@@ -943,9 +944,9 @@ module_LTLIBRARIES += screen-share.la
 screen_share_la_CPPFLAGS = $(AM_CPPFLAGS) -DBINDIR='"$(bindir)"'
 screen_share_la_LDFLAGS = -module -avoid-version
 screen_share_la_LIBADD =			\
+	libshared-cairo.la			\
 	$(COMPOSITOR_LIBS)			\
-	$(SCREEN_SHARE_LIBS)			\
-	libshared-cairo.la
+	$(SCREEN_SHARE_LIBS)
 screen_share_la_CFLAGS =			\
 	$(COMPOSITOR_CFLAGS)			\
 	$(SCREEN_SHARE_CFLAGS)			\
@@ -975,8 +976,8 @@ xwayland_la_CPPFLAGS =				\
 
 xwayland_la_LDFLAGS = -module -avoid-version
 xwayland_la_LIBADD =			\
-	$(XWAYLAND_LIBS)		\
-	$(top_builddir)/libshared-cairo.la
+	libshared-cairo.la		\
+	$(XWAYLAND_LIBS)
 xwayland_la_CFLAGS =				\
 	$(AM_CFLAGS)				\
 	$(COMPOSITOR_CFLAGS)			\
@@ -1164,7 +1165,7 @@ surface_test_la_SOURCES = tests/surface-test.c
 surface_test_la_LDFLAGS = $(test_module_ldflags)
 surface_test_la_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS)
 
-weston_test_la_LIBADD = $(COMPOSITOR_LIBS) libshared.la
+weston_test_la_LIBADD = libshared.la $(COMPOSITOR_LIBS)
 weston_test_la_LDFLAGS = $(test_module_ldflags)
 weston_test_la_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS)
 weston_test_la_SOURCES = 			\
@@ -1208,7 +1209,7 @@ nodist_libtest_client_la_SOURCES =		\
 	protocol/weston-test-protocol.c	\
 	protocol/weston-test-client-protocol.h
 libtest_client_la_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS) $(CAIRO_CFLAGS)
-libtest_client_la_LIBADD = $(TEST_CLIENT_LIBS) $(CAIRO_LIBS) libshared.la libtest-runner.la
+libtest_client_la_LIBADD = libshared.la libtest-runner.la $(TEST_CLIENT_LIBS) $(CAIRO_LIBS)
 
 
 #
@@ -1397,7 +1398,7 @@ EXTRA_DIST +=					\
 noinst_LTLIBRARIES +=				\
 	surface-screenshot.la
 
-surface_screenshot_la_LIBADD = $(COMPOSITOR_LIBS) libshared.la
+surface_screenshot_la_LIBADD = libshared.la $(COMPOSITOR_LIBS)
 surface_screenshot_la_LDFLAGS = $(test_module_ldflags)
 surface_screenshot_la_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS)
 surface_screenshot_la_SOURCES = tests/surface-screenshot.c
-- 
2.9.0



More information about the wayland-devel mailing list