Skip to content
This repository
Browse code

build: 3rd party lib linking symbols cleanup

Fix several linking concerns that are usually masked in one way or another.
To see, add -Wl,--unresolved-symbols=ignore-in-shared-libs to LDFLAGS

1. The 3rd party libs that we build can't resolve our wrapped functions until
   runtime, so tell the linker not to expect them.
2. Various vis and screensavers were relying on XBMC bringing in GL libs.

With these fixes, linking opts like --unresolved-symbols=ignore-in-shared-libs
now work properly. This is useful for annoying libs like gles or egl which
may depend on other libs that cannot resolve at link-time.

TODO: ProjectM still neeeds attention
  • Loading branch information...
commit 493650feac5c2143d33cd527536797b1c8b3db6c 1 parent 4511eb1
authored September 16, 2011
2  lib/cximage-6.0/Makefile.in
@@ -22,7 +22,7 @@ ifeq ($(findstring osx,$(ARCH)), osx)
22 22
 	@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o CxImage/*.o jasper/*/*.o jbig/*.o raw/*.o
23 23
 else
24 24
 	$(CXX) $(CFLAGS) $(LDFLAGS) -shared -o $(SLIB) -Wl,--whole-archive $(SLIBS) \
25  
-		-Wl,--no-whole-archive -lpng -ljasper -ljpeg -ltiff -lz \
  25
+		-Wl,--no-whole-archive -lpng -ljasper -ljpeg -ltiff -lz -Wl,--unresolved-symbols=ignore-all \
26 26
 		`cat ../../xbmc/cores/DllLoader/exports/wrapper.def` \
27 27
 		../../xbmc/cores/DllLoader/exports/wrapper.o
28 28
 endif
3  lib/libdvd/Makefile.in
@@ -56,11 +56,12 @@ else
56 56
 
57 57
 $(SYSDIR)/libdvdcss-$(ARCH).so: $(WRAPPER) libdvdcss/src/.libs/libdvdcss.a
58 58
 	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ \
59  
-		libdvdcss/src/*.o \
  59
+		libdvdcss/src/*.o -Wl,--unresolved-symbols=ignore-all \
60 60
 		`cat $(WRAPPER:.o=.def)` $(WRAPPER)
61 61
 
62 62
 $(SYSDIR)/libdvdnav-$(ARCH).so: $(WRAPPER) $(DVDCSS_A) libdvdread/obj/libdvdread.a libdvdnav/obj/libdvdnav.a
63 63
 	$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ $(DVDCSS_O) libdvdread/obj/*.o libdvdnav/obj/*.o \
  64
+		-Wl,--unresolved-symbols=ignore-all \
64 65
 		`cat $(WRAPPER:.o=.def)` $(WRAPPER)
65 66
 
66 67
 endif
2  lib/libexif/Makefile.in
@@ -14,7 +14,7 @@ ifeq ($(findstring osx,$(ARCH)), osx)
14 14
 		-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
15 15
 		@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS)
16 16
 else
17  
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) \
  17
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all \
18 18
 		`cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
19 19
 endif
20 20
 
3  lib/libhdhomerun/Makefile.in
@@ -24,7 +24,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
24 24
 		-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
25 25
 		@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS)
26 26
 else
27  
-	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -shared -o $@ `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` \
  27
+	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -shared -o $@ -Wl,--unresolved-symbols=ignore-all \
  28
+		`cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` \
28 29
 		@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
29 30
 endif
30 31
 	
2  lib/libid3tag/Makefile.in
@@ -16,7 +16,7 @@ $(SLIB): libid3tag/.libs/libid3tag.dylib
16 16
 	chmod +x $@
17 17
 else
18 18
 $(SLIB): libid3tag/.libs/libid3tag.so
19  
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -fPIC -o $@ libid3tag/.libs/*.o \
  19
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -fPIC -Wl,--unresolved-symbols=ignore-all -o $@ libid3tag/.libs/*.o \
20 20
 		`cat ../../xbmc/cores/DllLoader/exports/wrapper.def` \
21 21
 		../../xbmc/cores/DllLoader/exports/wrapper.o
22 22
 endif
3  lib/libsidplay2/Makefile.in
@@ -57,7 +57,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
57 57
 		-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
58 58
 		@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS) $(BUNDLE1_O)
59 59
 else
60  
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
  60
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all \
  61
+		`cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
61 62
 endif
62 63
 
63 64
 include @abs_top_srcdir@/Makefile.include
3  lib/nosefart/Makefile.in
@@ -31,7 +31,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
31 31
 	-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
32 32
 	@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS) $(BUNDLE1_O)
33 33
 else
34  
-	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
  34
+	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all \
  35
+		`cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
35 36
 endif
36 37
 
37 38
 include @abs_top_srcdir@/Makefile.include
2  lib/snesapu/SNES/SNESAPU/Makefile.in
@@ -21,7 +21,7 @@ ifeq ($(findstring osx,$(ARCH)), osx)
21 21
 		-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
22 22
 		@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS)
23 23
 else
24  
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) \
  24
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all \
25 25
 		`cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
26 26
 endif
27 27
 
3  lib/stsound/StSoundLibrary/Makefile.in
@@ -24,7 +24,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
24 24
 	-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
25 25
 	@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS) $(BUNDLE1_O)
26 26
 else
27  
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
  27
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all \
  28
+		`cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
28 29
 endif
29 30
 
30 31
 include @abs_top_srcdir@/Makefile.include
3  lib/timidity/Makefile.in
@@ -56,7 +56,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
56 56
 	$(CXX) $(LDFLAGS) -Wl,-alias_list,@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper_mach_alias -bundle \
57 57
 	-undefined dynamic_lookup -read_only_relocs suppress -o $@ @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS) $(BUNDLE1_O)
58 58
 else
59  
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o -Wl,--version-script=exports.def
  59
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` \
  60
+		@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o -Wl,--version-script=exports.def
60 61
 endif
61 62
  
62 63
 include @abs_top_srcdir@/Makefile.include
3  lib/vgmstream/Makefile.in
@@ -199,7 +199,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
199 199
 	-bundle -undefined dynamic_lookup -read_only_relocs suppress  -o $@ \
200 200
 	@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS) $(BUNDLE1_O)
201 201
 else
202  
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
  202
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all \
  203
+		`cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
203 204
 
204 205
 endif
205 206
 
3  lib/xbadpcm/Makefile.in
@@ -12,7 +12,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
12 12
 	@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o *.o $(BUNDLE1_O)
13 13
 	chmod +x $@
14 14
 else
15  
-	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ *.o `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
  15
+	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ *.o -Wl,--unresolved-symbols=ignore-all \
  16
+		`cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
16 17
 endif
17 18
 
18 19
 include @abs_top_srcdir@/Makefile.include
6  xbmc/screensavers/rsxs-0.9/xbmc/Makefile.in
@@ -28,7 +28,7 @@ ifeq ($(findstring osx,$(ARCH)), osx)
28 28
 	$(CXX) $(CXXFLAGS) $(LDFLAGS) -bundle -flat_namespace -undefined dynamic_lookup \
29 29
 		-o $(SOLARWINDS-OUT) $(RSXS)/src/solarwinds/*.o $(RSXS-OBJS)
30 30
 else
31  
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(SOLARWINDS-OUT) $(RSXS)/src/solarwinds/*.o $(RSXS-OBJS) -lXmu
  31
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(SOLARWINDS-OUT) $(RSXS)/src/solarwinds/*.o $(RSXS-OBJS) -lXmu -lGL -lX11 -lGLU
32 32
 endif
33 33
 
34 34
 $(PLASMA-OUT): $(PLASMA-DEP)
@@ -36,7 +36,7 @@ ifeq ($(findstring osx,$(ARCH)), osx)
36 36
 	$(CXX) $(CXXFLAGS) $(LDFLAGS) -bundle -flat_namespace -undefined dynamic_lookup \
37 37
 		-o $(PLASMA-OUT)     $(RSXS)/src/plasma/*.o     $(RSXS-OBJS)
38 38
 else
39  
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(PLASMA-OUT)     $(RSXS)/src/plasma/*.o     $(RSXS-OBJS) -lXmu
  39
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(PLASMA-OUT)     $(RSXS)/src/plasma/*.o     $(RSXS-OBJS) -lXmu -lGL -lX11 -lGLU
40 40
 endif
41 41
 
42 42
 $(EUPHORIA-OUT): $(EUPHORIA-DEP)
@@ -44,7 +44,7 @@ ifeq ($(findstring osx,$(ARCH)), osx)
44 44
 	$(CXX) $(CXXFLAGS) $(LDFLAGS) -bundle -flat_namespace -undefined dynamic_lookup \
45 45
 		-o $(EUPHORIA-OUT)   $(RSXS)/src/euphoria/*.o   $(RSXS)/src/pngimage.o $(RSXS-OBJS) -lpng
46 46
 else
47  
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(EUPHORIA-OUT)   $(RSXS)/src/euphoria/*.o   $(RSXS)/src/pngimage.o $(RSXS-OBJS) -lXmu -lpng
  47
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(EUPHORIA-OUT)   $(RSXS)/src/euphoria/*.o   $(RSXS)/src/pngimage.o $(RSXS-OBJS) -lXmu -lpng -lGL -lX11 -lGLU
48 48
 endif
49 49
 
50 50
 $(SOLARWINDS-DEP) : $(RSXS)
2  xbmc/visualizations/OpenGLSpectrum/Makefile.in
@@ -7,9 +7,11 @@ SLIB=@abs_top_srcdir@/addons/visualization.glspectrum/opengl_spectrum.vis
7 7
 ifeq (@USE_OPENGLES@,1)
8 8
   OBJS+=../EGLHelpers/Shader.o ../EGLHelpers/GUIShader.o ../../guilib/MatrixGLES.o
9 9
   DEFINES+=-DHAS_GLES
  10
+  LDFLAGS+=-lGLESv2
10 11
 else
11 12
   DEFINES+=-DHAS_SDL
12 13
   DEFINES+=-DHAS_SDL_OPENGL
  14
+  LDFLAGS+=-lGL
13 15
 endif
14 16
 
15 17
 $(SLIB): $(OBJS)
2  xbmc/visualizations/WaveForm/Makefile.in
@@ -8,8 +8,10 @@ SLIB=@abs_top_srcdir@/addons/visualization.waveform/Waveform.vis
8 8
 ifeq (@USE_OPENGLES@,1)
9 9
   OBJS=Main_gles.o ../EGLHelpers/Shader.o ../EGLHelpers/GUIShader.o ../../guilib/MatrixGLES.o
10 10
   DEFINES+=-DHAS_GLES
  11
+  LDFLAGS+=-lGLESv2
11 12
 else
12 13
   DEFINES+=-DHAS_SDL_OPENGL
  14
+  LDFLAGS+=-lGL -lGLU
13 15
 endif
14 16
 
15 17
 $(SLIB): $(OBJS)

0 notes on commit 493650f

Please sign in to comment.
Something went wrong with that request. Please try again.