<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Thanks for the analysis, Dan. I also found that these nested functions are a feature specific to GCC (here&#39;s a nice explanation: <a href="https://stackoverflow.com/a/8179587/1441112">https://stackoverflow.com/a/8179587/1441112</a>). I tried to count how many of these there are in the ACE code (e.g., assuming they are function signatures that are indented), and I came up with 50 (see the attached file). I think some would be trivial to replace, but when they are passed as arguments it might be more complicated.<br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Aug 22, 2018 at 3:58 PM Dan Flickinger &lt;<a href="mailto:danf@stanford.edu">danf@stanford.edu</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div id="m_-8839300609606902748divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi Woodley and Guy,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Following up on Bianca&#39;s and Guy&#39;s recent exchange, I did a little more experimenting with WSL and ACE, and it seems that Woodley was right two years ago to suspect those inner functions being uncooperative in WSL.  I
 compiled ACE from source in an Ubuntu version of WSL, and then tried compiling the ERG.  I got a segmentation fault which I tracked down (as Guy had done) to the function load_preprocessor, which defines an inner function and then calls iterate_conf_list with
 a pointer to that function as its second argument.  But iterate_conf_list fails when it tries to execute that function in the line &quot;if(callback(p)...&quot;.  I also tried commenting out that line, recompiling ACE, and then recompiling the ERG, and indeed, it gets
 almost all the way through before hitting a seg fault right after compiling the lexicon.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Here is a relevant thread I found about the issue in WSL:</p>
<p style="margin-top:0;margin-bottom:0"><a href="https://github.com/Microsoft/WSL/issues/3083" class="m_-8839300609606902748OWAAutoLink" id="m_-8839300609606902748LPlnk573425" target="_blank">https://github.com/Microsoft/WSL/issues/3083</a></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">My impression from that discussion is that the WSL folks believe enabling an executable stack would be a security hole and hence won&#39;t support it.  So if my reading is right, perhaps there is no hope of getting ACE to
 run on WSL, since as Woodley notes, these inner functions get used and passed as arguments in lots of places in the ACE code.  But it would be useful if Woodley could either confirm this apparent incompatibility so we can give up on WSL, or suggest a workaround
 if one is readily available.<br>
</p>
<br>
<p style="margin-top:0;margin-bottom:0"> Dan</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="m_-8839300609606902748divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> <a href="mailto:developers-bounces@emmtee.net" target="_blank">developers-bounces@emmtee.net</a> &lt;<a href="mailto:developers-bounces@emmtee.net" target="_blank">developers-bounces@emmtee.net</a>&gt; on behalf of Woodley Packard &lt;<a href="mailto:sweaglesw@sweaglesw.org" target="_blank">sweaglesw@sweaglesw.org</a>&gt;<br>
<b>Sent:</b> Thursday, November 17, 2016 10:40 AM<br>
<b>To:</b> Guy Emerson<br>
<b>Cc:</b> developers<br>
<b>Subject:</b> Re: [developers] ACE on Ubuntu on Windows</font>
<div> </div>
</div>

<div dir="auto">
<div>The only thing I notice about both of those crash contexts is that they likely involve inner functions, a GCC extension whose implementation requires an executable stack.  Some operating systems make the stack non-executable.  There may be a way of setting
 an option, if this is indeed the problem.  I would have thought it would have crashed earlier than lexical lookup, though, because I make extensive use of them.</div>
<div><br>
</div>
<div>Woodley<br>
<br>
<br>
</div>
<div><br>
On Nov 17, 2016, at 1:26 AM, Guy Emerson &lt;<a href="mailto:gete2@cam.ac.uk" id="m_-8839300609606902748LPlnk151607" class="m_-8839300609606902748OWAAutoLink" target="_blank">gete2@cam.ac.uk</a>&gt; wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>
<div dir="ltr">
<div>
<div>
<div>If I do that, it successfully builds.  I still get a segfault when trying to compile the ERG:<br>
<br>
reading configuration       from `../erg/trunk/ace/config.tdl&#39;<br>
reading types               from `../erg/trunk/ace/../mtr.tdl&#39;<br>
grammar version             ERG (trunk)<br>
<br>
Program received signal SIGSEGV, Segmentation fault.<br>
0x00007ffff121f688 in ?? ()<br>
(gdb) backtrace<br>
#0  0x00007ffff121f688 in ?? ()<br>
#1  0x00000000004d7909 in iterate_conf_list (key=key@entry=0x5bc11a &quot;preprocessor-modules&quot;, callback=callback@entry=0x7ffff121f688) at conf.c:534<br>
#2  0x00000000004d9fe1 in load_preprocessor () at preprocessor.c:58<br>
#3  0x0000000000471f80 in load_grammar (path=&lt;optimized out&gt;) at tdl.c:1660<br>
#4  0x000000000052aece in initialize_engine () at main.c:523<br>
#5  0x000000000045a47a in main (argc=5, argv=0x7ffff121fa88) at main.c:620<br>
<br>
<br>
</div>
Or when using the pre-compiled grammar:<br>
<br>
Program received signal SIGSEGV, Segmentation fault.<br>
0x00007fffccdfc110 in ?? ()<br>
(gdb) backtrace<br>
#0  0x00007fffccdfc110 in ?? ()<br>
#1  0x000000000045ad8d in visit_lexicon (stem=&lt;optimized out&gt;, visitor=visitor@entry=0x7fffccdfc110) at lexicon.c:137<br>
#2  0x0000000000481f78 in lexical_lookup (tc=tc@entry=0x7f09e27d0000) at morpho.c:283<br>
#3  0x00000000004eb2ba in lexical_lookup_into_chart (token_chart=token_chart@entry=0x7f09e27d0000) at lexical-parse.c:64<br>
#4  0x00000000004ca8f4 in parse_with_token_chart (token_chart=0x7f09e27d0000, start=start@entry=31250) at parse.c:481<br>
#5  0x00000000004cd9a1 in parse (sentence=0x806b40 &lt;current_sentence&gt; &quot;Hello&quot;, cto=0x1216100, cfrom=0x12160e0, words=0x12160c0, nwords=1) at parse.c:449<br>
#6  parse_line1 (line=&lt;optimized out&gt;, line@entry=0x7fffccdfeb60 &quot;Hello&quot;) at parse.c:743<br>
#7  0x00000000004cdb56 in parse_line (line=line@entry=0x7fffccdfeb60 &quot;Hello&quot;) at parse.c:768<br>
#8  0x000000000052ab79 in main_input_loop (fin=0x7f09e308f640 &lt;_IO_2_1_stdin_&gt;) at main.c:443<br>
#9  0x000000000045a4fa in main (argc=4, argv=0x7fffcce014e8) at main.c:653<br>
<br>
<br>
</div>
If it&#39;s not clear why these lines could cause a segfault, I will assume there is a problem with the Windows Subsystem for Linux (it&#39;s still labelled &quot;beta&quot;, after all), and I&#39;ll try again in a few months.<br>
</div>
<div>
<div><br>
</div>
</div>
</div>
<div class="m_-8839300609606902748x_gmail_extra"><br>
<div class="m_-8839300609606902748x_gmail_quote">2016-11-16 22:23 GMT+00:00 Woodley Packard <span dir="ltr">
&lt;<a href="mailto:sweaglesw@sweaglesw.org" id="m_-8839300609606902748LPlnk733492" class="m_-8839300609606902748OWAAutoLink" target="_blank">sweaglesw@sweaglesw.org</a>&gt;</span>:<br>
<blockquote class="m_-8839300609606902748x_gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="auto">
<div>Hi Guy,</div>
<div><br>
</div>
<div>You are on the right track with the two lines in the makefile commented out.</div>
<div><br>
</div>
<div>Something has perhaps changed since it has been built in that mode.  Try adding this to the top of itsdb.c:</div>
<div><br>
</div>
<div>#define capi_printf printf</div>
<div><br>
</div>
<div>and running &quot;make&quot; again?</div>
<span class="m_-8839300609606902748x_HOEnZb"><font color="#888888">
<div>Woodley<br>
<br>
<br>
</div>
</font></span>
<div>
<div class="m_-8839300609606902748x_h5">
<div><br>
On Nov 16, 2016, at 8:47 AM, Guy Emerson &lt;<a href="mailto:gete2@cam.ac.uk" id="m_-8839300609606902748LPlnk810134" class="m_-8839300609606902748OWAAutoLink" target="_blank">gete2@cam.ac.uk</a>&gt; wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>I used the precompiled binary and grammar - I didn&#39;t realise that librepp was only for compiling from source.<br>
<br>
</div>
Running gdb, I get:<br>
<br>
Program received signal SIGSEGV, Segmentation fault.<br>
0x00007fffdec22300 in ?? ()<br>
(gdb) backtrace<br>
#0  0x00007fffdec22300 in ?? ()<br>
#1  0x000000000046290a in visit_lexicon (stem=&lt;optimized out&gt;, visitor=0x7fffdec22300) at lexicon.c:137<br>
#2  0x00000000004845fc in lexical_lookup (tc=0x7f27168d0000) at morpho.c:283<br>
#3  0x00000000004df9b1 in lexical_lookup_into_chart (token_chart=0x7f27168d0000) at lexical-parse.c:64<br>
#4  0x00000000004c0ff8 in parse_with_token_chart (token_chart=0x7f27168d0000, start=46875) at parse.c:481<br>
#5  0x00000000004c37e1 in parse_line1 (line=0x7fffdec22540 &quot;Hello&quot;) at parse.c:743<br>
#6  0x00000000004c3936 in parse_line (line=0x6005692cfc &quot;,-i\005`&quot;) at parse.c:768<br>
#7  0x0000000000516677 in main_input_loop (fin=0x7f271708f640 &lt;_IO_2_1_stdin_&gt;) at main.c:443<br>
#8  0x0000000000517561 in main (argc=4, argv=0x7fffdec276c8) at main.c:653<br>
<br>
<br>
</div>
If I try to compile the ERG image (using the precompiled binary), I also get a seg fault:<br>
<br>
Program received signal SIGSEGV, Segmentation fault.<br>
0x00007fffcea82cd8 in ?? ()<br>
(gdb) backtrace<br>
#0  0x00007fffcea82cd8 in ?? ()<br>
#1  0x00000000004ccfbe in iterate_conf_list (key=&lt;optimized out&gt;, callback=0x7fffcea82cd8) at conf.c:534<br>
#2  0x00000000004ce9aa in load_preprocessor () at preprocessor.c:58<br>
#3  0x0000000000472772 in load_grammar (path=0x7fffcea831fc &quot;/home/Guy/delphin/erg/trunk/ace/config.tdl&quot;) at tdl.c:1660<br>
#4  0x0000000000515dbe in initialize_engine () at main.c:523<br>
#5  0x000000000051735d in main (argc=6, argv=0x7fffcea82fb8) at main.c:620<br>
<br>
<br>
</div>
If I try to compile ACE from source, without any changes, there is an error that itsdb.h is not found.<br>
<br>
</div>
If I try to compile ACE after commenting out the two lines in the Makefile for itsdb, there is an error that capi_printf is not defined in itsdb.o.<br>
<br>
</div>
<div>If I also remove itsdb.o from the Makefile, many things are undefined.<br>
</div>
<div><br>
<br>
<br>
</div>
As I&#39;m not a C developer, I have very little sense about how easy this would be to debug or to fix...  I&#39;m quite happy to be told this is not worth the effort!<br>
<br>
<div>
<div>
<div>
<div>
<div><br>
<div>
<div class="m_-8839300609606902748x_gmail_extra"><br>
<div class="m_-8839300609606902748x_gmail_quote">2016-11-15 17:12 GMT+00:00 Woodley Packard <span dir="ltr">
&lt;<a href="mailto:sweaglesw@sweaglesw.org" id="m_-8839300609606902748LPlnk348311" class="m_-8839300609606902748OWAAutoLink" target="_blank">sweaglesw@sweaglesw.org</a>&gt;</span>:<br>
<blockquote class="m_-8839300609606902748x_gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Out of curiousity, Guy, were you able to use the precompiled binary for ACE or did you have to compile your own?  I wouldn’t have thought you would need to install the librepp and boost dependencies if using the binaries.  It looks like you are using the precompiled
 ERG image though.  You could be getting a crash if you are using a stock 0.9.24 grammar image with SVN trunk ACE source code.  On the off chance that you are doing that, please try compiling the ERG image with the same ACE binary you are using.  It *might*
 be helpful to recompile the ERG image anyway.<br>
<br>
Regards,<br>
-Woodley<br>
<span class="m_-8839300609606902748x_m_8802293375081032903gmail-m_-5011576991605837287im m_-8839300609606902748x_m_8802293375081032903gmail-m_-5011576991605837287HOEnZb"><br>
&gt; On Nov 15, 2016, at 6:33 AM, Guy Emerson &lt;<a href="mailto:gete2@cam.ac.uk" id="m_-8839300609606902748LPlnk896778" class="m_-8839300609606902748OWAAutoLink" target="_blank">gete2@cam.ac.uk</a>&gt; wrote:<br>
&gt;<br>
</span>
<div class="m_-8839300609606902748x_m_8802293375081032903gmail-m_-5011576991605837287HOEnZb">
<div class="m_-8839300609606902748x_m_8802293375081032903gmail-m_-5011576991605837287h5">&gt; I am trying to run ACE on Windows 10&#39;s new Linux Subsystem.  I can run ACE with the ERG, but whatever input I give, I get the message &quot;ERROR: DEADLY SIGNAL!&quot;<br>
&gt;<br>
&gt; It looks like it finishes the token mapping, and fails when applying a syntactic rule.  Verbose output is below.<br>
&gt;<br>
&gt; I&#39;ve already installed repp-0.2.2 (which required me to also install libboost), and I&#39;ve set the TMPDIR environment variable, as suggested on the ACE homepage.<br>
&gt;<br>
&gt; Any ideas on what else I would need to do?  Could there be other dependencies I need to install?<br>
&gt;<br>
&gt; Best,<br>
&gt; Guy<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; ./ace -g erg-1214-x86-64-0.9.24.dat -1Tf -vvv<br>
&gt; NOTE: loading frozen grammar ERG (1214)<br>
&gt; NOTE: semantic index hash contains 28857 entries in 65536 slots<br>
&gt; NOTE: max-ent model hash contains 659414 entries in 1048576 slots<br>
&gt; NOTE: 9280 types, 38259 lexemes, 293 rules, 47 orules, 101 instances, 48101 strings, 216 features<br>
&gt; permanent RAM: 4k<br>
&gt;<br>
&gt; Hello<br>
&gt; Hello/UH<br>
&gt; token #12 le 0x7f07295d7fcc vtx [0-1] char [0-5] string &#39;hello&#39; dag #D[token +FORM: #D[&quot;hello&quot;] +FROM: &lt;1&gt;= #D[&quot;0&quot;] +TO: #D[&quot;5&quot;] +ID: #D[*diff-list* LIST: #D[*list*] LAST: #D[*list*] ] +TNT: #D[null_tnt +TAGS: #D[*null*] +PRBS: #D[*null*] +MAIN: #D[tnt_main
 +TAG: #D[&quot;UH&quot;] +PRB: #D[&quot;1.0&quot;] ] ] +CLASS: #D[alphabetic +INITIAL: #D[+] +CASE: #D[capitalized+lower] ] +TRAIT: #D[token_trait +UW: #D[-] +IT: #D[italics] +LB: #D[bracket_null] +RB: #D[bracket_null] +HD: #D[token_head +LL: #D[ctype -CTYPE-: #D[string] ] +TG:
 #D[string] +TI: &lt;1&gt; ] ] +PRED: #D[predsort] +CARG: #D[&quot;Hello&quot;] +TICK: #D[bool] ]<br>
&gt; token #13 le 0x7f07295d87e0 vtx [0-1] char [0-5] string &#39;hello&#39; dag #D[token +FORM: #D[&quot;hello&quot;] +FROM: &lt;1&gt;= #D[&quot;0&quot;] +TO: #D[&quot;5&quot;] +ID: #D[*diff-list* LIST: #D[*list*] LAST: #D[*list*] ] +TNT: #D[null_tnt +TAGS: #D[*null*] +PRBS: #D[*null*] +MAIN: #D[tnt_main
 +TAG: #D[string] +PRB: #D[string] ] ] +CLASS: #D[bridge_class] +TRAIT: #D[token_trait +UW: #D[+] +IT: #D[italics] +LB: #D[bracket_null] +RB: #D[bracket_null] +HD: #D[token_head +LL: #D[ctype -CTYPE-: #D[string] ] +TG: #D[string] +TI: &lt;1&gt; ] ] +PRED: #D[&quot;_hello_u_bridge_rel&quot;]
 +CARG: #D[&quot;Hello&quot;] +TICK: #D[bool] ]<br>
&gt; finished token mapping<br>
&gt; hello -&gt; hello [2 ways]<br>
&gt;<br>
&gt;          non_third_sg_fin_v_rbst<br>
&gt; hello -&gt; hello [2 ways]<br>
&gt;<br>
&gt;          non_third_sg_fin_v_rbst<br>
&gt; ERROR: DEADLY SIGNAL! sent = `Hello&#39;<br>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>

</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">-Michael Wayne Goodman</div>