# ATS and OSX

**URL:** <https://discourse.ats-lang.org/t/ats-and-osx/670>\
**Category:** Google Group\
**Created:** [December 20, 2014, 12:17am UTC](https://discourse.ats-lang.org/t/ats-and-osx/670 "2014-12-20T00:17:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 20, 2014, 12:17am UTC](https://discourse.ats-lang.org/t/ats-and-osx/670/1 "2014-12-20T00:17:02Z")

</div>

Using ATS under MacOSX has been a thorny issue for quite sometime.  
Probably the easiest way to install ATS2 under OSX is by using a homebrew  
formula;

[https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ats2-postiats.rb](https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ats2-postiats.rb)

Here are some caveats:

1. ATS1 cannot be correctly compiled by clang. You need genuine gcc (the one  
on OSX is hooked to clang by default) to compile ATS1. See below.

2. When using gcc-4.x to compile ATS1, please make sure that you generate  
a no-gc version of ATS1. Let us refer to this version as ATS1-ngc.

3. Please use ATS1-ngc to compile ATS2.

Sounds complicated? All the steps can be found in the following file:

> <https://github.com/githwxi/ATS-Postiats/blob/master/.travis.yml>

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 22, 2014, 11:27pm UTC](https://discourse.ats-lang.org/t/ats-and-osx/670/2 "2014-12-22T23:27:33Z")

</div>

This is very good to know.

Could you use valgrind to get more information on this?

It looks like that there is a good chance for us to fix this bug.On Monday, December 22, 2014 5:46:38 PM UTC-5, William Blair wrote:

> Compiling without gmp seems to have fixed the issue.
> 
> On Monday, December 22, 2014 4:29:51 PM UTC-6, William Blair wrote:
> 
> > It looks like it wasn’t a double free issue. Instead, the error I  
> > occasionally get is
> > 
> > ```
> > "malloc: *** error for object 0x7ff8e80b7960: pointer being freed 
> > 
> > ```
> > 
> > was not allocated"
> > 
> > Going through the stack trace it looks like this happens at a call for  
> > “myint\_free” in pats\_lintprgrm.dats. I am thinking that compiling without  
> > gmp support would solve the issue.
> > 
> > On Monday, December 22, 2014 4:05:41 PM UTC-6, gmhwxi wrote:
> > 
> > > Can you tell where the double free occurred?
> > > 
> > > On Monday, December 22, 2014 3:35:04 PM UTC-5, William Blair wrote:
> > > 
> > > > Using the YAML file I was able to compile and run ATS2 from the git  
> > > > repository on Yosemite. A couple of things I found:
> > > > 
> > > > - I needed the real gcc to compile ATS2. Otherwise, patsopt crashed  
> > > > with a double free while compiling patscc.
> > > > 
> > > > - Homebrew installed gcc-4.9 on my system, so we might want to be able  
> > > > to configure the gcc program to use (the yaml file uses 4.8).
> > > > 
> > > > On Friday, December 19, 2014 6:17:02 PM UTC-6, gmhwxi wrote:
> > > > 
> > > > > Using ATS under MacOSX has been a thorny issue for quite sometime.  
> > > > > Probably the easiest way to install ATS2 under OSX is by using a  
> > > > > homebrew formula;
> > > > > 
> > > > > [https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ats2-postiats.rb](https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ats2-postiats.rb)
> > > > > 
> > > > > Here are some caveats:
> > > > > 
> > > > > 1. ATS1 cannot be correctly compiled by clang. You need genuine gcc  
> > > > > (the one  
> > > > > on OSX is hooked to clang by default) to compile ATS1. See below.
> > > > > 
> > > > > 2. When using gcc-4.x to compile ATS1, please make sure that you  
> > > > > generate  
> > > > > a no-gc version of ATS1. Let us refer to this version as ATS1-ngc.
> > > > > 
> > > > > 3. Please use ATS1-ngc to compile ATS2.
> > > > > 
> > > > > Sounds complicated? All the steps can be found in the following file:
> > > > > 
> > > > > [https://github.com/githwxi/ATS-Postiats/blob/master/.travis.yml](https://github.com/githwxi/ATS-Postiats/blob/master/.travis.yml)

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 22, 2014, 10:05pm UTC](https://discourse.ats-lang.org/t/ats-and-osx/670/3 "2014-12-22T22:05:41Z")

</div>

Can you tell where the double free occurred?On Monday, December 22, 2014 3:35:04 PM UTC-5, William Blair wrote:

> Using the YAML file I was able to compile and run ATS2 from the git  
> repository on Yosemite. A couple of things I found:
> 
> - I needed the real gcc to compile ATS2. Otherwise, patsopt crashed with a  
> double free while compiling patscc.
> 
> - Homebrew installed gcc-4.9 on my system, so we might want to be able to  
> configure the gcc program to use (the yaml file uses 4.8).
> 
> On Friday, December 19, 2014 6:17:02 PM UTC-6, gmhwxi wrote:
> 
> > Using ATS under MacOSX has been a thorny issue for quite sometime.  
> > Probably the easiest way to install ATS2 under OSX is by using a homebrew  
> > formula;
> > 
> > [https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ats2-postiats.rb](https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ats2-postiats.rb)
> > 
> > Here are some caveats:
> > 
> > 1. ATS1 cannot be correctly compiled by clang. You need genuine gcc (the  
> > one  
> > on OSX is hooked to clang by default) to compile ATS1. See below.
> > 
> > 2. When using gcc-4.x to compile ATS1, please make sure that you generate  
> > a no-gc version of ATS1. Let us refer to this version as ATS1-ngc.
> > 
> > 3. Please use ATS1-ngc to compile ATS2.
> > 
> > Sounds complicated? All the steps can be found in the following file:
> > 
> > [https://github.com/githwxi/ATS-Postiats/blob/master/.travis.yml](https://github.com/githwxi/ATS-Postiats/blob/master/.travis.yml)

---

<div class="post-metadata">

**Author:** ![William\_Blair](https://avatars.discourse-cdn.com/v4/letter/w/c68b51/32.png) [@William\_Blair](https://discourse.ats-lang.org/u/William_Blair)\
**Post date:** [December 22, 2014, 10:29pm UTC](https://discourse.ats-lang.org/t/ats-and-osx/670/4 "2014-12-22T22:29:51Z")

</div>

It looks like it wasn’t a double free issue. Instead, the error I  
occasionally get is

```
 "malloc: *** error for object 0x7ff8e80b7960: pointer being freed was 

```

not allocated"

Going through the stack trace it looks like this happens at a call for  
“myint\_free” in pats\_lintprgrm.dats. I am thinking that compiling without  
gmp support would solve the issue.On Monday, December 22, 2014 4:05:41 PM UTC-6, gmhwxi wrote:

> Can you tell where the double free occurred?
> 
> On Monday, December 22, 2014 3:35:04 PM UTC-5, William Blair wrote:
> 
> > Using the YAML file I was able to compile and run ATS2 from the git  
> > repository on Yosemite. A couple of things I found:
> > 
> > - I needed the real gcc to compile ATS2. Otherwise, patsopt crashed with  
> > a double free while compiling patscc.
> > 
> > - Homebrew installed gcc-4.9 on my system, so we might want to be able to  
> > configure the gcc program to use (the yaml file uses 4.8).
> > 
> > On Friday, December 19, 2014 6:17:02 PM UTC-6, gmhwxi wrote:
> > 
> > > Using ATS under MacOSX has been a thorny issue for quite sometime.  
> > > Probably the easiest way to install ATS2 under OSX is by using a  
> > > homebrew formula;
> > > 
> > > [https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ats2-postiats.rb](https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ats2-postiats.rb)
> > > 
> > > Here are some caveats:
> > > 
> > > 1. ATS1 cannot be correctly compiled by clang. You need genuine gcc (the  
> > > one  
> > > on OSX is hooked to clang by default) to compile ATS1. See below.
> > > 
> > > 2. When using gcc-4.x to compile ATS1, please make sure that you generate  
> > > a no-gc version of ATS1. Let us refer to this version as ATS1-ngc.
> > > 
> > > 3. Please use ATS1-ngc to compile ATS2.
> > > 
> > > Sounds complicated? All the steps can be found in the following file:
> > > 
> > > [https://github.com/githwxi/ATS-Postiats/blob/master/.travis.yml](https://github.com/githwxi/ATS-Postiats/blob/master/.travis.yml)

---

<div class="post-metadata">

**Author:** ![William\_Blair](https://avatars.discourse-cdn.com/v4/letter/w/c68b51/32.png) [@William\_Blair](https://discourse.ats-lang.org/u/William_Blair)\
**Post date:** [December 22, 2014, 10:46pm UTC](https://discourse.ats-lang.org/t/ats-and-osx/670/5 "2014-12-22T22:46:38Z")

</div>

Compiling without gmp seems to have fixed the issue.On Monday, December 22, 2014 4:29:51 PM UTC-6, William Blair wrote:

> It looks like it wasn’t a double free issue. Instead, the error I  
> occasionally get is
> 
> ```
> "malloc: *** error for object 0x7ff8e80b7960: pointer being freed 
> 
> ```
> 
> was not allocated"
> 
> Going through the stack trace it looks like this happens at a call for  
> “myint\_free” in pats\_lintprgrm.dats. I am thinking that compiling without  
> gmp support would solve the issue.
> 
> On Monday, December 22, 2014 4:05:41 PM UTC-6, gmhwxi wrote:
> 
> > Can you tell where the double free occurred?
> > 
> > On Monday, December 22, 2014 3:35:04 PM UTC-5, William Blair wrote:
> > 
> > > Using the YAML file I was able to compile and run ATS2 from the git  
> > > repository on Yosemite. A couple of things I found:
> > > 
> > > - I needed the real gcc to compile ATS2. Otherwise, patsopt crashed with  
> > > a double free while compiling patscc.
> > > 
> > > - Homebrew installed gcc-4.9 on my system, so we might want to be able  
> > > to configure the gcc program to use (the yaml file uses 4.8).
> > > 
> > > On Friday, December 19, 2014 6:17:02 PM UTC-6, gmhwxi wrote:
> > > 
> > > > Using ATS under MacOSX has been a thorny issue for quite sometime.  
> > > > Probably the easiest way to install ATS2 under OSX is by using a  
> > > > homebrew formula;
> > > > 
> > > > [https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ats2-postiats.rb](https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ats2-postiats.rb)
> > > > 
> > > > Here are some caveats:
> > > > 
> > > > 1. ATS1 cannot be correctly compiled by clang. You need genuine gcc  
> > > > (the one  
> > > > on OSX is hooked to clang by default) to compile ATS1. See below.
> > > > 
> > > > 2. When using gcc-4.x to compile ATS1, please make sure that you  
> > > > generate  
> > > > a no-gc version of ATS1. Let us refer to this version as ATS1-ngc.
> > > > 
> > > > 3. Please use ATS1-ngc to compile ATS2.
> > > > 
> > > > Sounds complicated? All the steps can be found in the following file:
> > > > 
> > > > [https://github.com/githwxi/ATS-Postiats/blob/master/.travis.yml](https://github.com/githwxi/ATS-Postiats/blob/master/.travis.yml)

---

<div class="post-metadata">

**Author:** ![William\_Blair](https://avatars.discourse-cdn.com/v4/letter/w/c68b51/32.png) [@William\_Blair](https://discourse.ats-lang.org/u/William_Blair)\
**Post date:** [December 22, 2014, 8:35pm UTC](https://discourse.ats-lang.org/t/ats-and-osx/670/6 "2014-12-22T20:35:04Z")

</div>

Using the YAML file I was able to compile and run ATS2 from the git  
repository on Yosemite. A couple of things I found:

- I needed the real gcc to compile ATS2. Otherwise, patsopt crashed with a  
double free while compiling patscc.

- Homebrew installed gcc-4.9 on my system, so we might want to be able to  
configure the gcc program to use (the yaml file uses 4.8).On Friday, December 19, 2014 6:17:02 PM UTC-6, gmhwxi wrote:

> Using ATS under MacOSX has been a thorny issue for quite sometime.  
> Probably the easiest way to install ATS2 under OSX is by using a homebrew  
> formula;
> 
> [https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ats2-postiats.rb](https://github.com/Homebrew/homebrew/blob/master/Library/Formula/ats2-postiats.rb)
> 
> Here are some caveats:
> 
> 1. ATS1 cannot be correctly compiled by clang. You need genuine gcc (the  
> one  
> on OSX is hooked to clang by default) to compile ATS1. See below.
> 
> 2. When using gcc-4.x to compile ATS1, please make sure that you generate  
> a no-gc version of ATS1. Let us refer to this version as ATS1-ngc.
> 
> 3. Please use ATS1-ngc to compile ATS2.
> 
> Sounds complicated? All the steps can be found in the following file:
> 
> [https://github.com/githwxi/ATS-Postiats/blob/master/.travis.yml](https://github.com/githwxi/ATS-Postiats/blob/master/.travis.yml)
