Hi Theo,

Thanks for sharing that! I had I similar problem and wanted to share what I
arrived at.

If there is a C-compiler on the target, you could compile to .c or even .o
and link on the target side. Unfortunately, that needs fiddling a bit
around with compiler and linker flags.

Another solution is to compile the static chicken as a static executable.
-static to csc makes it compile the Chicken runtime (so no libchicken.so)
and eggs in statically. But you can tell gcc to take it a step further and
link statically as well (-L -static). This will grab libc and friends from
your build machine. Sometimes that might work and requires very little
fiddling around with compiler flags.

    csc -L -static -static mymod.scm

K.


On Sun, Jun 20, 2021, 17:53 Théo Cavignac <theo.cavig...@gmail.com> wrote:

> Hi,
>
> I wanted to write and compile Chicken apps on my linux laptop and use
> them on some super computer I have access to.
>
> I naturally chose to compile static app with "csc -static main.scm -o
> main" which would link my app against a shared glibc version.
>
> While that is what I wanted, I encountered the problem that my Arch
> based distro has a very recent libc version, hence producing
> incompatible binary with the CentOS 6 supercomputer (for stability sake
> those are always running on super old OS).
>
> As a solutions I came up with a simple procedure that build my app
> inside a Debian Stable based docker container and extract the file.
>
> I figured it may be interesting for other people here so I want to share
> my script with you: https://github.com/Lattay/chicken-build-static.
>
> Currently is uses my own Chicken docker images (Images:
> https://hub.docker.com/r/lattay/chicken , Dockerfile:
> https://github.com/Lattay/chicken_docker ) so it can work on AMD64 or
> ARMv7 (nice for RPi 2 and 3), but it is very simple and can easily be
> used for other base images.
>
> If you are interested in this but the script does not does exactly do
> what you want, feel free to submit an issue, a PR or to send me a mail.
>
> Cheers,
>
> Théo
>
>
>
>

Reply via email to