I’m curious about the recommended way to determine ATS source dependencies
for a project, and once determined (and this may be trivial), how to
compile them.
This example is using ATS1, but I guess it may not change for ATS2.
I can compile my program using:
atscc -O2 -D_ATS_GCATS -o minDisj minDisjNoCov.dats sstream.dats
sstream.sats -lm
This yields the following:
$ atscc -O2 -D_ATS_GCATS -o minDisj minDisjNoCov.dats sstream.dats
sstream.sats -lm
/home/Bud/ats-lang-anairiats-0.2.11/bin/atsopt --output minDisjNoCov_dats.c
–dynamic minDisjNoCov.dats
/home/Bud/ats-lang-anairiats-0.2.11/bin/atsopt --output sstream_dats.c
–dynamic sstream.dats
/home/Bud/ats-lang-anairiats-0.2.11/bin/atsopt --output sstream_sats.c
–static sstream.sats
gcc -O2 -D_ATS_GCATS
-I/home/Bud/ats-lang-anairiats-0.2.11/
-I/home/Bud/ats-lang-anairiats-0.2.11/ccomp/runtime/
-L/home/Bud/ats-lang-anairiats-0.2.11/ccomp/lib/
/home/Bud/ats-lang-anairiats-0.2.11/ccomp/runtime/ats_prelude.c
-o minDisj minDisjNoCov_dats.c sstream_dats.c sstream_sats.c
-lm /home/Bud/ats-lang-anairiats-0.2.11/ccomp/runtime/GCATS/gc.o -lats
Now, I try to modify the gcc command to work without using ats libs, and
this fails (probably to be expected):
gcc -D_ATS_GCATS
-I/home/Bud/ats-lang-anairiats-0.2.11
-I/home/Bud/ats-lang-anairiats-0.2.11/contrib
-I/home/Bud/ats-lang-anairiats-0.2.11/ccomp/runtime
-I/home/Bud/ats-lang-anairiats-0.2.11/ccomp/runtime/GCATS
/home/Bud/ats-lang-anairiats-0.2.11/ccomp/runtime/ats_prelude.c
sstream_sats.c minDisjNoCov_dats.c sstream_dats.c -o mindisj -lm
/tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0xee): undefined reference to gc_init' /tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x109): undefined reference to
gc_markroot_bsz’
/tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x117): undefined reference to
gc_chunk_count_limit_get' /tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x12a): undefined reference to
gc_chunk_count_limit_set’
/tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x138): undefined reference to
gc_chunk_count_limit_max_get' /tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x14b): undefined reference to
gc_chunk_count_limit_max_set’
/tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x15f): undefined reference to
gc_aut_malloc_bsz' /tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x17c): undefined reference to
ats_exit_errmsg’
/tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x199): undefined reference to
gc_aut_calloc_bsz' /tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x1b6): undefined reference to
ats_exit_errmsg’
/tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x1cc): undefined reference to
gc_aut_free' /tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x1e7): undefined reference to
gc_aut_realloc_bsz’
/tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x204): undefined reference to
ats_exit_errmsg' /tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x21a): undefined reference to
gc_man_malloc_bsz’
/tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x23a): undefined reference to
gc_man_calloc_bsz' /tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x253): undefined reference to
gc_man_free’
/tmp/ccbd4O8Q.o:ats_prelude.c:(.text+0x26e): undefined reference to
gc_man_realloc_bsz' /usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/ld: /tmp/ccbd4O8Q.o: bad reloc address 0x10 in section
.data’
/usr/lib/gcc/i686-pc-cygwin/4.8.2/…/…/…/…/i686-pc-cygwin/bin/ld: final
link failed: Invalid operation
collect2: error: ld returned 1 exit status
Now, looking at the deps, we see the following:
/home/Bud/ats-lang-anairiats-0.2.11/bin/atsopt --output-a md.dep --depgen
-d minDisjNoCov.dats
/home/Bud/ats-lang-anairiats-0.2.11/bin/atsopt --output-a ssd.dep --depgen
-d sstream.dats
/home/Bud/ats-lang-anairiats-0.2.11/bin/atsopt --output-a sss.dep --depgen
-s sstream.sats
$ cat *.dep
minDisjNoCov_dats.c : sstream.sats
minDisjNoCov_dats.c : sstream.sats
minDisjNoCov_dats.c : sstream.sats
sstream_dats.c : sstream.sats
sstream_dats.c : sstream.sats
sstream_dats.c : sstream.sats
sstream_sats.c :
sstream_sats.c :
sstream_sats.c :
So this seems to only include project deps, not ATS deps.
If it helps, code is available here: