<div dir="ltr">Great!  Thanks.  I adapted that trick and it worked fine:<br><div><br></div><div><a href="https://github.com/rrnewton/haskell-lockfree-queue/blob/cb8ca1a5d8b4c02e45eeca54fbc66f0c58aeff56/AtomicPrimops/Setup.hs">https://github.com/rrnewton/haskell-lockfree-queue/blob/cb8ca1a5d8b4c02e45eeca54fbc66f0c58aeff56/AtomicPrimops/Setup.hs</a><br>

</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 22, 2013 at 11:53 PM, Carter Schonwald <span dir="ltr">&lt;<a href="mailto:carter.schonwald@gmail.com" target="_blank">carter.schonwald@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hey Ryan,<div>I ran into a related issue, heres a a way you can do this safe IN the cabal file (or at least you can modify my hack for your purposes)</div>

<div><br></div><div>heres a link to the workaround I did for making LLVM-hs work across &gt;= 1.17 and &lt; 1.17 cabal, but you could abuse it to make sure setup.hs barfs on old cabal <a href="https://github.com/bos/llvm/blob/master/base/Setup.hs#L89-L116" target="_blank">https://github.com/bos/llvm/blob/master/base/Setup.hs#L89-L116</a></div>



<div><br></div><div>heres a quick one off gist that takes my trick and does something helpful for you variant + makes sure the tool can&#39;t build otherwise</div><div><br></div><div><a href="https://gist.github.com/cartazio/5632636" target="_blank">https://gist.github.com/cartazio/5632636</a><br>



</div><div><br></div><div>I just wrote a snippet that you can just add to your setup.hs and it should guarantee the setup.hs will barf with a helpful error message on cabal &lt; 1.17.0</div></div><div class="gmail_extra">



<br><br><div class="gmail_quote"><div><div class="h5">On Wed, May 22, 2013 at 10:50 PM, Ryan Newton <span dir="ltr">&lt;<a href="mailto:rrnewton@gmail.com" target="_blank">rrnewton@gmail.com</a>&gt;</span> wrote:<br></div>

</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">

<div dir="ltr">A <a href="https://github.com/haskell/cabal/issues/1284" target="_blank">cabal-install bug</a> was fixed recently that pertains to building C libraries with profiling.<div><br></div><div>As a result, I want <a href="http://hackage.haskell.org/package/atomic-primops-0.1.0.2" target="_blank">a certain package</a> to test if cabal-install &lt; 0.17.0 is used, and throw a preemptive error.  Otherwise this package fails in weird ways at runtime (it&#39;s a nasty one).</div>





<div><br></div><div><div>I noticed with some surprise the following sequence:</div><div><br></div><div><font face="courier new, monospace"><b>   $ cabal --version</b></font></div><div><font face="courier new, monospace"><b>   cabal-install version 1.16.0.2</b></font></div>





<div><font face="courier new, monospace"><b>   using version 1.16.0.3 of the Cabal library</b></font></div><div><font face="courier new, monospace"><b>   $ cabal clean</b></font></div><div><font face="courier new, monospace"><b>   $ cabal install</b></font></div>





<div><font face="courier new, monospace"><b>   $ cat dist/build/autogen/cabal_macros.h  | grep VERSION_Cabal</b></font></div><div><font face="courier new, monospace"><b>   #define VERSION_Cabal &quot;1.17.0&quot;</b></font></div>





<div><br></div><div>Alright, so that, in retrospect, makes sense.  The version is which *my* library is linked with is the relevant one, not the one cabal-install was linked with [1].</div><div><br></div><div>So the natural next thought is to move the MIN_VERSION_Cabal test into Setup.hs, and force cabal to use it by setting the build type to Custom.  But... I just learned from this ticket that the cabal macros are not available in Setup.hs:</div>





<div><br></div><div>   <a href="http://hackage.haskell.org/trac/hackage/ticket/326" target="_blank">http://hackage.haskell.org/trac/hackage/ticket/326</a></div><div><br></div><div>Uh oh, what&#39;s left?  </div><div><br>



</div><div> -Ryan</div>

<div><br></div><div>[1] P.S. Personally I&#39;m now using a bash function like below, to force the two versions to be the same:</div><div><br></div><div>function safe_cabal_install () {</div><div>  VER=`cabal --version | tail -n1 | awk &#39;{ print $3 }&#39;`</div>





<div>  cabal install --constraint=&quot;Cabal==$VER&quot; $*</div><div>}</div><div><br></div></div></div>
<br></div></div>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>