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: stugol
Subject: Re: [Chicken-users] Having trouble statically compiling code
Date: Sun, 21 Aug 2016 16:47:11 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Hi Peter, and thanks for the help.

I've modified it as per your instructions, but when I run the resultant exe, but now I'm getting:

(require) cannot load extension: matchable

           Call history:

           uri-generic.scm:58: ##sys#require                     <--

I tried adding -static when compiling the eggs, but that didn't help.

I've included a fresh zip of the sources, including a logfile showing the commands I'm issuing. Can you help further, please?

Cheers,
   Stuart


On 21/08/2016 12:03, Peter Bex wrote:
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: project.zip
Description: Zip archive


reply via email to

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