Linker command fails when boxed tuple used

53 views
Skip to first unread message

Mustapha Rashduddin

unread,
May 12, 2017, 8:52:48 AM5/12/17
to ats-lang-users
patscc -o main main.dats
compiles fine on macOS Sierra Version 10.12.4 when it's not boxed, however when i box it the following error is thrown:

Undefined symbols for architecture x86_64:
  "_atsruntime_malloc_undef", referenced from:
      __057_Users_057_ibnShahid_057_research_057_ats_057_2_057_2_056_7_Tuples_and_Tuple_Types_057_main_056_dats__dynload in main_dats-067d86.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

heres the source code (main.dats):


#include "share/atspre_define.hats"
#include "share/atspre_staload.hats"

val area = PI * radius * radius where {
        val PI = 3.14 and radius = 10.0 // simultaneous bindings
} // end of [where] // end of [val]

val xyz = ( 'A', 1, 2.0 )
val x = xyz.0 and y = xyz.1 and z = xyz.2
// val (x, y, z) = xyz

var _ = print (area)

implement main0 () = () // a dummy for [main]

Mustapha Rashduddin

unread,
May 12, 2017, 8:56:00 AM5/12/17
to ats-lang-users
val xyz = '( 'A', 1, 2.0 )   <---- when I make the tuple boxed, that's when linker command fails

Hongwei Xi

unread,
May 12, 2017, 9:05:28 AM5/12/17
to ats-lan...@googlegroups.com
The reason is that a boxed tuple needs malloc/free.

Please pass the flag -DATS_MEMALLOC_LIBC to patscc.

If you have the command myatscc, then you can just use myatscc to compile the example.


On Fri, May 12, 2017 at 8:55 AM, Mustapha Rashduddin <saif.ras...@gmail.com> wrote:
val xyz = '( 'A', 1, 2.0 )   <---- when I make the tuple boxed, that's when linker command fails

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/c217b1b8-185c-4185-a768-0109c0e7d4a0%40googlegroups.com.

Mustapha Rashduddin

unread,
May 12, 2017, 10:00:49 AM5/12/17
to ats-lang-users
Thanks the answer was correct,

however in the future if I get an error similar to:

Undefined symbols for architecture x86_64:
  "_atsruntime_malloc_undef", referenced from:
      __057_Users_057_ibnShahid_057_research_057_ats_057_2_057_2_056_7_Tuples_and_Tuple_Types_057_main_056_dats__dynload in main_dats-067d86.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

how would I know what to link, are there any tutorials/manuals online which would show me how to figure this out by myself?

thanks again.

On Friday, May 12, 2017 at 2:05:28 PM UTC+1, gmhwxi wrote:
The reason is that a boxed tuple needs malloc/free.

Please pass the flag -DATS_MEMALLOC_LIBC to patscc.

If you have the command myatscc, then you can just use myatscc to compile the example.

On Fri, May 12, 2017 at 8:55 AM, Mustapha Rashduddin <saif.ras...@gmail.com> wrote:
val xyz = '( 'A', 1, 2.0 )   <---- when I make the tuple boxed, that's when linker command fails

--
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.

Hongwei Xi

unread,
May 12, 2017, 10:12:08 AM5/12/17
to ats-lan...@googlegroups.com
As of now, the most efficient way is probably doing what you just did, that is,
using the ats-lang-users group.

You could also raise your questions on stackoverflow: http://stackoverflow.com/questions/tagged/ats

To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages