From: David B. <dav...@gm...> - 2011-02-08 19:28:04
|
Hi Tasos, On Tue, Feb 8, 2011 at 7:29 AM, Tasos Latsas <tla...@gm...> wrote: > Hello, > I created pkgbuilds for the Archlinux distribution, for tuxmath [1] and > t4k_common [2]. > t4k_common compiles fine but tuxmath fails with: > /usr/bin/ld: cannot find -lSDL_ttf > > I have sdl_pango installed, I thought that it will use sdl_pango if > present and if not then fallback to sdl_ttf. (correct me if I am wrong) Yes, that's how it is supposed to work, and how it does work at run time, but it looks like we are requiring SDL_ttf in the build even though it doesn't actually get used. > If I explicitly install sdl_ttf then tuxmath compiles and works fine but > i can't see any links to sdl_ttf using ldd. I think the problem is in t4k_common's pkg-config file, t4k_common.pc.in (reproduced below). My knowledge of pkg-config is limited, but looking at the file it's pretty clear that I hard-coded a dependency on SDL_ttf into the "Libs" section. t4k_common's build process can detect if SDL_Pango is available, but the problem comes in with the static linking needed for the mingw-cross-env build. For static linking, t4k_common needs to supply all the compiler arguments for all the dependencies, and this only works "automagically" for dependencies that themselves have pkg-config *.pc files. I haven't figured out how to write a *.pc file that conditionally passes the arguments for either SDL_Pango (plus its deps) or SDL_ttf (plus deps) to the tuxmath linking step. Have I confused everyone yet? If anyone else on this list is proficient with pkg-config, help would be appreciated. I'm cc'ing Volker Grabsch (mingw-cross-env maintainer) in case this issue has come up in static linking for other mingw-cross-env packages, and because Volker seems to know this stuff really, really well. David Bruce t4kcommon/t4k_common.pc.in: -------------------------------------------------- prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: @PACKAGE_NAME@ Description: Tux4Kids common routines Version: @VERSION@ # AFAICT we can only list libs with .pc files in "Requires:" Requires: sdl >= 1.2.0 SDL_image SDL_Pango librsvg-2.0 libxml-2.0 # List libs "by hand" that don't have .pc files: Libs: -l@PACKAGE_TARNAME@ -L${libdir} -lSDL_mixer -lSDL_ttf -lSDL_net Cflags: -I${includedir} # Because SDL_mixer and SDL_ttf do not have .pc files on some platforms, # we list their static dependencies here: Libs.private: -mwindows -L/opt/mingw-cross-env/usr/i686-pc-mingw32/lib -lmikmod -lsmpeg -lstdc++ -lmingw32 -lSDLmain -liconv -luser32 -lgdi32 -lwinmm -ldxguid -lSDL -lpthread -lvorbisfile -lvorbis -lm -logg -lfreetype |