Re: [dev] [scc] issues with invoking

From: <k0ga_AT_shike2.com>
Date: Wed, 13 Apr 2016 20:24:22 +0200

Hi,

> I usually compile suckless software with tcc,
> but it fails at static linking, so I found myself
> cloning scc.

Scc is still a work in progress. It is far of being
completed and being able to compile programs.

> I changed PREFIX in config.mk to /usr/local and
> successfully installed it. First, what are cc1 and cc2?

Scc is composed of two different programs, cc1 and cc2.
Cc1 is the frontend, which basically implements the
preprocessor and the lexical, syntax and semantic
analysis. Cc2 is thebackend, which actually generates
(not yet) the actual assembler code. They communicate
between them using a textual intermediate language.
This structure is common in compilers and even gcc has
the same structure (and with the same names, cc1 and cc2).

> Also, I couldn't find a man page. Compiling Hello World
> with cc1 says it can't find stdio.h, runnning
> 'scc hello.c' prints "scc:execv cc2: No such file or directory".
> cc2 hangs without output.

Scc is the driver, is the program that execute cc1 and cc2 and build a
pipe between them. It looks for cc1-$(arch)/cc2-$(arch) in
$PREFIX/libexec/scc/ (or something similar, I don't have the code here
now). It means that it only works if both are already installed. It
accepts a -m parameter to indicate which architecture we want to use,
and if we don't specify any architecture then it launch the generic
cc1 and cc2. If you execute only 'make all ; make install', then it
should install:


        $PREFIX/bin/scc
        $PREFIX/bin/cpp (cc1 with name cpp)
        $PREFIX/libexec/scc/cc1
        $PREFIX/libexec/scc/cc2

If you execute 'make multi ; make install' then it install:

        $PREFIX/bin/scc
        $PREFIX/bin/cpp (cc1 with name cpp)
        $PREFIX/libexec/scc/cc1
        $PREFIX/libexec/scc/cc2
        $PREFIX/libexec/scc/cc1-z80
        $PREFIX/libexec/scc/cc2-z80
        $PREFIX/libexec/scc/cc1-amd64-sysv
        $PREFIX/libexec/scc/cc2-amd64-sysv
        $PREFIX/libexec/scc/cc1-i386-sysv
        $PREFIX/libexec/scc/cc2-i386-sysv
        $PREFIX/libexec/scc/cc1-qbe
        $PREFIX/libexec/scc/cc2-qbe

At this moment the repository has a collection of standard headers
that scc can parse, but they are not installed with 'make install', so
it is normal the error about stdio.h. If you use a proper -I flag in
cc1 it can read them from the repository path (at this moment scc has
no flag -I, even when it only has to rely it to cc1).

The error that should not happen is the error related to cc2. Do you
have it in $PREFIX/libexec/scc/?

>
> What's the current status of scc? I suppose, 'tis in its
> early stages of development.
>

Yes, it is in a very early stage. Cc1 is really advanced, and it can
parse and generate intermediate code for almost all C90, and about a
90% of C99. Cc2 is only a draft. I had an advanced version of cc2
for z80, but I discarded it and I began from the beginning with the
idea of having a multitargered compiler. Patches are welcome ;)

Regards,
Received on Wed Apr 13 2016 - 20:24:22 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 13 2016 - 20:36:12 CEST