[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Build static binaries of chicken apps in a docker container

From: Kristian Lein-Mathisen
Subject: Re: Build static binaries of chicken apps in a docker container
Date: Sun, 20 Jun 2021 21:16:11 +0200

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 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


On Sun, Jun 20, 2021, 17:53 Théo Cavignac <> wrote:

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:

Currently is uses my own Chicken docker images (Images: , Dockerfile: ) 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]