From: Tasos L. <tla...@gm...> - 2011-02-08 07:30:10
Attachments:
signature.asc
|
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) I have set the following dependencies: t4k_common : librsvg sdl_image sdl_mixer sdl_net sdl_pango tuxmath: t4k_common If I explicitly install sdl_ttf then tuxmath compiles and works fine but i can't see any links to sdl_ttf using ldd. tuxmath: 1.9.0 t4k_common: 0.0.3 (I also tried with 0.1.0) [1] http://aur.archlinux.org/packages.php?ID=22660 [2] http://aur.archlinux.org/packages.php?ID=45252 Thank you -- Tasos Latsas GPG : 0x219810C9 / B487 351A 6EEC B7C3 E78E F4D9 7217 5B4B 2198 10C9 Jabber: tl...@ja... www : http://ttys.homelinux.net |
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 |
From: Volker G. <vo...@no...> - 2011-02-09 00:20:26
|
David Bruce schrieb: > 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. Note that a *.pc file can "Require" another package. The idea is that you don't have to specify anything but your own stuff in the "Libs" section. However, this works only for dependencies that provide a *.pc file. All other libs you'll have to specify in your "Libs.private" section. (which will only be used for static builds, in contrast to "Libs") > 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. This is not a question of pkg-config. It is a question of Autoconf. If you collect some helper variables during the checks in configure.ac, you can simply include those variables in your *.pc.in file. (something like @DEP_PKGS@, @DEP_LIBS@) In general, I recommend to check for each library whether it is available via pkg-config. If it isn't, try something like AC_CHECK_LIB as a workaround. PKG_CHECK_EXISTS([...], PKG_CHECK_MODULES([...], AC_CHECK_LIB(...) ) One final thought: Nowadays almost all libraries ship with *.pc files. However, some distributions like Debian don't install those, maybe because their build scripts were written in a time where those libraries didn't provide a *.pc file. I think it would be a good idea to provide bug reports for those distributions, but I didn't yet find the time to do that. Any volunteers? Greets, Volker -- Volker Grabsch ---<<(())>>--- |
From: David B. <dav...@gm...> - 2011-02-09 20:06:51
|
Hi Volker, That helps a lot - I just want to make sure I understand correctly. > This is not a question of pkg-config. It is a question of Autoconf. > If you collect some helper variables during the checks in configure.ac, > you can simply include those variables in your *.pc.in file. (something > like @DEP_PKGS@, @DEP_LIBS@) Thanks - so I've created the following: T4K_COMMON_DEP_PKGS - for needed libs that have *.pc files T4K_COMMON_DEP_LIBS - for needed libs without *.pc files T4K_COMMON_DEP_LIBS_PRIVATE - for secondary dependencies incurred by libs without *.pc files. So the t4k_common.pc.in is now very simple (see below). For now, I've just hard-coded the previous values into these variables within configure.ac to be sure the substitution is working as intended, so the build isn't yet any smarter than before. So, if I make sure these variables correctly track the configure options (e.g. SDL_Pango vs. SDL_ttf, SDL_net vs no network support, etc.), this should work as intended, if I understand correctly. Thanks a ton - David t4k_common.pc.in: ---------------------------------------------------- # Process with configure script to generate t4k_common.pc file for pkg-config # NOTE: we rely heavily on substituted output variables from Autoconf # or Cmake to generate a t4k_common.pc that reflects conditional build # with optional libraries. prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: @PACKAGE_NAME@ Description: Tux4Kids common routines Version: @VERSION@ # List needed libs that have *.pc files in "Requires:" Requires: @T4K_COMMON_DEP_PKGS@ # List libs "by hand" that don't have .pc files: Libs: -l@PACKAGE_TARNAME@ -L${libdir} @T4K_COMMON_DEP_LIBS@ Cflags: -I${includedir} # List secondary dependencies of libs that don't have *.pc files # (needed for static linking) Libs.private: @T4K_COMMON_DEP_LIBS_PRIVATE@ |
From: Volker G. <vo...@no...> - 2011-02-10 02:43:08
|
David Bruce schrieb: > Hi Volker, > > > This is not a question of pkg-config. It is a question of Autoconf. > > If you collect some helper variables during the checks in configure.ac, > > you can simply include those variables in your *.pc.in file. (something > > like @DEP_PKGS@, @DEP_LIBS@) > > Thanks - so I've created the following: > T4K_COMMON_DEP_PKGS - for needed libs that have *.pc files > T4K_COMMON_DEP_LIBS - for needed libs without *.pc files > T4K_COMMON_DEP_LIBS_PRIVATE - for secondary dependencies incurred by > libs without *.pc files. > > So the t4k_common.pc.in is now very simple (see below). Your solution is quite close to what I had in mind. However, I would change two things: 1) drop the 'T4K_COMMON_' prefix, as the other names are already unambiguous within a single project. 2) is the DEP_LIBS (aka T4K_COMMON_DEP_LIBS) variable really necessary? As long as you produce a shared library, there is no need to explicitly specify the dependency libs. I think you can safely put all non-*.pc libraries together with its secondary dependencies into DEP_LIBS_PRIVATE. Note that I assume in 2) that your library is created as a shared library. However, if it is really always linked statically, in mingw-cross-env as well as all other toolchains, then your approach is correct. BTW, in mingw-cross-env (i686-pc-mingw32-pkg-config) the --static flag is always provided, so Libs.private is always used. > For now, I've just hard-coded the previous values into these variables > within configure.ac to be sure the substitution is working as > intended, so the build isn't yet any smarter than before. So, if I > make sure these variables correctly track the configure options (e.g. > SDL_Pango vs. SDL_ttf, SDL_net vs no network support, etc.), this > should work as intended, if I understand correctly. Yes, that's the idea. The strategy I described here is used but a lot of other libraries. You might want to have a look at the *.pc.in files of other packages like cURL or GTK. Those will give you some more ideas about how to manage these things. Greets, Volker -- Volker Grabsch ---<<(())>>--- |
From: Tasos L. <tla...@gm...> - 2011-02-10 06:54:53
Attachments:
signature.asc
|
On 02/09/2011 10:06 PM, David Bruce wrote: > Hi Volker, > > That helps a lot - I just want to make sure I understand correctly. > >> This is not a question of pkg-config. It is a question of Autoconf. >> If you collect some helper variables during the checks in configure.ac, >> you can simply include those variables in your *.pc.in file. (something >> like @DEP_PKGS@, @DEP_LIBS@) > > Thanks - so I've created the following: > T4K_COMMON_DEP_PKGS - for needed libs that have *.pc files > T4K_COMMON_DEP_LIBS - for needed libs without *.pc files > T4K_COMMON_DEP_LIBS_PRIVATE - for secondary dependencies incurred by > libs without *.pc files. > > So the t4k_common.pc.in is now very simple (see below). > > For now, I've just hard-coded the previous values into these variables > within configure.ac to be sure the substitution is working as > intended, so the build isn't yet any smarter than before. So, if I > make sure these variables correctly track the configure options (e.g. > SDL_Pango vs. SDL_ttf, SDL_net vs no network support, etc.), this > should work as intended, if I understand correctly. > > Thanks a ton - > > David > > > t4k_common.pc.in: ---------------------------------------------------- > > # Process with configure script to generate t4k_common.pc file for pkg-config > # NOTE: we rely heavily on substituted output variables from Autoconf > # or Cmake to generate a t4k_common.pc that reflects conditional build > # with optional libraries. > > prefix=@prefix@ > exec_prefix=@exec_prefix@ > libdir=@libdir@ > includedir=@includedir@ > > Name: @PACKAGE_NAME@ > Description: Tux4Kids common routines > Version: @VERSION@ > > # List needed libs that have *.pc files in "Requires:" > Requires: @T4K_COMMON_DEP_PKGS@ > # List libs "by hand" that don't have .pc files: > Libs: -l@PACKAGE_TARNAME@ -L${libdir} @T4K_COMMON_DEP_LIBS@ > Cflags: -I${includedir} > > # List secondary dependencies of libs that don't have *.pc files > # (needed for static linking) > Libs.private: @T4K_COMMON_DEP_LIBS_PRIVATE@ Wow that was fast.. Will this be commited to the git repo? Where can I pull the changes from? Thank you everyone! =) -- Tasos Latsas GPG : 0x219810C9 / B487 351A 6EEC B7C3 E78E F4D9 7217 5B4B 2198 10C9 Jabber: tl...@ja... www : http://ttys.homelinux.net |
From: Tasos L. <tla...@gm...> - 2011-02-09 07:07:16
Attachments:
signature.asc
|
On 02/09/2011 02:20 AM, Volker Grabsch wrote: > David Bruce schrieb: >> 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. > > Note that a *.pc file can "Require" another package. The idea is > that you don't have to specify anything but your own stuff in the > "Libs" section. > > However, this works only for dependencies that provide a *.pc file. > All other libs you'll have to specify in your "Libs.private" section. > (which will only be used for static builds, in contrast to "Libs") > >> 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. > > This is not a question of pkg-config. It is a question of Autoconf. > If you collect some helper variables during the checks in configure.ac, > you can simply include those variables in your *.pc.in file. (something > like @DEP_PKGS@, @DEP_LIBS@) > > In general, I recommend to check for each library whether it is > available via pkg-config. If it isn't, try something like AC_CHECK_LIB > as a workaround. > > PKG_CHECK_EXISTS([...], > PKG_CHECK_MODULES([...], > AC_CHECK_LIB(...) > ) > I will also look into it, see how I can help, but I don't promise as pkg-config/Autoconf stuff are new to me.. > One final thought: Nowadays almost all libraries ship with *.pc files. > However, some distributions like Debian don't install those, maybe > because their build scripts were written in a time where those libraries > didn't provide a *.pc file. I think it would be a good idea to provide > bug reports for those distributions, but I didn't yet find the time > to do that. Any volunteers? > From a quick look here [1] only Archlinux and Fedora from the major distributions ship SDL_ttf.pc (i dont know if this list is up-to-date though). I could file those bug reports if the Autoconf solution doesn't work. > > Greets, > Volker > Cheers [1] http://pkgs.org/search/?keyword=sdl_ttf&search_on=smart&distro=0&arch=32-bit&exact=0 -- Tasos Latsas GPG : 0x219810C9 / B487 351A 6EEC B7C3 E78E F4D9 7217 5B4B 2198 10C9 Jabber: tl...@ja... www : http://ttys.homelinux.net |
From: Volker G. <vo...@no...> - 2011-02-10 13:23:07
|
Tasos Latsas schrieb: > I will also look into it, see how I can help, but I don't promise as > pkg-config/Autoconf stuff are new to me.. Feel free to ask if you run into any problems. I'd be happy to have a look at your *.ac / *.in files. > > However, some distributions like Debian don't install those, maybe > > because their build scripts were written in a time where those libraries > > didn't provide a *.pc file. I think it would be a good idea to provide > > bug reports for those distributions, but I didn't yet find the time > > to do that. Any volunteers? > > From a quick look here [1] only Archlinux and Fedora from the major > distributions ship SDL_ttf.pc (i dont know if this list is up-to-date > though). I could file those bug reports if the Autoconf solution doesn't > work. The distro bugreports are not about how to make things _work_; they are about how to make things _easier_. So I recommend to file those bugreports in any case, if you find some time for that. The bugreports are not to solve things _now_, but to make things better in the future. Currently, lots of projects are facing the same issues and the same ugly workaround as you do - not because the library authors don't provide *.pc file, but because the distributions don't install those. That's what's making all your life unnecessarily hard. As soon as all major distros fix those issues, many projects will be able to throw out lots of workarounds from their configure.ac files. :-) Greets, Volker -- Volker Grabsch ---<<(())>>--- |
From: David B. <dav...@gm...> - 2011-02-10 13:56:30
Attachments:
configure.ac
t4k_common.pc.in
|
Hi Volker, Tasos, I removed the unneeded T4K_COMMON prefix from the vars as suggested. For the moment I still have separate DEP_LIBS and DEP_LIBS_PRIVATE, but I can simplify that later. The update is in t4k_common's git repo: git clone git://git.debian.org/git/tux4kids/t4kcommon.git > Feel free to ask if you run into any problems. I'd be happy to have > a look at your *.ac / *.in files. Thanks - I've attached those files. I can think of a few things I haven't yet addressed: 1. DEP_LIBS_PRIVATE as of yet is just contains all the secondary dependencies for all the non- *.pc libs. It was not created very carefully, basically grabbed from the args passed to gcc at the end of the regular linux non-static build process, after which I eliminated duplicates and the primary dependencies. So it might possibly have some things in there that wouldn't be needed if some of the optional libs are deselected. I think I should make the lib checks in configure.ac mimic the pkg-config process more closely, adding to this var as each library is located. 2. As you suggested, the lib checks use a two stage procedure, first trying PKG_CHECK_MODULES, then AC_CHECK_LIB if needed. Once the lib is detected, by either method, I add the library name to DEP_LIBS (for the ones I know have *.pc files). But this might result in an error if the fall-back to AC_CHECK_LIB was required. So I think perhaps DEP_LIBS should be updated in the "action_if_found" part of PKG_CHECK_MODULES. I will look at some *.pc.in files from other projects, as you suggested, for working examples I can follow. Thanks, David |
From: Tasos L. <tla...@gm...> - 2011-02-10 14:06:16
Attachments:
signature.asc
|
On 02/10/2011 03:22 PM, Volker Grabsch wrote: > Tasos Latsas schrieb: >> I will also look into it, see how I can help, but I don't promise as >> pkg-config/Autoconf stuff are new to me.. > > Feel free to ask if you run into any problems. I'd be happy to have > a look at your *.ac / *.in files. > >>> However, some distributions like Debian don't install those, maybe >>> because their build scripts were written in a time where those libraries >>> didn't provide a *.pc file. I think it would be a good idea to provide >>> bug reports for those distributions, but I didn't yet find the time >>> to do that. Any volunteers? >> >> From a quick look here [1] only Archlinux and Fedora from the major >> distributions ship SDL_ttf.pc (i dont know if this list is up-to-date >> though). I could file those bug reports if the Autoconf solution doesn't >> work. > > The distro bugreports are not about how to make things _work_; they > are about how to make things _easier_. So I recommend to file those > bugreports in any case, if you find some time for that. The bugreports > are not to solve things _now_, but to make things better in the future. > > Currently, lots of projects are facing the same issues and the same > ugly workaround as you do - not because the library authors don't > provide *.pc file, but because the distributions don't install those. > That's what's making all your life unnecessarily hard. As soon as > all major distros fix those issues, many projects will be able to > throw out lots of workarounds from their configure.ac files. :-) > > Yes I understand that, I'll try to file some this weekend and post back. Maybe a feature request instead of a bugreport would be more appropriate? One last thing, under which packages should I file them? sdl_ttf and sdl_mixer, or sdl_ttf only? Thanks -- Tasos Latsas GPG : 0x219810C9 / B487 351A 6EEC B7C3 E78E F4D9 7217 5B4B 2198 10C9 Jabber: tl...@ja... www : http://ttys.homelinux.net |
From: Volker G. <vo...@no...> - 2011-02-10 23:31:50
|
Tasos Latsas schrieb: > Volker Grabsch wrote: > > Currently, lots of projects are facing the same issues and the same > > ugly workaround as you do - not because the library authors don't > > provide *.pc file, but because the distributions don't install those. > > That's what's making all your life unnecessarily hard. As soon as > > all major distros fix those issues, many projects will be able to > > throw out lots of workarounds from their configure.ac files. :-) > > > Yes I understand that, I'll try to file some this weekend and post back. > Maybe a feature request instead of a bugreport would be more appropriate? I don't know. It's really hard to say whether a missing installed file is a bug or a missing feature. > One last thing, under which packages should I file them? sdl_ttf and > sdl_mixer, or sdl_ttf only? I'd report it under each package where this bug occurs on the given distribution. Gruß Volker -- Volker Grabsch ---<<(())>>--- |