gracelang / minigrace

Self-hosting compiler for the Grace programming language
39 stars 22 forks source link

Error when building #235

Closed milosonator closed 7 years ago

milosonator commented 7 years ago

Hi,

I'm using Ubuntu 16.04 x86_64. I'm trying to build minigrace to run local grace programs. I just check out the repo and run make, I'm getting the following error:

GRACE_MODULE_PATH=. known-good/Linux-x86_64/8d11a118d0ee0852a0c92e798a8f648f86b2f504/minigrace  --make --noexec --dir l1 collectionsPrelude.grace
Fatal error: C compilation of collectionsPrelude failed.
The failing command was
gcc -std=c99 -g -I"false" -I"known-good/Linux-x86_64/8d11a118d0ee0852a0c92e798a8f648f86b2f504/../include" -I"known-good/Linux-x86_64/8d11a118d0ee0852a0c92e798a8f648f86b2f504" -I"/usr/local/include" -o "/home/michiel/grace/minigrace/minigrace/l1/collectionsPrelude.gcn" -c "/home/michiel/grace/minigrace/minigrace/l1/collectionsPrelude.c"
Makefile:316: recipe for target 'l1/collectionsPrelude.gct' failed
make: *** [l1/collectionsPrelude.gct] Error 3

Is there a problem with the build process? Or am I doing something wrong?

Full build output:

michiel@scw-7f245d:~/grace/minigrace/minigrace$ make
Makefile:1: Makefile.conf: No such file or directory
mv: cannot move 'buildinfo_tmp.grace.25036' to 'l1/buildinfo.grace': No such file or directory
./configure
Checking for libcurl... yes
Locating linker... /usr/bin/ld
Checking linker... GNU LD.
Checking for -ldl... yes.
Locating GNU make... /usr/bin/make
Locating gcc... /usr/bin/gcc
Checking GCC search paths... OK.
Run 'make' to build.
if [ -e minigrace-3877.tar.bz2 ] ;\
then ./tools/tarball-bootstrap minigrace-3877.tar.bz2 ;\
else ./tools/tarball-bootstrap -a ;\
fi
Will fetch tarball from http://web.cecs.pdx.edu/~grace/minigrace/dist/minigrace-3877.tar.bz2...
--2017-03-06 13:19:07--  http://web.cecs.pdx.edu/~grace/minigrace/dist/minigrace-3877.tar.bz2
Resolving web.cecs.pdx.edu (web.cecs.pdx.edu)... 131.252.208.59
Connecting to web.cecs.pdx.edu (web.cecs.pdx.edu)|131.252.208.59|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1615134 (1.5M) [application/x-bzip2]
Saving to: ‘minigrace-3877.tar.bz2’

minigrace-3877.tar.bz2                          100%[=====================================================================================================>]   1.54M  1.76MB/s    in 0.9s

2017-03-06 13:19:09 (1.76 MB/s) - ‘minigrace-3877.tar.bz2’ saved [1615134/1615134]

Download complete. Will compile now...
~/grace/minigrace/minigrace/minigrace-3877 ~/grace/minigrace/minigrace
Checking for libcurl... yes
Locating linker... /usr/bin/ld
Checking linker... GNU LD.
Checking for -ldl... yes.
Locating GNU make... /usr/bin/make
Locating gcc... /usr/bin/gcc
Checking GCC search paths... OK.
Run 'make' to build, and 'make selfhost' to have it compile itself.
./configure: line 257: cd: js: No such file or directory
ls: cannot access '*.png': No such file or directory
make[1]: Entering directory '/home/michiel/grace/minigrace/minigrace/minigrace-3877'
gcc -std=c99 -I. -c -o ast.gcn ast.c
gcc -std=c99 -I. -c -o buildinfo.gcn buildinfo.c
gcc -std=c99 -I. -c -o genc.gcn genc.c
gcc -std=c99 -I. -c -o genjs.gcn genjs.c
gcc -std=c99 -I. -c -o lexer.gcn lexer.c
gcc -std=c99 -I. -c -o parser.gcn parser.c
gcc -std=c99 -I. -c -o util.gcn util.c
gcc -std=c99 -I. -c -o stringMap.gcn stringMap.c
gcc -std=c99 -I. -c -o xmodule.gcn xmodule.c
gcc -std=c99 -I. -c -o identifierresolution.gcn identifierresolution.c
gcc -std=c99 -I. -c -o errormessages.gcn errormessages.c
gcc -std=c99 -I. -c -o identifierKinds.gcn identifierKinds.c
gcc -std=c99 -I. -c -o minigrace.gcn minigrace.c
gcc -std=c99 -I. -c -o unixFilePath.gcn unixFilePath.c
gcc -std=c99  -fPIC -shared -o unicode.gso unicode.c
gcc -std=c99 -g -I. -c -o debugger.o debugger.c
gcc -std=c99 -c -o gracelib-basic.o gracelib.c
gcc -std=c99 -I. -c -o standardGrace.gcn standardGrace.c
standardGrace.c: In function ‘meth_standardGrace_367_hashCombine_40_2_41_’:
standardGrace.c:3910:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
         int a = (int)(args[0]->data);
                 ^
standardGrace.c:3911:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
         int b = (int)(args[1]->data);
                 ^
gcc -std=c99 -I. -c -o collectionsPrelude.gcn collectionsPrelude.c
ld -o gracelib.o -r gracelib-basic.o standardGrace.gcn collectionsPrelude.gcn debugger.o
gcc -std=c99  -fPIC -shared -o mirrors.gso mirrors.c
gcc -o minigrace -fPIC gracelib.o minigrace.gcn ast.gcn buildinfo.gcn genc.gcn genjs.gcn lexer.gcn parser.gcn util.gcn stringMap.gcn xmodule.gcn identifierresolution.gcn errormessages.gcn identifierKinds.gcn unixFilePath.gcn -Wl,--export-dynamic -ldl -lm
make[1]: Leaving directory '/home/michiel/grace/minigrace/minigrace/minigrace-3877'
~/grace/minigrace/minigrace
Installed tarball minigrace-3877.tar.bz2 into ../known-good/Linux-x86_64/8d11a118d0ee0852a0c92e798a8f648f86b2f504.
Done
GRACE_MODULE_PATH=. known-good/Linux-x86_64/8d11a118d0ee0852a0c92e798a8f648f86b2f504/minigrace  --make --noexec --dir l1 collectionsPrelude.grace
Fatal error: C compilation of collectionsPrelude failed.
The failing command was
gcc -std=c99 -g -I"false" -I"known-good/Linux-x86_64/8d11a118d0ee0852a0c92e798a8f648f86b2f504/../include" -I"known-good/Linux-x86_64/8d11a118d0ee0852a0c92e798a8f648f86b2f504" -I"/usr/local/include" -o "/home/michiel/grace/minigrace/minigrace/l1/collectionsPrelude.gcn" -c "/home/michiel/grace/minigrace/minigrace/l1/collectionsPrelude.c"
Makefile:316: recipe for target 'l1/collectionsPrelude.gct' failed
make: *** [l1/collectionsPrelude.gct] Error 3
apblack commented 7 years ago

I don't think that you are doing anything wrong. It's probably that the build process doesn't work on Ubuntu. I normally run it on Darwin, and occasionally on Linux; @ltratt made it work on BSD, but Ubuntu may not have been exercised for a long time.

Your options are to try on a different flavour of Unix, or fix the failure yourself. I'm in the process of moving away from the C-language bootstrap altogether: I'm trying to build an NPM package that will let us run and bootstrap the JavaScript version of the compiler at the command line, and then I'll abandon the C code generator. So I'm not going to spend time on seeing why the C-language version of minigrace won't compile on Ubuntu.

There is code in ./configure that's supposed to figure-out the right flags for the compilation process; there is also some conditional code in genc.grace that determines the right flags for ld.

milosonator commented 7 years ago

I've tried a couple of things, some didn't work, but eventually I got it to work. First I tried Debian Linux and FreeBSD as well. Debian suffered from similar issues as Ubuntu, on FreeBSD there were some missing dependencies (and not easy for me to resolve as I'm not familiar with that system).

The root cause may have had to do with insufficient system resources. I created a new virtual machine with 4gb (rather than 2gb), and the build proceeded.

In regards to the C-bootstrapping: I fully understand that you do not want to invest anymore time in this. Looking forward to a working NPM package. Very exciting.