Sign in to follow this  
Decrius

[C++] Cairo + librsvg DLL hell clean up distribution

Recommended Posts

I recently got into Cairo and additionally with librsvg (to load SVG files). It works nice and I really like it. There is however one point that I prefer to hide a little more. It is the major dependency list that comes with these 2 libraries, and consequently 21 DLL files. Currently, I must add the following DLL files to the executable directory: - bzip2 - freetype6 - libcairo-2 - libcroco-0.6-3 - libexpat-1 - libfontconfig-1 - libgdk_pixbuf-2.0-0 - libgio-2.0-0 - libglib-2.0-0 - libgmodule-2.0-0 - libgobject-2.0-0 - libgsf-1-114 - libpango-1.0-0 - libpangocairo-1.0-0 - libpangoft2-1.0-0 - libpangowin32-1.0-0 - libpng12-0 - libsvg-2-2 - libxml2 - libxml2-2 (equals libxml2, just had to rename it) - zlib1 And a few unrelated to Cairo / librsvg: - lua5.1 - lua51 - SDL Is there a way I can pack these? Or can move them to a different directory (a sub-directory) then the executables directory? Ultimately I would statically link these, but I fear this will be an outright pain in the **s, I was very glad the binaries were made available by GTK. Barely any of these projects has a project file attached (either VS or any other, CodeBlocks opens most), and makefiles I'm not so savvy with... FYI: I use Win7-32 with GCC 4.4.0 Any suggestions to clean up this mess? Since half the DLL's (or parts of the DLL's) I don't even need, it just requests them and must thus be there. Thank you!

Share this post


Link to post
Share on other sites
Unfortunately, I don't have a solution for packing several dynamic libraries. Personally, I'm not really bothered by having these *.dlls and it's probably the way it is supposed to be.
Anyways, sorry for being a little off topic, but seeing that you are using cairo and librsvg on windows, would you mind telling me if you ran into the same problem I did a while ago?

Share this post


Link to post
Share on other sites
Quote:
Original post by kloffy
Unfortunately, I don't have a solution for packing several dynamic libraries. Personally, I'm not really bothered by having these *.dlls and it's probably the way it is supposed to be.
Anyways, sorry for being a little off topic, but seeing that you are using cairo and librsvg on windows, would you mind telling me if you ran into the same problem I did a while ago?


Hmm, I really find it very ugly this list of DLL's. But more annoying I find it that I don't even use a 10th of what all these DLL's can provide me...

As to your problem, I took your SVG and let it ran, this is the output:

Pango-CRITICAL **: pango_win32_font_map_get_font_cache: assertion `font_map != NULL' failed
**
Pango:ERROR:pangowin32.c:838:pango_win32_font_finalize: assertion failed: (win32font->fontmap != NULL)

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.


Or do I need to load fonts to pango first? I'm still in the dark with the whole GTK pack.

Share this post


Link to post
Share on other sites
That seems to be the same error I was getting. Removing the "text-anchor:middle;" should take care of the problem, so font loading doesn't seem to be the issue. Thank you for giving it a go, good to know that I'm not the only one out there having these problems.

Coming back to your original question: this guy seems to be asking for something similar on stackoverflow: Packing an exe + dll into one executable (not .NET).

Share this post


Link to post
Share on other sites
If your program never call functions in some of the DLLs then delay loading them should mean you don't need to include them with your game. However I'm not sure if the gcc linker supports that.

Also according to this article you can load DLLs from the current working directory or the PATH instead of where the exe is.

Having said all that, I've never had any troubles using static linking instead of DLLs. I'd give that a try first.

Share this post


Link to post
Share on other sites
Quote:
Original post by Adam_42
Having said all that, I've never had any troubles using static linking instead of DLLs. I'd give that a try first.


No neither have I. I really favor static linking over dynamic linking, but the only downside is that it is a pain to set up for so many projects. I have to compile all of them, and from previous experience this is really a road of pain, would take me several days if not more (and pray for there to be no compiling errors)...

I will check if static linked versions for GCC exist for these packs, else I'd just have to go the hard way or don't care about the DLL's...

Share this post


Link to post
Share on other sites
You can statically build all of those libraries. I have done it some time ago (mostly by manually creating MSVC projects, but of course it is possible to use GCC makefiles to build them). Only take into account that then your software will be under LGPL licence. If you don't want that you can statically build all except cairo and librsvg libraries. Cairo and librsvg build dynamically and link to all of those static libraries. Then you will have only two dll files for cairo and librsvg.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this