[Top][All Lists]

[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: Mon, 22 Aug 2016 22:33: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,

I've fixed the needs issue, and ensured that -uses is specified correctly, and now I'm getting "multiple definition" errors:

/tmp/temp728b.18061/defstruct/../defstruct.c:68: multiple definition of `C_defstruct_toplevel'
defstruct.o:/tmp/temp728b.18061/defstruct/../defstruct.c:68: first defined here
matchable.o: In function `C_matchable_toplevel':
/tmp/temp728b.18061/matchable/../matchable.c:96: multiple definition of `C_matchable_toplevel'
matchable.o:/tmp/temp728b.18061/matchable/../matchable.c:96: first defined here
uri-common.o: In function `C_uri_2dcommon_toplevel':
/tmp/temp728b.18061/uri-common/../uri-common.c:5223: multiple definition of `C_uri_2dcommon_toplevel'


I assume this is somehow happening because multiple .scm files are being statically linked with the same .o file - like if two eggs have a dependency on a third, the third .o file will be linked twice. But it can't have it both ways! Either I omit the dependencies until the final compile, whereupon it complains about missing packages at runtime, or I statically link the dependencies as I go, and get errors about multiple definitions! What am I doing wrong?

(Perhaps I should avoid linking extraneous .o files with test-source.scm, but that can't be the whole solution, as it won't solve the diamond problem. If two eggs happen to require defstruct, then defstruct.o will be linked twice anyway.)

I've modified the logfile to be a bit more readable, and again included it with the project to save you having to actually run the code. FYI, if you didn't know, the coloured logfile can be viewed correctly using less -R. And incidentally, if you prefer non-ansi-coloured output (both to the terminal and to the logfile), you can disable colours by changing the ansi-mode declaration near the bottom of static-compile.scm to read (*ansi-mode* #f). I find colours aid readability, however.


On 21/08/2016 19:18, Peter Bex wrote:
On Sun, Aug 21, 2016 at 04:47:11PM +0100, stugol wrote:
   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                     <--
Hello again,

This seems to be due to the fact that "find-depends-forms" only scans for
(depends ...) in meta files, but uri-generic uses (needs ...), which is
an alias.

If I fix that, I get a similar error about defstruct in uri-common.  The
log shows that indeed, uri-common is compiled without "-uses defstruct".
I don't quite understand why, though.


Description: Zip archive

reply via email to

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