chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Generating C


From: Norman Gray
Subject: Re: [Chicken-users] Generating C
Date: Mon, 11 Jul 2016 17:55:05 +0100


Greetings.

A followup...

On 8 Jul 2016, at 19:46, Norman Gray wrote:

"/Data/tools/chicken-4.11.0/bin/csc" -t -unit db -optimize-level 3 -include-path ../.. -emit-all-import-libraries -output-file db.c ../../db.scm

[...]
[panic] nursery is too small - try higher setting using the `-:s' option - execution terminated


Error: shell command terminated with non-zero exit status 256: '/Data/tools/chicken-4.11.0/bin/chicken' '../../db.scm' -output-file 'db.c' -unit db -optimize-level 3 -include-path ../.. -emit-all-import-libraries

This seems to have fixed itself, without me doing anything I'm aware of to fix it.

It _appears_ to be something to do with module resolution, even though the error message is '[panic] nursery is too small' rather than anything about imports. I suspect that because when I was trying to work out what was going on, I was as a side-effect re-generating other modules. I therefore can't reproduce the problem.

So I can now generate .c files. I can't compile them (more module resolution problems), but I can generate them.

The documentation at <http://wiki.call-cc.org/man/4/Using%20the%20compiler> is perhaps a trifle laconic, and saying 'This is naturally rather simplistic' doesn't really fill in the blanks.

One useful thing to mention on that page would be that when compiling modules, '-t -unit <modulename>' is necessary, otherwise we get (intelligible in eventual retrospect) duplicate symbols when compiling. Inspection of c-backend.scm solved that particular puzzle.

The build system, based on Makefile.* and *.make files, seems quite narrowly targeted for the case of building Chicken itself. The experiments I've tried suggest that it can be adapted to building an assembly of .c files, when I get them, but it needs a bit of hacking for that case, and feels a bit wild-west. Is that really the recommended technique?

It would be seriously useful if chicken-install, for example, could work out the recursive set of dependencies for a particular source file, and print them in a reusable way. I wrote quite a lot of a tool to do this, and to generate a Makefile which would assemble a kit and prepare to build it. However it started to acquire more and more special cases, and it became clear that it could never really work reliably, given the freedom of action afforded to the contents of <egg>.setup. Given that chicken-install already has to deal with this complication, would it be reasonable for it to gain an option to emit the dependencies, ideally in the form of a Makefile?

I still have the impression that the ability to generate distributable C is a key feature of Chicken (is this true?), which makes it odd that this is documented only in a few dozen lines at the bottom of the 'Using the compiler' page, and odd that an apparently simple build -- I'm not doing anything exotic -- is quite this difficult, and requires quite so much use of the source (Luke). Have I (as happens so often) got the wrong end of the stick?

Best wishes,

Norman


--
Norman Gray  :  https://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK



reply via email to

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