chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Static compile


From: Joshua Griffith
Subject: Re: [Chicken-users] Static compile
Date: Fri, 29 Dec 2006 01:31:23 -0600

Felix,

I followed your instructions and was able to get the program to successfully compile.  However, upon running the application, I get the following error:

Error: (define-syntax) during expansion of (define-syntax ...) - highlevel macros are not supported

I tried using the -require-extension syntax-case option when compiling the application with chicken, but I still get the error.  Any ideas?

Thanks again,

Josh

On 12/28/06, felix winkelmann <address@hidden> wrote:
On 12/26/06, Joshua Griffith <address@hidden> wrote:
> Hello,
>
> 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:
> _C_library_utils_toplevel
> _C_extras_toplevel
> _C_regex_toplevel
>
> 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

format-modular
args-support
srfi-37
csv

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

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").


cheers,
felix

reply via email to

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