<div dir="ltr"><div dir="ltr">In order to get this to build on my Mac, I need the following patch :(<div><br></div><div><div>diff --git a/src/Makefile.am b/src/Makefile.am</div><div>index 8a929f50..c6653dad 100644</div><div>--- a/src/Makefile.am</div><div>+++ b/src/Makefile.am</div><div>@@ -56,7 +56,7 @@ dist_libfsm_la_SOURCES = \</div><div> nodist_libfsm_la_SOURCES = \</div><div> version.h</div><div><br></div><div>-libfsm_la_LDFLAGS = -Wl,--no-undefined -no-undefined</div><div>+libfsm_la_LDFLAGS = -no-undefined</div><div><br></div><div> #</div><div> # libragel: ragel program minus host-specific code</div><div>@@ -67,7 +67,7 @@ dist_libragel_la_SOURCES = \</div><div> parsedata.h parsetree.h inputdata.h pcheck.h reducer.h rlscan.h load.h \</div><div> parsetree.cc longest.cc parsedata.cc inputdata.cc load.cc reducer.cc</div><div><br></div><div>-libragel_la_LDFLAGS = -Wl,--no-undefined -no-undefined</div><div>+libragel_la_LDFLAGS = -no-undefined</div><div> libragel_la_LIBADD = <a href="http://libfsm.la">libfsm.la</a> $(COLM_LD)</div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Nov 28, 2018 at 7:45 AM Ken Brown <<a href="mailto:kbrown@cornell.edu">kbrown@cornell.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">A patch along these lines is attached.<br>
<br>
On 11/28/2018 10:12 AM, Ken Brown wrote:<br>
> Rather than check for Cygwin, I think you can just use<br>
> <br>
> -Wl,--no-undefined -no-undefined<br>
> <br>
> on all platforms. That works fine on Cygwin, and I think it should work on<br>
> Linux too. libtool is happy to see '-no-undefined' on Cygwin and probably<br>
> doesn't care about it on Linux, while '-Wl,--no-undefined' shows up in the link<br>
> command on all platforms (and is redundant on Cygwin).<br>
> <br>
> Ken<br>
> <br>
> On 11/28/2018 9:15 AM, Adrian Thurston wrote:<br>
>> Ok, I guess we check for cygwin and use the appropriate option. I don't normally<br>
>> build on cygwin so I would like to enforce it on linux as well.<br>
>><br>
>> On 2018-11-28 00:03, Ken Brown wrote:<br>
>>> This seems to confirm my interpretation of "-no-undefined":<br>
>>><br>
>>> $ libtool --help --mode=link | grep -- -no-undefined<br>
>>> -no-undefined declare that a library does not refer to external symbols<br>
>>><br>
>>> Ken<br>
>>><br>
>>> On 11/27/2018 11:09 AM, Ken Brown wrote:<br>
>>>> OK, that's good that I can forget about --with-ragel. As to how -no-undefined<br>
>>>> works, I've done some googling and still don't fully understand it. I see the<br>
>>>> -no-undefined flag passed to libtool but then it doesn't appear in the final<br>
>>>> link command:<br>
>>>><br>
>>>> /bin/sh ../libtool --tag=CXX --mode=link g++ -Wall -g -no-undefined...<br>
>>>><br>
>>>> libtool: link: g++ -shared -nostdlib<br>
>>>> /usr/lib/gcc/x86_64-pc-cygwin/7.3.0/crtbeginS.o .libs/libfsm_la-idbase.o<br>
>>>> .libs/libfsm_la-fsmstate.o .libs/libfsm_la-fsmbase.o .libs/libfsm_la-fsmattach.o<br>
>>>> .libs/libfsm_la-fsmmin.o .libs/libfsm_la-fsmgraph.o .libs/libfsm_la-fsmap.o<br>
>>>> .libs/libfsm_la-fsmcond.o .libs/libfsm_la-fsmnfa.o .libs/libfsm_la-common.o<br>
>>>> .libs/libfsm_la-redfsm.o .libs/libfsm_la-gendata.o .libs/libfsm_la-allocgen.o<br>
>>>> .libs/libfsm_la-codegen.o .libs/libfsm_la-actexp.o .libs/libfsm_la-binvar.o<br>
>>>> .libs/libfsm_la-tables.o .libs/libfsm_la-tabgoto.o .libs/libfsm_la-tabvar.o<br>
>>>> .libs/libfsm_la-binary.o .libs/libfsm_la-bingoto.o .libs/libfsm_la-actloop.o<br>
>>>> .libs/libfsm_la-flat.o .libs/libfsm_la-flatgoto.o .libs/libfsm_la-flatvar.o<br>
>>>> .libs/libfsm_la-goto.o .libs/libfsm_la-gotoloop.o .libs/libfsm_la-gotoexp.o<br>
>>>> .libs/libfsm_la-ipgoto.o .libs/libfsm_la-dot.o .libs/libfsm_la-asm.o<br>
>>>> -L/home/kbrown/src/colm/src -L/usr/lib/gcc/x86_64-pc-cygwin/7.3.0<br>
>>>> -L/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/../../../../x86_64-pc-cygwin/lib/../lib<br>
>>>> -L/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/../../../../lib -L/lib/../lib<br>
>>>> -L/usr/lib/../lib<br>
>>>> -L/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/../../../../x86_64-pc-cygwin/lib<br>
>>>> -L/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/../../.. -lstdc++ -lgcc_s -lgcc -lcygwin<br>
>>>> -ladvapi32 -lshell32 -luser32 -lkernel32 -lgcc_s -lgcc<br>
>>>> /usr/lib/gcc/x86_64-pc-cygwin/7.3.0/crtend.o -g -o .libs/cygfsm-0.dll<br>
>>>> -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libfsm.dll.a<br>
>>>><br>
>>>> I think the point might be that gcc/g++ will give errors on Cygwin if there are<br>
>>>> undefined symbols in shared libraries, and libtool enforces that by insisting on<br>
>>>> the -no-undefined flag, which is simply an assertion that there are no undefined<br>
>>>> symbols. That's mostly a guess.<br>
>>>><br>
>>>> I have the same automake, autoconf, and libtool versions as you, but a newer gcc<br>
>>>> (7.3.0).<br>
>>>><br>
>>>> Ken<br>
>>>><br>
>>>> On 11/27/2018 5:49 AM, Adrian Thurston wrote:<br>
>>>>> First, the easy part ... you can take out --with-ragel and --with-kelbt<br>
>>>>> options.<br>
>>>>> They were only there to fall back to during the transition to the colm<br>
>>>>> frontend.<br>
>>>>> I've committed to the colm parser though and will be removing the old one soon.<br>
>>>>><br>
>>>>> With regards to linking, it has no effect for me when I used -no-undefined.<br>
>>>>> Seems to get stripped out by autotools because it doesn't make it into the link<br>
>>>>> command.<br>
>>>>><br>
>>>>> libragel_la_LDFLAGS = -no-undefined<br>
>>>>><br>
>>>>> ... results in ...<br>
>>>>><br>
>>>>> libtool: link: g++ -fPIC -DPIC -shared -nostdlib<br>
>>>>> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o<br>
>>>>> /usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o .libs/libragel_la-parsetree.o<br>
>>>>> .libs/libragel_la-longest.o .libs/libragel_la-parsedata.o<br>
>>>>> .libs/libragel_la-inputdata.o .libs/libragel_la-load.o<br>
>>>>> .libs/libragel_la-reducer.o -Wl,-rpath<br>
>>>>> -Wl,/home/thurston/devel/ragel/src/.libs -Wl,-rpath<br>
>>>>> -Wl,/home/thurston/pkgs/colm/lib -Wl,-rpath -Wl,/home/thurston/pkgs/ragel/lib<br>
>>>>> -Wl,-rpath -Wl,/home/thurston/pkgs/colm/lib -L/home/thurston/pkgs/colm/lib<br>
>>>>> ./.libs/libfsm.so /home/thurston/pkgs/colm/lib/libcolm.so<br>
>>>>> -L/usr/lib/gcc/x86_64-linux-gnu/5<br>
>>>>> -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu<br>
>>>>> -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu<br>
>>>>> -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib<br>
>>>>> -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. -lstdc++ -lm -lc -lgcc_s<br>
>>>>> /usr/lib/gcc/x86_64-linux-gnu/5/crtendS.o<br>
>>>>> /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o -g<br>
>>>>> -Wl,-soname<br>
>>>>> -Wl,libragel.so.0 -o .libs/libragel.so.0.0.0<br>
>>>>><br>
>>>>> My setup is ubuntu with the following versions.<br>
>>>>><br>
>>>>> [thurston@railay] src: g++ -v; automake --version; autoconf --version; libtool<br>
>>>>> --version<br>
>>>>> gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)<br>
>>>>> automake (GNU automake) 1.15<br>
>>>>> autoconf (GNU Autoconf) 2.69<br>
>>>>> libtool (GNU libtool) 2.4.6<br>
>>>>><br>
>>>>> Will have to dig a bit. Maybe the option is controlled by some other flag.<br>
>>>>><br>
>>>>> On 2018-11-26 16:30, Ken Brown wrote:<br>
>>>>>> Thanks. There are still two problems:<br>
>>>>>><br>
>>>>>> First, the syntax for the libtool '-no-undefined' flag is wrong. It should<br>
>>>>>> simply be '-no-undefined' (one leading hyphen, no -Wl), as in the patch I<br>
>>>>>> submitted. Otherwise, I get the following error if I try to build<br>
>>>>>> shared libraries:<br>
>>>>>><br>
>>>>>> libtool: error: can't build x86_64-unknown-cygwin shared library unless<br>
>>>>>> -no-undefined is specified<br>
>>>>>><br>
>>>>>> Second, although your change takes care of the reference to rl_parse, which is<br>
>>>>>> the only undefined reference in a build --without-ragel, there are two further<br>
>>>>>> "undefined reference" errors if I build with ragel installed:<br>
>>>>>><br>
>>>>>> .libs/libragel_la-inputdata.o: In function<br>
>>>>>> `InputData::checkLastRef(InputItem*)':<br>
>>>>>> /home/kbrown/src/ragel/src/inputdata.cc:313: undefined reference to<br>
>>>>>> `Parser6::terminateParser()'<br>
>>>>>> [...]<br>
>>>>>> .libs/libragel_la-inputdata.o: In function `InputData::parseKelbt()':<br>
>>>>>> /home/kbrown/src/ragel/src/inputdata.cc:427: undefined reference to<br>
>>>>>> `Scanner::do_scan()'<br>
>>>>>><br>
>>>>>> These are defined in rlparse.cc and rlscan.cc, which aren't in the sources for<br>
>>>>>> libragel.<br>
>>>>>><br>
>>>>>> Ken<br>
>>>>>><br>
>>>>>> On 11/26/2018 11:40 AM, Adrian Thurston wrote:<br>
>>>>>>> Ah, sorry, I forgot to push from my private repo to the public one. There<br>
>>>>>>> now.<br>
>>>>>>><br>
>>>>>>> On 2018-11-25 12:11, Ken Brown wrote:<br>
>>>>>>>> Hi Adrian,<br>
>>>>>>>><br>
>>>>>>>> Thanks. Have you pushed these changes to the upstream git repo? I'm getting<br>
>>>>>>>> "Already up to date" when I do "git pull".<br>
>>>>>>>><br>
>>>>>>>> Ken<br>
>>>>>>>><br>
>>>>>>>> On 11/25/2018 8:22 AM, Adrian Thurston wrote:<br>
>>>>>>>>> Hi Ken, thank you for the patches. I just enabled --no-undefined and<br>
>>>>>>>>> removed the<br>
>>>>>>>>> reference to the undefined symbol. The parse.c file cannot be included in<br>
>>>>>>>>> libragel because it defines the frontnend language, which is different for<br>
>>>>>>>>> each<br>
>>>>>>>>> binary in the host-* directories. All that was needed was to pass the<br>
>>>>>>>>> reference<br>
>>>>>>>>> to rl_parse into libragel from main.cc. Was already doing that for the<br>
>>>>>>>>> backend<br>
>>>>>>>>> code generator (also a colm program).<br>
>>>>>>>>><br>
>>>>>>>>> Adrian<br>
>>>>>>>>><br>
>>>>>>>>> On 2018-11-16 16:58, Ken Brown wrote:<br>
>>>>>>>>>> I've just built ragel-7.0.0.11 on Cygwin and added it to the Cygwin<br>
>>>>>>>>>> distribution. I had to patch the sources in order to build shared<br>
>>>>>>>>>> libraries.<br>
>>>>>>>>>><br>
>>>>>>>>>> libtool won't build shared libraries on Cygwin unless the<br>
>>>>>>>>>> -no-undefined flag is given. The first patch of this series does that<br>
>>>>>>>>>> for libfsm and libragel. But it turns out that there are in fact<br>
>>>>>>>>>> undefined symbols in libragel. The next two patches fix that.<br>
>>>>>>>>>><br>
>>>>>>>>>> I don't think these patches do any harm on other platforms.<br>
>>>>>>>>>><br>
>>>>>>>>>> Ken Brown (3):<br>
>>>>>>>>>> add -no-undefined to LDFLAGS for libfsm and libragel<br>
>>>>>>>>>> add dependency of libragel on libfsm and libcolm<br>
>>>>>>>>>> avoid undefined symbols in libragel<br>
>>>>>>>>>><br>
>>>>>>>>>> src/Makefile.am | 20 ++++++++++++++------<br>
>>>>>>>>>> 1 file changed, 14 insertions(+), 6 deletions(-)<br>
>>>>>>>>><br>
>>>>>>>>> _______________________________________________<br>
>>>>>>>>> ragel-users mailing list<br>
>>>>>>>>> <a href="mailto:ragel-users@colm.net" target="_blank">ragel-users@colm.net</a><br>
>>>>>>>>> <a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users" rel="noreferrer" target="_blank">http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users</a><br>
>>>>>>>> _______________________________________________<br>
>>>>>>>> ragel-users mailing list<br>
>>>>>>>> <a href="mailto:ragel-users@colm.net" target="_blank">ragel-users@colm.net</a><br>
>>>>>>>> <a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users" rel="noreferrer" target="_blank">http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users</a><br>
>>>>>>><br>
>>>>>>> _______________________________________________<br>
>>>>>>> ragel-users mailing list<br>
>>>>>>> <a href="mailto:ragel-users@colm.net" target="_blank">ragel-users@colm.net</a><br>
>>>>>>> <a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users" rel="noreferrer" target="_blank">http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users</a><br>
>>>>>> _______________________________________________<br>
>>>>>> ragel-users mailing list<br>
>>>>>> <a href="mailto:ragel-users@colm.net" target="_blank">ragel-users@colm.net</a><br>
>>>>>> <a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users" rel="noreferrer" target="_blank">http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users</a><br>
>>>>><br>
>>>>><br>
>>>>> _______________________________________________<br>
>>>>> ragel-users mailing list<br>
>>>>> <a href="mailto:ragel-users@colm.net" target="_blank">ragel-users@colm.net</a><br>
>>>>> <a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users" rel="noreferrer" target="_blank">http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users</a><br>
>>>> _______________________________________________<br>
>>>> ragel-users mailing list<br>
>>>> <a href="mailto:ragel-users@colm.net" target="_blank">ragel-users@colm.net</a><br>
>>>> <a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users" rel="noreferrer" target="_blank">http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users</a><br>
>>>><br>
>>> _______________________________________________<br>
>>> ragel-users mailing list<br>
>>> <a href="mailto:ragel-users@colm.net" target="_blank">ragel-users@colm.net</a><br>
>>> <a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users" rel="noreferrer" target="_blank">http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users</a><br>
>><br>
>> _______________________________________________<br>
>> ragel-users mailing list<br>
>> <a href="mailto:ragel-users@colm.net" target="_blank">ragel-users@colm.net</a><br>
>> <a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users" rel="noreferrer" target="_blank">http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users</a><br>
> _______________________________________________<br>
> ragel-users mailing list<br>
> <a href="mailto:ragel-users@colm.net" target="_blank">ragel-users@colm.net</a><br>
> <a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users" rel="noreferrer" target="_blank">http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users</a><br>
> <br>
_______________________________________________<br>
ragel-users mailing list<br>
<a href="mailto:ragel-users@colm.net" target="_blank">ragel-users@colm.net</a><br>
<a href="http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users" rel="noreferrer" target="_blank">http://www.colm.net/cgi-bin/mailman/listinfo/ragel-users</a></blockquote></div>