githwxi / ATS-Xanadu

Bootstrapping ATS3
GNU General Public License v3.0
197 stars 14 forks source link

hi, i could not compile ats2 on my arch linux #31

Open Abhinavpatel00 opened 1 month ago

Abhinavpatel00 commented 1 month ago

prelude/ats_main_prelude_dats.c:72:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2basics_2edatsdynload’ [-Wimplicit-function-declaratio] 72 | ATS_2d0_2e2_2e12_2prelude_2DATS_2basics_2edatsdynload () ; | ^~~~~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:73:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2bool_2edatsdynload’ [-Wimplicit-function-declaration] 73 | ATS_2d0_2e2_2e12_2prelude_2DATS_2bool_2edatsdynload () ; | ^~~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:74:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2char_2edatsdynload’ [-Wimplicit-function-declaration] 74 | ATS_2d0_2e2_2e12_2prelude_2DATS_2char_2edatsdynload () ; | ^~~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:75:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2float_2edatsdynload’ [-Wimplicit-function-declaration] 75 | ATS_2d0_2e2_2e12_2prelude_2DATS_2float_2edatsdynload () ; | ^~~~~~~~~~~~~~ gcc -I. -I./ccomp/runtime -c -o prelude_DATS_reference_dats.o prelude/DATS_reference_dats.c prelude/ats_main_prelude_dats.c:76:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2integer_2edatsdynload’ [-Wimplicit-function-declaration] 76 | ATS_2d0_2e2_2e12_2prelude_2DATS_2integer_2edatsdynload () ; | ^~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:77:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2sizetype_2edatsdynload’ [-Wimplicit-function-declaration] 77 | ATS_2d0_2e2_2e12_2prelude_2DATS_2sizetype_2edatsdynload () ; | ^~~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:78:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2pointer_2edatsdynload’ [-Wimplicit-function-declaration] 78 | ATS_2d0_2e2_2e12_2prelude_2DATS_2pointer_2edatsdynload () ; | ^~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:79:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2reference_2edatsdynload’ [-Wimplicit-function-declaration] 79 | ATS_2d0_2e2_2e12_2prelude_2DATS_2reference_2edatsdynload () ; | ^~~~~~~~~~~~~~ gcc -I. -I./ccomp/runtime -c -o prelude_DATS_string_dats.o prelude/DATS_string_dats.c prelude/ats_main_prelude_dats.c:80:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2string_2edatsdynload’ [-Wimplicit-function-declaratio] 80 | ATS_2d0_2e2_2e12_2prelude_2DATS_2string_2edats__dynload () ; | ^~~~~~~~~~~~~~~ gcc -I. -I./ccomp/runtime -c -o prelude_DATS_lazy_dats.o prelude/DATS_lazy_dats.c prelude/ats_main_prelude_dats.c:81:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2lazy_2edatsdynload’ [-Wimplicit-function-declaration] 81 | ATS_2d0_2e2_2e12_2prelude_2DATS_2lazy_2edatsdynload () ; | ^~~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:82:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2lazy_vt_2edatsdynload’ [-Wimplicit-function-declaration] 82 | ATS_2d0_2e2_2e12_2prelude_2DATS_2lazy_vt_2edatsdynload () ; | ^~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:83:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2printf_2edats__dynload’ [-Wimplicit-function-declaratio] 83 | ATS_2d0_2e2_2e12_2prelude_2DATS_2printf_2edatsdynload () ; | ^~~~~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:84:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2filebas_2edatsdynload’ [-Wimplicit-function-declaration] 84 | ATS_2d0_2e2_2e12_2prelude_2DATS_2filebas_2edatsdynload () ; | ^~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:85:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2list_2edatsdynload’ [-Wimplicit-function-declaration] 85 | ATS_2d0_2e2_2e12_2prelude_2DATS_2list_2edatsdynload () ; | ^~~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:86:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2list_vt_2edatsdynload’ [-Wimplicit-function-declaration] 86 | ATS_2d0_2e2_2e12_2prelude_2DATS_2list_vt_2edatsdynload () ; | ^~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:87:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2list0_2edatsdynload’ [-Wimplicit-function-declaration] 87 | ATS_2d0_2e2_2e12_2prelude_2DATS_2list0_2edats__dynload () ; | ^~~~~~~~~~~~~~ gcc -I. -I./ccomp/runtime -c -o prelude_DATS_lazy_vt_dats.o prelude/DATS_lazy_vt_dats.c prelude/ats_main_prelude_dats.c:88:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2option_2edatsdynload’ [-Wimplicit-function-declaratio] 88 | ATS_2d0_2e2_2e12_2prelude_2DATS_2option_2edatsdynload () ; | ^~~~~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:89:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2option_vt_2edatsdynload’ [-Wimplicit-function-declaration] 89 | ATS_2d0_2e2_2e12_2prelude_2DATS_2option_vt_2edatsdynload () ; | ^~~~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:90:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2option0_2edats__dynload’ [-Wimplicit-function-declaration] 90 | ATS_2d0_2e2_2e12_2prelude_2DATS_2option0_2edatsdynload () ; | ^~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:91:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2array_2edatsdynload’ [-Wimplicit-function-declaration] 91 | ATS_2d0_2e2_2e12_2prelude_2DATS_2array_2edats__dynload () ; | ^~~~~~~~~~~~~~ gcc -I. -I./ccomp/runtime -c -o prelude_DATS_printf_dats.o prelude/DATS_printf_dats.c prelude/ats_main_prelude_dats.c:92:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2array0_2edatsdynload’ [-Wimplicit-function-declaratio] 92 | ATS_2d0_2e2_2e12_2prelude_2DATS_2array0_2edatsdynload () ; | ^~~~~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:93:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2matrix_2edatsdynload’ [-Wimplicit-function-declaratio] 93 | ATS_2d0_2e2_2e12_2prelude_2DATS_2matrix_2edatsdynload () ; | ^~~~~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:94:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2matrix0_2edatsdynload’ [-Wimplicit-function-declaration] 94 | ATS_2d0_2e2_2e12_2prelude_2DATS_2matrix0_2edatsdynload () ; | ^~~~~~~~~~~~ prelude/ats_main_prelude_dats.c:95:1: error: implicit declaration of function ‘ATS_2d0_2e2_2e12_2prelude_2DATS_2ptrarr_2edatsdynload’ [-Wimplicit-function-declaratio] 95 | ATS_2d0_2e2_2e12_2prelude_2DATS_2ptrarr_2edats__dynload () ; | ^~~~~~~~~~~~~~~ make[1]: [Makefile:391: prelude_ats_main_prelude_dats.o] Error 1 make[1]: Waiting for unfinished jobs....

githwxi commented 1 month ago

You just need to disable -Wimplicit-function-declaration flag.

Abhinavpatel00 commented 1 month ago

thank you for reply

i got this instead

./configure && make  CFLAGS=-Wno-implicit-function-declaration
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking whether ln -s works... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking gmp.h usability... yes
checking gmp.h presence... yes
checking for gmp.h... yes
checking size of void*... 8
checking for posix_memalign... yes
checking for memalign... yes
configure: creating ./config.status
config.status: creating config.mk
config.status: creating bin/patscc_env.sh
config.status: creating bin/myatscc_env.sh
config.status: creating bin/patsopt_env.sh
config.status: creating config.h
config.status: config.h is unchanged
\
make -j4 -C src/CBOOT patsopt \
CCOMP=gcc GCFLAG= LDFLAGS= 
make[1]: Entering directory '/home/lka/programming/compiler/ATS2-Postiats-int-0.4.2/src/CBOOT'
gcc -Wno-implicit-function-declaration -c -o prelude_ats_main_prelude_dats.o prelude/ats_main_prelude_dats.c
prelude/ats_main_prelude_dats.c:10:10: fatal error: ats_config.h: No such file or directory
   10 | #include "ats_config.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:391: prelude_ats_main_prelude_dats.o] Error 1
make[1]: Leaving directory '/home/lka/programming/compiler/ATS2-Postiats-int-0.4.2/src/CBOOT'
make: *** [Makefile:79: src2_patsopt] Error 2
githwxi commented 1 month ago

I don't see the include path in your gcc command-line. Maybe the following modification can fix the issue:

make CFLAGS=-Wno-implicit-function-declaration -I. -I./ccomp/runtime

Abhinavpatel00 commented 1 month ago

i got this ,

 make CFLAGS=-Wno-implicit-function-declaration -I. -I./ccomp/runtime
\
make -j4 -C src/CBOOT patsopt \
CCOMP=gcc GCFLAG= LDFLAGS= 
make[1]: Entering directory '/home/user/programming/compiler/ATS2-Postiats-int-0.4.2/src/CBOOT'
gcc -Wno-implicit-function-declaration -c -o prelude_ats_main_prelude_dats.o prelude/ats_main_prelude_dats.c
prelude/ats_main_prelude_dats.c:10:10: fatal error: ats_config.h: No such file or directory
   10 | #include "ats_config.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:391: prelude_ats_main_prelude_dats.o] Error 1
make[1]: Leaving directory '/home/user/programming/compiler/ATS2-Postiats-int-0.4.2/src/CBOOT'
make: *** [Makefile:79: src2_patsopt] Error 2
githwxi commented 1 month ago

make CFLAGS=-Wno-implicit-function-declaration -I. -I./ccomp/runtime

Should be

make CFLAGS="-Wno-implicit-function-declaration -I. -I./ccomp/runtime"

githwxi commented 1 month ago

By the way, you can also use the nix package for ATS2 (without the need for compiling ATS2 yourself):

Here is some information copied from the Piazza page for a class of mine:

Nix package for ATS2

nix-shell -p ats2 --run "patscc -o lambda0 -DATS_MEMALLOC_LIBC lambda0.dats"

I recently learned the existence of a nix package for ATS2, which allows you to use a nix-shell to run patscc (as is shown in the above command-line).

For more on this, you can take a look at the following Makefile in the class repo:

https://github.com/hwxi/CS525-2024-Fall/blob/main/lambdas/lambda0/Makefile

Abhinavpatel00 commented 1 month ago

make CFLAGS=-Wno-implicit-function-declaration -I. -I./ccomp/runtime

Should be

make CFLAGS="-Wno-implicit-function-declaration -I. -I./ccomp/runtime"

thank you so much professor it worked

extern fun f (): void

implement
main0 () = f ()

implement
 f (): void = let
  val () = print("i wish we could attend classes from you, your language is interesting \n")
in
  f ()
end