Permalink
Browse files

build: linking cleanup

Fix several linking errors that are currently masked in one way or another

1. The 3rd party libs that we build can't resolve our wrapped functions until
   runtime.
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 matters for annoying libs like gles or directfb which
may depend on other libs that cannot resolve at link-time.
  • Loading branch information...
1 parent 37f29ed commit 27ead2007bb24c94ab7cf5d0bbeccbaacfe14097 theuni committed Sep 16, 2011
View
@@ -663,7 +663,7 @@ PKG_CHECK_MODULES([SQLITE3], [sqlite3],
[INCLUDES="$INCLUDES $SQLITE3_CFLAGS"; LIBS="$LIBS $SQLITE3_LIBS"],
AC_MSG_ERROR($missing_library))
PKG_CHECK_MODULES([PNG], [libpng],,
- AC_MSG_ERROR($missing_library) #check for cximage)
+ AC_MSG_ERROR($missing_library)) #check for cximage
PKG_CHECK_MODULES([PCRE], [libpcre],
[INCLUDES="$INCLUDES $PCRE_CFLAGS"; LIBS="$LIBS $PCRE_LIBS"]; \
AC_DEFINE([HAVE_LIBPCRE],[1],["Define to 1 if libpcre is installed"]),
@@ -761,7 +761,7 @@ else
AC_CHECK_LIB([SDL_mixer], [main],, AC_MSG_ERROR($missing_library))
AC_CHECK_LIB([SDL_image], [main], \
AC_DEFINE([HAVE_SDL_IMAGE],[1],["Define to 1 if sdl_image is installed"]), \
- AC_MSG_ERROR($missing_library)) # check for cximage
+ AC_MSG_ERROR($missing_library)) # check for TexturePacker
fi
fi
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 27ead20

Please sign in to comment.