On 24/05/2016 04:33, Marvin Humphrey wrote:
Thus the more general strategy, which I hope will work across all hosts is:

1. Build a static archive from the `core` code.
2. Generate host-specific extension code wherever the host wants it to live.
3. Build the host extension telling the build system about various include
   directories and telling it to link in the static archive.

There's another complication which might affect the Python and Go bindings, too. If you link a static library into a dynamic library with GNU binutils, you have to use the `--whole-archive` linker option. Otherwise, some object files in the static library might be ignored. So the link command should look something like

    gcc \
        [.o files] \
        -Wl,--whole-archive \
        libclownfish.a \
        -Wl,--no-whole-archive \
        [dynamic libs] \
        ...

The Solaris linker seems to require `-z allextract` and `-z defaultextract`. On OS X, we need `-all_load`. So it seems that we have to detect the linker as well.

The tricky bit here is that these files have per-host code, as opposed to
the core code which is host-agnostic.  So I actually think we should rely
on the host to build them rather than the Charmonizer-generated `Makefile`.

Makes sense. I'll change the Perl bindings to follow this approach.

+1

What about code like `xs/XSBind.c`? Should it be compiled by the host, too?

Nick

Reply via email to