[Top][All Lists]

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

Re: [Chicken-users] Compiling Chicken-compiled-to-C file.c does not link

From: wiffel
Subject: Re: [Chicken-users] Compiling Chicken-compiled-to-C file.c does not link
Date: Thu, 12 Jun 2014 19:06:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0


You're welcome.

I do understand going for "the C way". I had to do the same thing to be able to run some chicken scheme programs on Intel's Xeon Phi platform. The only way to do that is using C files and Intel's ICC compiler. A bit of a hassle to set up, but it did work fine. Hope you manage to do the same with your project.

I'm also not an expert in ZSH's parameter expansion. I just put the lines I mentioned in my post in a file called '' and run it using 'sh'. That way I'm sure it will use the 'normal' expansion rules.

Good Luck,

On 12/06/14 18:40, Nikos Vasilakis wrote:
Thanks so much Wiffel, it worked (using chicken-!).

I want to go "the C way" only because I want to later compile the
generated C code for a different ISA (ALPHA).

For future reference, to aid others: my shell (zsh) somehow expanded
$CHICKEN_FILES as a single argument to gcc, and got `gcc: error:
./chicken/runtime.c ./chicken/library.c ./chicken/build-version.c: No
such file or directory` as a result. Running `gcc -static -I./chicken
array1.c ./chicken/runtime.c ./chicken/library.c
./chicken/build-version.c -O3 -fno-strict-aliasing
-fomit-frame-pointer -lm -o array1` does the trick (although it still
remains unclear to me why it is not expanded correctly).

Thank you,

On Thu, Jun 12, 2014 at 11:42 AM, wiffel <address@hidden> wrote:
Hi Nikos,

If you don't want to use 'csc' and really want to go the 'C way', you will
need more then the 'chicken.h' file. You will need at least the following
files: 'buildtag.h',  'build-version.c', 'chicken.h',  'library.c' and
'runtime.c'. All of them can be found in the top directory of the chicken

Once you have these - and put them in a subdirectory called e.g. 'chicken' -
you can compile the application like this:

   chicken array1.scm -explicit-use -uses library -optimize-level 5

   CHICKEN_FILES="chicken/runtime.c chicken/library.c

   gcc -static -I./chicken array1.c $CHICKEN_FILES -O3 -fno-strict-aliasing
-fomit-frame-pointer -lm -o array1

This will also give you a statically linked 'array1', which - in my case -
has about the same speed as the one using 'csc -O5'.

Good Luck,

On 12/06/14 17:27, wiffel wrote:
Hi Nikos,

If you remove the definition of the 'main' function and add an expression
like this:

     (time (go 200000))

and compile it with:

    csc -static -O5 array1.scm

you should end up with a statically linked application 'array1'
that is optimized for speed (because of the -O5).

Runs in about half a second on my computer.

Good Luck,

On 12/06/14 15:11, Nikos Vasilakis wrote:
Hello everyone,

I am trying to compile a simple scheme program down executable through
C, with no success. My program is array1 from the Kernighan and Van
Wyk Benchmarks, as implemented here [1]. I am using chicken 4.7 on
ubuntu 12.04 (details: [2]) and grabbed the chicken.h header file from
a github repo [3].

In particular, `chicken array1.scm` creates array1.c, but running `gcc
array1.c` throws a big number of "undefined reference to .." ending
with "collect2: ld returned 1 exit status" [4].

So that people help out most, my eventual goal is to compile a
statically linked executable binary. Ideally, therefore, I would need
to have a "chicken.c" or the chicken runtime linked in.

Thanks so much!


Version 4.7.0
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2011-10-17 on allspice (Linux)



Chicken-users mailing list

Chicken-users mailing list

reply via email to

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