Permalink
Browse files

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...
1 parent bed0cb5 commit 1e87b66a24986bc13799ad44a3b2813fcf029733 theuni committed with Sep 16, 2011
@@ -22,7 +22,7 @@ ifeq ($(findstring osx,$(ARCH)), osx)
@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o CxImage/*.o jasper/*/*.o jbig/*.o raw/*.o
else
$(CXX) $(CFLAGS) $(LDFLAGS) -shared -o $(SLIB) -Wl,--whole-archive $(SLIBS) \
- -Wl,--no-whole-archive -lpng -ljasper -ljpeg -ltiff -lz \
+ -Wl,--no-whole-archive -lpng -ljasper -ljpeg -ltiff -lz -Wl,--unresolved-symbols=ignore-all \
`cat ../../xbmc/cores/DllLoader/exports/wrapper.def` \
../../xbmc/cores/DllLoader/exports/wrapper.o
endif
View
@@ -56,11 +56,12 @@ else
$(SYSDIR)/libdvdcss-$(ARCH).so: $(WRAPPER) libdvdcss/src/.libs/libdvdcss.a
$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ \
- libdvdcss/src/*.o \
+ libdvdcss/src/*.o -Wl,--unresolved-symbols=ignore-all \
`cat $(WRAPPER:.o=.def)` $(WRAPPER)
$(SYSDIR)/libdvdnav-$(ARCH).so: $(WRAPPER) $(DVDCSS_A) libdvdread/obj/libdvdread.a libdvdnav/obj/libdvdnav.a
$(CC) -o $@ $(LDFLAGS) -Wl,--soname,$@ $(DVDCSS_O) libdvdread/obj/*.o libdvdnav/obj/*.o \
+ -Wl,--unresolved-symbols=ignore-all \
`cat $(WRAPPER:.o=.def)` $(WRAPPER)
endif
View
@@ -14,7 +14,7 @@ ifeq ($(findstring osx,$(ARCH)), osx)
-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS)
else
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) \
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all \
`cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
endif
@@ -24,7 +24,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS)
else
- $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -shared -o $@ `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` \
+ $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -shared -o $@ -Wl,--unresolved-symbols=ignore-all \
+ `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` \
@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
endif
@@ -16,7 +16,7 @@ $(SLIB): libid3tag/.libs/libid3tag.dylib
chmod +x $@
else
$(SLIB): libid3tag/.libs/libid3tag.so
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -fPIC -o $@ libid3tag/.libs/*.o \
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -fPIC -Wl,--unresolved-symbols=ignore-all -o $@ libid3tag/.libs/*.o \
`cat ../../xbmc/cores/DllLoader/exports/wrapper.def` \
../../xbmc/cores/DllLoader/exports/wrapper.o
endif
@@ -57,7 +57,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS) $(BUNDLE1_O)
else
- $(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
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all \
+ `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
endif
include @abs_top_srcdir@/Makefile.include
View
@@ -31,7 +31,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS) $(BUNDLE1_O)
else
- $(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
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all \
+ `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
endif
include @abs_top_srcdir@/Makefile.include
@@ -21,7 +21,7 @@ ifeq ($(findstring osx,$(ARCH)), osx)
-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS)
else
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) \
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all \
`cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
endif
@@ -24,7 +24,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS) $(BUNDLE1_O)
else
- $(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
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all \
+ `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
endif
include @abs_top_srcdir@/Makefile.include
View
@@ -56,7 +56,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
$(CXX) $(LDFLAGS) -Wl,-alias_list,@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper_mach_alias -bundle \
-undefined dynamic_lookup -read_only_relocs suppress -o $@ @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS) $(BUNDLE1_O)
else
- $(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
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` \
+ @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o -Wl,--version-script=exports.def
endif
include @abs_top_srcdir@/Makefile.include
@@ -199,7 +199,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
-bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \
@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS) $(BUNDLE1_O)
else
- $(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
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $(OBJS) -Wl,--unresolved-symbols=ignore-all \
+ `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
endif
View
@@ -12,7 +12,8 @@ ifeq ($(findstring osx,$(ARCH)), osx)
@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o *.o $(BUNDLE1_O)
chmod +x $@
else
- $(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
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ *.o -Wl,--unresolved-symbols=ignore-all \
+ `cat @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.def` @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
endif
include @abs_top_srcdir@/Makefile.include
@@ -28,23 +28,23 @@ ifeq ($(findstring osx,$(ARCH)), osx)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -bundle -flat_namespace -undefined dynamic_lookup \
-o $(SOLARWINDS-OUT) $(RSXS)/src/solarwinds/*.o $(RSXS-OBJS)
else
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(SOLARWINDS-OUT) $(RSXS)/src/solarwinds/*.o $(RSXS-OBJS) -lXmu
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(SOLARWINDS-OUT) $(RSXS)/src/solarwinds/*.o $(RSXS-OBJS) -lXmu -lGL -lX11 -lGLU
endif
$(PLASMA-OUT): $(PLASMA-DEP)
ifeq ($(findstring osx,$(ARCH)), osx)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -bundle -flat_namespace -undefined dynamic_lookup \
-o $(PLASMA-OUT) $(RSXS)/src/plasma/*.o $(RSXS-OBJS)
else
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(PLASMA-OUT) $(RSXS)/src/plasma/*.o $(RSXS-OBJS) -lXmu
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(PLASMA-OUT) $(RSXS)/src/plasma/*.o $(RSXS-OBJS) -lXmu -lGL -lX11 -lGLU
endif
$(EUPHORIA-OUT): $(EUPHORIA-DEP)
ifeq ($(findstring osx,$(ARCH)), osx)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -bundle -flat_namespace -undefined dynamic_lookup \
-o $(EUPHORIA-OUT) $(RSXS)/src/euphoria/*.o $(RSXS)/src/pngimage.o $(RSXS-OBJS) -lpng
else
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(EUPHORIA-OUT) $(RSXS)/src/euphoria/*.o $(RSXS)/src/pngimage.o $(RSXS-OBJS) -lXmu -lpng
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(EUPHORIA-OUT) $(RSXS)/src/euphoria/*.o $(RSXS)/src/pngimage.o $(RSXS-OBJS) -lXmu -lpng -lGL -lX11 -lGLU
endif
$(SOLARWINDS-DEP) : $(RSXS)
@@ -7,9 +7,11 @@ SLIB=@abs_top_srcdir@/addons/visualization.glspectrum/opengl_spectrum.vis
ifeq (@USE_OPENGLES@,1)
OBJS+=../EGLHelpers/Shader.o ../EGLHelpers/GUIShader.o ../../guilib/MatrixGLES.o
DEFINES+=-DHAS_GLES
+ LDFLAGS+=-lGLESv2
else
DEFINES+=-DHAS_SDL
DEFINES+=-DHAS_SDL_OPENGL
+ LDFLAGS+=-lGL
endif
$(SLIB): $(OBJS)
@@ -8,8 +8,10 @@ SLIB=@abs_top_srcdir@/addons/visualization.waveform/Waveform.vis
ifeq (@USE_OPENGLES@,1)
OBJS=Main_gles.o ../EGLHelpers/Shader.o ../EGLHelpers/GUIShader.o ../../guilib/MatrixGLES.o
DEFINES+=-DHAS_GLES
+ LDFLAGS+=-lGLESv2
else
DEFINES+=-DHAS_SDL_OPENGL
+ LDFLAGS+=-lGL -lGLU
endif
$(SLIB): $(OBJS)

0 comments on commit 1e87b66

Please sign in to comment.