[racket] Automatically include external dynamic libraries into distribution

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Mar 28 08:14:10 EDT 2011

At Mon, 28 Mar 2011 11:35:09 +0100, Erich Rast wrote:
> Is there a way to automatically include all dynamic libraries used into
> a distribution? -- i.e. some option to create a distribution that is
> guaranteed to be self-contained?
>
> [...]
>
> Or does "create distribution" already do this for me?

Not in general. One problem is that dynamic libraries in "/usr/lib"
tend to refer to other dynamic libraries, and they do so explicitly
using the path "/usr/lib". So it doesn't work to just copy a set of
libraries; they have to be adjusted using platform-specific tools.

The case of a single replacement library is simpler, though...

> I know that this conflicts with the idea of having dynamic libraries in
> the first place but sometimes it is needed. In this particular case I
> need to ensure that libcrypto supports Camellia, but e.g. on Ubuntu it's
> per default not compiled with support for it. Right now I have to
> manually copy, tweak, and locally require the respective PLanet package
> (crypto) to define an appropriate runtime-path. 

If you put your alternate "libcrypto.so" in the Racket-specific "lib"
directory (i.e., the same place that "libplplot.so" resides), then the
`crypto' Planet package should look there first without changing the
Planet package.

If you further change the Planet package to use

 (define-runtime-path libcrypto '(so "libcrypto.so"))

and use `libcrypto' with `ffi-lib', then `raco dist' should pull your
"libcrypto.so" alternate along when it assembles a distribution.


It almost works to use the `define-runtime-path' declaration above in
any module (i.e., without changing the Planet package), since that
would pull "libcrypto.so" into the distribution. Unfortunately, simply
pulling "libcrypto.so" along does not enable the Planet package to find
it in the distribution.


> Also, is there a list of global dependencies for racket/gui applications
> and each platform somewhere?

I'll put the following list in the docs. (Numbers in square brackets
indicate a version that is tried first, and if that fails, the name
without the version is tried.)

racket/draw:
 libglib-2.0[.0]
 libgmodule-2.0[.0]
 libgobject-2.0[.0]
 libpango-1.0[.0]
 libpangocairo-1.0[.0]
 libcairo[.2]
 libjpeg[.62]
 libpng12[.0] or libpng

racket/gui/base:
 libgdk-x11-2.0[.0]
 libgdk_pixbuf-2.0[.0]
 libgtk-x11-2.0[.0]
 libgdkglext-x11-1.0[.0]  (optional --- for OpenGL support)
 libgtkglext-x11-1.0[.0]  (optional --- for OpenGL support)
 libunique-1.0[.0]        (optional --- for single-instance support)



Posted on the users mailing list.