Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Install Problem etc/linux.c UBUNTU Hardy Heron and gcc 4.2.4

34 views
Skip to first unread message

drandy...@googlemail.com

unread,
Feb 17, 2009, 4:38:03 AM2/17/09
to
Hello,
excuse my ignorance, but I've followed the instructions on installing
lcc on linux for x86 and I am having a few problems. Everything
compiles, but it fails on
lcc -v tst/8q.c
(Added #include <stdio.h> to 8q.c).
The etc/linux.c does not seem to be working correctly for my setup. If
anyone has successfully installed lcc on a UBUNTU or a debian
distribution then I would welcome being able to download their
source. I'm intending to use it for teaching a compiler course. By
changing the cpp options on the last line to "$1", "$2", "-o", "$3",
0 }; I can get the assembler produced (output listed as ALTERED etc/
linux.c below).

Apologies if I am being a bit slow with this, but I would welcome some
input on solving this minor problem.

UNALTERED etc/linux.c
nisbeta@fpga:~/RESEARCH/LCC$ lcc -v tst/8q.c
lcc $Id: lcc.c,v 4.33 2001/06/28 22:19:58 drh Exp $
/usr/local/lib/lcc/gcc/cpp -U__GNUC__ -D_POSIX_SOURCE -D__STDC__=1 -
D__STRICT_ANSI__ -Dunix -Di386 -Dlinux -D__unix__ -D__i386__ -
D__linux__ -D__signed__=signed -D__LCC__ -I/usr/local/lib/lcc/include -
I/usr/local/lib/lcc/gcc/include -I/usr/include tst/8q.c /home/nisbeta/
RESEARCH/LCC/x86-linux/tmp/lcc79410.i
<command-line>: warning: "__STDC__" redefined
<built-in>: warning: this is the location of the previous definition
main queens print
Analyzing compilation unittst/8q.c:41:1: error: /home/nisbeta/RESEARCH/
LCC/x86-linux/tmp/lcc79410.i: No such file or directory

Execution times (seconds)
lexical analysis : 0.01 (100%) usr 0.00 ( 0%) sys 0.01
(25%) wall 0 kB ( 0%) ggc
parser : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.02
(50%) wall 107 kB (10%) ggc
TOTAL : 0.01 0.00
0.04 1042 kB
rm /home/nisbeta/RESEARCH/LCC/x86-linux/tmp/lcc79410.i


ALTERED etc/linux.c
nisbeta@fpga:~/RESEARCH/LCC$ lcc -v tst/8q.c
lcc $Id: lcc.c,v 4.33 2001/06/28 22:19:58 drh Exp $
/usr/local/lib/lcc/gcc/cpp -U__GNUC__ -D_POSIX_SOURCE -D__STDC__=1 -
D__STRICT_ANSI__ -Dunix -Di386 -Dlinux -D__unix__ -D__i386__ -
D__linux__ -D__signed__=signed -D__LCC__ -I/usr/local/lib/lcc/include -
I/usr/local/lib/lcc/gcc/include -I/usr/include tst/8q.c -o /home/
nisbeta/RESEARCH/LCC/x86-linux/tmp/lcc80410.i
<command-line>: warning: "__STDC__" redefined
<built-in>: warning: this is the location of the previous definition
main queens print
Execution times (seconds)
preprocessing : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01
(20%) wall 69 kB ( 6%) ggc
parser : 0.01 (100%) usr 0.00 ( 0%) sys 0.03
(60%) wall 111 kB (10%) ggc
TOTAL : 0.01 0.00
0.05 1088 kB
/usr/local/lib/lcc/rcc -target=x86/linux -v /home/nisbeta/RESEARCH/LCC/
x86-linux/tmp/lcc80410.i /home/nisbeta/RESEARCH/LCC/x86-linux/tmp/
lcc80411.s
/usr/local/lib/lcc/rcc $Name: v4_2 $($Id: main.c,v 1.1 2002/08/28
23:12:44 drh Exp $)
1: unrecognized declaration
1: syntax error; found "8q.c ... expecting `;'
1: unrecognized declaration
2: unrecognized declaration
3: syntax error; found `.' expecting `;'
3: skipping `.'
3: syntax error; found `main' expecting `;'
4: syntax error; found `.' expecting `;'
4: skipping `.'
4: syntax error; found `main' expecting `;'
4: illegal character `@'
5: syntax error; found `main' expecting `;'
5: syntax error; found `:' expecting `;'
5: skipping `:'
6: syntax error; found `4' expecting `;'
6: unrecognized declaration
6: syntax error; found `%' expecting `)'
6: missing identifier
6: syntax error; found `%' expecting `;'
6: skipping `%'
6: too many errors
rm /home/nisbeta/RESEARCH/LCC/x86-linux/tmp/lcc80411.s /home/nisbeta/
RESEARCH/LCC/x86-linux/tmp/lcc80410.i

Thanks, Andy

drandy...@googlemail.com

unread,
Feb 18, 2009, 6:52:38 AM2/18/09
to
Howdy,
OK Im now using gcc -E as the preprocessor and it seems to compile and
make executables.
Triple test seemed to be ok, some issues with make TARGET=x86/linux
test, regarding mismatches in
the generated assembler but I'll check the messages.

Only needed to modify etc/linux.c


char *cpp[] = { LCCDIR "../../../../../usr/bin/gcc", "-E", //
modification to point to my /usr/bin/gcc install
"-U__GNUC__", "-D_POSIX_SOURCE", "-D__STDC__=1", "-D__STRICT_ANSI__",
"-Dunix", "-Di386", "-Dlinux",
"-D__unix__", "-D__i386__", "-D__linux__", "-D__signed__=signed",
"$1", "$2", "-o", "$3", 0 }; // modification to pass arguments to
generate intermediate filename

and here
int option(char *arg) {
if (strncmp(arg, "-lccdir=", 8) == 0) {
cpp[0] = concat(&arg[8], "/../../../../../usr/bin/gcc"); //
modification to not break cpp[0] calling/storingimeddd gcc
// cpp[1] already has -E stored

Thanks,
Andy

0 new messages