Finding and compiling ATS source dependencies

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:

There is no “easy” way to do this for ATS1 programs.
So I suggest that this program be ported to ATS2 first.

If that is not an option, then you need to go through the code and
re-implement all the used library functions in a file, say, mylib.dats.
The good news is that there are only a few lib functions in your code.

Also, try to use -D_ATS_GCBDW if you have access to libgc. Otherwise,
you need to get all the GCATS code in ${ATSHOME}/ccomp/runtime/gcats.

Essentially, I did all of this in order to bootstrap ATS2 using only gcc
(or clang).

Again,I want to say that porting the code to ATS2 is far better than going
through all these troubles.On Monday, January 6, 2014 7:29:18 PM UTC-5, Brandon Barker wrote:

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:
GitHub - bbarker/FALCON: Flux Assignment (with) LAD Convex Objectives (and) Normalization.

Ok, it should be beneficial to port this code for other reasons as well,
for instance, calculating covariances (currently not implemented) can
probably be done more easily in ATS2.On Jan 7, 2014 2:03 AM, “gmhwxi” gmh...@gmail.com wrote:

There is no “easy” way to do this for ATS1 programs.
So I suggest that this program be ported to ATS2 first.

If that is not an option, then you need to go through the code and
re-implement all the used library functions in a file, say, mylib.dats.
The good news is that there are only a few lib functions in your code.

Also, try to use -D_ATS_GCBDW if you have access to libgc. Otherwise,
you need to get all the GCATS code in ${ATSHOME}/ccomp/runtime/gcats.

Essentially, I did all of this in order to bootstrap ATS2 using only gcc
(or clang).

Again,I want to say that porting the code to ATS2 is far better than going
through all these troubles.

On Monday, January 6, 2014 7:29:18 PM UTC-5, Brandon Barker wrote:

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:
GitHub - bbarker/FALCON: Flux Assignment (with) LAD Convex Objectives (and) Normalization.


You received this message because you are subscribed to the Google Groups
“ats-lang-users” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/54d6173f-d14b-4d78-b23f-4cb09522d9e1%40googlegroups.com
.