<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Just tested a build with this macro line instead of the one I suggested, and I can confirm it builds on both of the macs I tested it on (llvm-gcc 4.2 and llvm-gcc 4.6.1). Good to hear it's fixed already...</div><div><br></div><div>Best,</div><div>Ed</div><br><div><div>On 17 May 2012, at 00:06, Andreas Stolcke wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<div bgcolor="#FFFFFF" text="#000000">
This was previously reported at
<a class="moz-txt-link-freetext" href="http://www.speech.sri.com/pipermail/srilm-user/2012q2/001197.html">http://www.speech.sri.com/pipermail/srilm-user/2012q2/001197.html</a> .<br>
The current (not yet released) code in Array.h has <br>
<br>
#if !defined(DEBUG) && defined(__GNUC__) &&
!defined(__clang__) && (!defined(__INTEL_COMPILER) ||
__INTEL_COMPILER >=900)<br>
<br>
and that should take care of your problem.<br>
<br>
Andreas<br>
<br>
<br>
On 5/16/2012 3:49 PM, Edward Thomas Grefenstette wrote:
<blockquote cite="mid:D3C2274D-0436-4B1C-BCCB-40F91D645ECD@gmail.com" type="cite">
<div>After further investigation, it turns out you are correct. I
was also having compilation problems with apple's llvm-gcc 4.2
(on an older system), which I would not encounter if I
explicitly asked to use the non-apple non-llvm-based g++-4.2 on
the same system.</div>
<div><br>
</div>
<div>The fault lies with the llvm-gcc/clang not liking the
non-static definition in srlim/dstruct/src/Array.h:</div>
<div><br>
</div>
<div>
<div>
<div>#if !defined(DEBUG) && defined(__GNUC__)
&& (!defined(__INTEL_COMPILER) || __INTEL_COMPILER
>=900)</div>
<div># define makeArray(T, A, n)<span class="Apple-tab-span" style="white-space:pre"> </span>T A[n]</div>
<div>#else</div>
<div># define makeArray(T, A, n)<span class="Apple-tab-span" style="white-space:pre"> </span>StaticArray<T> A(n)</div>
<div>#endif</div>
</div>
</div>
</blockquote>
<blockquote cite="mid:D3C2274D-0436-4B1C-BCCB-40F91D645ECD@gmail.com" type="cite">
<div><br>
</div>
<div>The first option (T A[n]) is selected for llvm-gcc, when in
fact it should be the second.</div>
<div><br>
</div>
<div>If you I replace the whole section above in Array.h with the
following line</div>
<div><br>
</div>
<div>
<div>#if !defined(DEBUG) && defined(__GNUC__) &&
(!defined(__INTEL_COMPILER) || __INTEL_COMPILER >=900)
&& !defined(__llvm__)</div>
</div>
<div><br>
</div>
<div>then srlim compiles fine with llvm-gcc-4.x, without need for
modification of LatticeIndex.cc and LatticeNgrams.cc, as it
correctly detects llvm-gcc or clang which <a moz-do-not-send="true" href="http://clang.llvm.org/compatibility.html#vla">do not
generally support variable length arrays</a>, and defines
makearray appropriately.</div>
<div><br>
</div>
<div>How do I submit a patch?</div>
<div><br>
</div>
<div>Best,</div>
<div>Ed</div>
<br>
<div>
<div>On 16 May 2012, at 19:05, Andreas Stolcke wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div bgcolor="#FFFFFF" text="#000000"> On 5/16/2012 9:25 AM,
Edward Grefenstette wrote:
<blockquote cite="mid:AC7E2B16-FD1E-4634-B5C9-E6BEBFBC5909@gmail.com" type="cite">
<div>Dear srilm users,</div>
<div><br>
</div>
As mentioned in another email, <a moz-do-not-send="true" href="http://stackoverflow.com/questions/10606983/problems-installing-srilm-on-os-x-10-7">I've
encountered and later resolved some problems building
srilm with gcc v4.6</a>. The fault, it seems, lays with
the makearray declarations used in LatticeIndex.cc
and LatticeNgrams.cc found in ./lattice/src/ of the srilm
folder.
<div><br>
</div>
<div>I've managed to get srilm to compile by "cheating"
and using an older version of g++ passed to make with
CXX flag, but ideally it'd be better to fix the source
to be compliant with C++0x, as enforced by gcc versions
>= 4.3 (I think).</div>
<div><br>
</div>
<div>I attach to this email the modified LatticeIndex.cc
and LatticeNgrams.cc files from srilm 1.6.0 (diffs
reproduced at the end of the email), which allowed me to
compile srilm using gcc 4.6.1 without passing an older
g++ using the CXX flag. Could someone please sanity
check the changes? If they're good, it'd be nice to see
these files updated in the main distribution so that
others don't encounter this frustrating problem when
they update their compilers and decide to (re)build
srilm.</div>
</blockquote>
SRILM compiles fine on gcc 4.5.x, which is the latest
version I've verified myself.<br>
<br>
It is possible that gcc 4.6.x changed (removed) the support
for stack-allocated arrays with size computed at run-time,
to be inline with standard C++. In that case a simple
change in Array.h (the conditional definition of
makeArray()) should suffice.<br>
<br>
I will try to get my hands on gcc 4.6.x to verify this, but
feel free to submit a patch along those lines.<br>
<br>
Andreas<br>
<br>
</div>
</blockquote>
</div>
<br>
</blockquote>
<br>
</div>
_______________________________________________<br>SRILM-User site list<br><a href="mailto:SRILM-User@speech.sri.com">SRILM-User@speech.sri.com</a><br>http://www.speech.sri.com/mailman/listinfo/srilm-user</blockquote></div><br></body></html>