Error while compiling the example "twice.dats"

Hello,

I’m just trying to warm myself up with ATS and I’m going through the online
tutorial here:
http://www.ats-lang.org/DOCUMENT/INT2PROGINATS/HTML/index.html

However, while trying to compile the “twice.dats” example using the
command “patscc twice.dats”, I get a compilation error that says “undefined
reference to `atsruntime_malloc_undef’” (several times).

Here is the link to “twice.dats” that I have been using:
http://www.ats-lang.org/DOCUMENT/INT2PROGINATS/CODE/CHAP_FUNCTION/twice.dats

And, here’s the output of running “patscc --version”:

exec(patsopt --version)
Hello from ATS2(ATS/Postiats)!
ATS/Postiats version 0.0.5 with Copyright © 2011-2013 Hongwei Xi
exec(patsopt --version) = 0
exec(gcc -std=c99 -D_XOPEN_SOURCE -I${PATSHOME} -I${PATSHOME}/ccomp/runtime
-L${PATSHOME}/ccomp/atslib/lib -L${PATSHOME}/ccomp/atslib/lib64 --version)
gcc (GCC) 4.8.2 20131212 (Red Hat 4.8.2-7)
Copyright © 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

exec(gcc -std=c99 -D_XOPEN_SOURCE -I${PATSHOME} -I${PATSHOME}/ccomp/runtime
-L${PATSHOME}/ccomp/atslib/lib -L${PATSHOME}/ccomp/atslib/lib64 --version) =
0

Am I missing something? Should I be using another command (a similar
command has been working on previous examples)? Is there a problem with
my installation of ATS?

Thanks,
Shahab

I also want to point out that there is a Makefile for each chapter.
For instance,

http://www.ats-lang.org/DOCUMENT/INT2PROGINATS/CODE/CHAP_FUNCTION/Makefile

You can read the Makefile to see how an example can be compiled.On Wednesday, February 12, 2014 3:23:38 PM UTC-5, gmhwxi wrote:

If you want to run garbage collection, you can use -DATS_MEMALLOC_GCBDW.
If you do, you need libgc by Hans Bohem.

On Wednesday, February 12, 2014 3:08:52 PM UTC-5, Brandon Barker wrote:

I just ran in to this one yesterday, you need the -DATS_MEMALLOC_LIBC
flag.

ats2-lang / Wiki / compiler errors

On Wednesday, February 12, 2014 3:05:16 PM UTC-5, Shahab Tasharrofi wrote:

Hello,

I’m just trying to warm myself up with ATS and I’m going through the
online
tutorial here:
http://www.ats-lang.org/DOCUMENT/INT2PROGINATS/HTML/index.html

However, while trying to compile the “twice.dats” example using the
command “patscc twice.dats”, I get a compilation error that says
“undefined
reference to `atsruntime_malloc_undef’” (several times).

Here is the link to “twice.dats” that I have been using:

http://www.ats-lang.org/DOCUMENT/INT2PROGINATS/CODE/CHAP_FUNCTION/twice.dats

And, here’s the output of running “patscc --version”:

exec(patsopt --version)
Hello from ATS2(ATS/Postiats)!
ATS/Postiats version 0.0.5 with Copyright (c) 2011-2013 Hongwei Xi
exec(patsopt --version) = 0
exec(gcc -std=c99 -D_XOPEN_SOURCE -I${PATSHOME} -I${PATSHOME}/ccomp/runtime
-L${PATSHOME}/ccomp/atslib/lib -L${PATSHOME}/ccomp/atslib/lib64 –
version)
gcc (GCC) 4.8.2 20131212 (Red Hat 4.8.2-7)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There isNO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

exec(gcc -std=c99 -D_XOPEN_SOURCE -I${PATSHOME} -I${PATSHOME}/ccomp/runtime
-L${PATSHOME}/ccomp/atslib/lib -L${PATSHOME}/ccomp/atslib/lib64 –
version) = 0

Am I missing something? Should I be using another command (a similar
command has been working on previous examples)? Is there a problem with
my installation of ATS?

Thanks,
Shahab

If you want to run garbage collection, you can use -DATS_MEMALLOC_GCBDW.
If you do, you need libgc by Hans Bohem.On Wednesday, February 12, 2014 3:08:52 PM UTC-5, Brandon Barker wrote:

I just ran in to this one yesterday, you need the -DATS_MEMALLOC_LIBC flag.

ats2-lang / Wiki / compiler errors

On Wednesday, February 12, 2014 3:05:16 PM UTC-5, Shahab Tasharrofi wrote:

Hello,

I’m just trying to warm myself up with ATS and I’m going through the
online
tutorial here:
http://www.ats-lang.org/DOCUMENT/INT2PROGINATS/HTML/index.html

However, while trying to compile the “twice.dats” example using the
command “patscc twice.dats”, I get a compilation error that says
“undefined
reference to `atsruntime_malloc_undef’” (several times).

Here is the link to “twice.dats” that I have been using:

http://www.ats-lang.org/DOCUMENT/INT2PROGINATS/CODE/CHAP_FUNCTION/twice.dats

And, here’s the output of running “patscc --version”:

exec(patsopt --version)
Hello from ATS2(ATS/Postiats)!
ATS/Postiats version 0.0.5 with Copyright (c) 2011-2013 Hongwei Xi
exec(patsopt --version) = 0
exec(gcc -std=c99 -D_XOPEN_SOURCE -I${PATSHOME} -I${PATSHOME}/ccomp/runtime
-L${PATSHOME}/ccomp/atslib/lib -L${PATSHOME}/ccomp/atslib/lib64 --version
)
gcc (GCC) 4.8.2 20131212 (Red Hat 4.8.2-7)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

exec(gcc -std=c99 -D_XOPEN_SOURCE -I${PATSHOME} -I${PATSHOME}/ccomp/runtime
-L${PATSHOME}/ccomp/atslib/lib -L${PATSHOME}/ccomp/atslib/lib64 --version
) = 0

Am I missing something? Should I be using another command (a similar
command has been working on previous examples)? Is there a problem with
my installation of ATS?

Thanks,
Shahab

I just ran in to this one yesterday, you need the -DATS_MEMALLOC_LIBC flag.

http://sourceforge.net/p/ats2-lang/wiki/compiler%20errors/On Wednesday, February 12, 2014 3:05:16 PM UTC-5, Shahab Tasharrofi wrote:

Hello,

I’m just trying to warm myself up with ATS and I’m going through the online
tutorial here:
http://www.ats-lang.org/DOCUMENT/INT2PROGINATS/HTML/index.html

However, while trying to compile the “twice.dats” example using the
command “patscc twice.dats”, I get a compilation error that says “undefined
reference to `atsruntime_malloc_undef’” (several times).

Here is the link to “twice.dats” that I have been using:

http://www.ats-lang.org/DOCUMENT/INT2PROGINATS/CODE/CHAP_FUNCTION/twice.dats

And, here’s the output of running “patscc --version”:

exec(patsopt --version)
Hello from ATS2(ATS/Postiats)!
ATS/Postiats version 0.0.5 with Copyright (c) 2011-2013 Hongwei Xi
exec(patsopt --version) = 0
exec(gcc -std=c99 -D_XOPEN_SOURCE -I${PATSHOME} -I${PATSHOME}/ccomp/runtime
-L${PATSHOME}/ccomp/atslib/lib -L${PATSHOME}/ccomp/atslib/lib64 --version)
gcc (GCC) 4.8.2 20131212 (Red Hat 4.8.2-7)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
.

exec(gcc -std=c99 -D_XOPEN_SOURCE -I${PATSHOME} -I${PATSHOME}/ccomp/runtime
-L${PATSHOME}/ccomp/atslib/lib -L${PATSHOME}/ccomp/atslib/lib64 --version)
= 0

Am I missing something? Should I be using another command (a similar
command has been working on previous examples)? Is there a problem with
my installation of ATS?

Thanks,
Shahab