chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Having trouble statically compiling code


From: Peter Bex
Subject: Re: [Chicken-users] Having trouble statically compiling code
Date: Sun, 21 Aug 2016 13:03:39 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Sun, Aug 21, 2016 at 01:13:40AM +0100, stugol wrote:
>    This complains about multiple definitions of C_blob_2dutils_toplevel,
>    which I assume is because I am compiling blob-hexadecimal.scm and
>    blob-set-int.scm separately into object files. Perhaps I should not be
>    doing that.

I had several more problems, with the -uses flags being generated
without a space before it, and setup-helper and blob-utils not compiling.
After "fixing" that by hacking about a bit, I think I managed to make it
work.

>    However, when I run the resultant executable, I get an error about a
>    missing intarweb extension. Which is strange, because if you look
>    carefully at the command line above, you can see I'm both linking with
>    its object file and referencing it with a uses declaration.
> 
>    What am I doing wrong, please?

The problem is that you're requiring the extensions with -uses, but the
code for http-client.scm still contains (use intarweb), which tries to
load it at runtime.

You're missing -uses declarations when compiling the eggs: you need to
declare for each egg which eggs it uses, to avoid loading them
dynamically.

For example, if you refer to Evan's tutorial at
http://www.foldling.org/scheme.html#compiling-statically-linked-chicken-scheme-programs-with-extensions
you'll notice that he's compiling uri-generic, which depends on matchable
and defstruct, as follows:

csc -unit uri-generic -uses matchable,defstruct -cJ uri-generic/uri-generic.scm 
-o uri-generic.o

The -uses declarations are not being emitted by your program when you
compile the extensions.

>    Incidentally, is there any way to instruct csc to use musl instead of
>    libc? I'm told that this would eliminate any dependency on a specific
>    version of libc on the target machine. I gather the musl project is a
>    bit lacking in header files, however.

I think you can do that by passing "-cc musl-gcc".

Hope this helps!

Cheers,
Peter

Attachment: signature.asc
Description: Digital signature


reply via email to

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