[Top][All Lists]

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

Re: [Chicken-users] Static compile

From: felix winkelmann
Subject: Re: [Chicken-users] Static compile
Date: Fri, 29 Dec 2006 00:45:46 +0100

On 12/26/06, Joshua Griffith <address@hidden> wrote:

I'm attempting to statically compile all of the libraries used by a program
in order to make it stand alone.  It has the following declarations:
(require-extension syntax-case)
(require-extension csv)
(require-extension args)
(declare (uses utils))
(declare (uses srfi-1))
(require-extension format-modular)

I compile it with chicken using the following options:
 chicken myprogram.scm -explicit-use -uses library,utils

I then compile with gcc using the following:
gcc myprogram.c runtime.c library.c srfi-1.c utils.c extras.c -O3
-fomit-frame-pointer -fno-strict-aliasing -o myprogram

This returns the following error:
/usr/bin/ld: Undefined symbols:

I know I need to compile additional sources, but I'm not sure what
_C_library_utils_toplevel refers to.

As Z. already mentioned, the "-uses" option only accepts a single unit name.
You will also need compiled units for


You also have to pass "-uses extras -uses srfi-1 -uses regex" (according to
the linker error you get).

Compiling units for the above mentioned eggs is somewhat tedious, but
something like to following should work:

# (example)
chicken args-support.scm -unit args-support -optimize-level 2 -debug-level 0

Since eggs are usually loaded in a dynamic fashion, you will also need
to "provide" some features to avoid that dynamic loading. For example
"args" does a "require-extension" of "srfi-37", which can be avoided by
compiling args-support.scm with "-prelude '(provide (quote srfi-37))' and
doing the "-uses srfi-37" on the command-line of the main executable.

It's all quite messy, I agree. But if you run into any problems, just state
exactly what eggs you need and I will provide you with the necessary

Also, since you compile with full optimization options for gcc, you might
also want to enable optimization for Scheme files (for example by
passing "-optimize-level 2 -debug-level 0").


reply via email to

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