A. Static compilation

When I tried to profile XSieve, I realized that I need one solid XSieve binary with the all functionality compiled in. This appendix is a reminder how I made it.

Procedure A.1. Making a static XSieve binary

  1. Compile XSieve as usual

    If it doesn't link, don't worry. All you need is the object files. To enrich the binary, I used the following:

    $ CFLAGS='-O0 -g -pg' ./configure ...
    • -O0 switches off optimization.

    • -g produces debugging information.

    • -pg generates profiling code.

  2. Install static Guile and libxml2

    Use the following configure command.

    $ CFLAGS='-O0 -g -pg' LDFLAGS='-pg' ./configure --enable-shared=no ...

    The new feature is --enable-shared=no.

  3. Install static libxslt

    The configure command is similar to the previous, but you also have to specify Guile information.

    $ CFLAGS='-O0 -g -pg' LDFLAGS='-pg -L...path_to_guile.../lib -lguile' ./configure --enable-shared=no ...
  4. Patch libxslt

    Edit the file libexslt/functions.c. Find the function exsltFuncRegister. Add the following line before the function:

    void xsieve_sourceforge_net_init(void);

    Add inside the function:

  5. Re-build libxslt

    Now xsltproc doesn't compile. To fix the problem, enter the directory xsltproc and say

    $ make

    The link command which fails looks like the following:

    gcc -O0 -g -pg -Wall -pg -o xsltproc xsltproc.o ...

    Correct the compilation command and run it manually.

    gcc -O0 -g -pg -Wall -pg -o xsltproc ...path_to_xsieve.../src/.libs/*.o xsltproc.o ...

    Install the new binary.

Use the new xsltproc binary to process XSieve stylesheets. XSieve is compiled in.