<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Craig,<div class=""><br class=""></div><div class="">The component.mk controls the compilation. It does:</div><div class=""><br class=""></div><div class=""><ul class="MailOutline"><li class="">yacc -o $(COMPONENT_PATH)/yacclex/dbc_parser.cpp -d $(COMPONENT_PATH)/src/dbc_parser.y<br class=""><br class="">Expectation here is that the ‘-o’ produces dbc_parser.cpp and dbs_parser.hpp<br class=""><br class=""></li><li class="">lex -o $(COMPONENT_PATH)/yacclex/dbc_tokeniser.c $(COMPONENT_PATH)/src/dbc_tokeniser.l<br class=""><br class="">This #include the dbc_parser.hpp and produced dbc_tokeniser.c<br class=""><br class=""></li><li class="">Then dbc_tokeniser.c and dbc_parser.cpp are compiled as normal</li></ul></div><div class=""><br class=""></div><div class="">We use ‘yacclex’ as a temporary path, to keep these auto-generated code files separate.</div><div class=""><br class=""></div><div class=""><div class="">The behaviour of bison is that ‘-o’ outputs both .hpp and .cpp files (from the ‘-o’ directive). If think byacc may behave differently. We need both the header and code files, and they need to be named .hpp and .cpp as they need to produce c++ code. The dbc_tokeniser is in C, as Lex only really supports C and we can “extern C” the stuff we need when we access it (there is not much).</div><div class=""><br class=""></div><div class="">Can you try running those commands manually, and see what comes out? Or try bison?</div><div class=""><br class=""></div><div class="">Regards, Mark</div><div><br class=""><blockquote type="cite" class=""><div class="">On 25 Nov 2018, at 5:33 AM, Craig Leres <<a href="mailto:leres@xse.com" class="">leres@xse.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On 11/22/18 8:38 PM, Mark Webb-Johnson wrote:<br class=""><blockquote type="cite" class="">Could you guys check, and let me know if you see any issues? In particular, on windows. If no issues, I’ll proceed and finish up the grammar and implementation.<br class=""></blockquote><br class="">I'm unable to compile this under FreeBSD.<br class=""><br class="">I think the first problem is really a FreeBSD bug. When !defined(__FreeBSD__) the generated code unconditionally defines __dead2 in flex.skl just before including stdio.h which includes sys/cdefs.h. But the toolchain version of sys/cdefs.h also defines __dead2. Here's the problem report I filed:<br class=""><br class="">    <a href="https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233481" class="">https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233481</a><br class=""><br class="">After solving that my build fails with:<br class=""><br class="">    CC /home/ice/u0/leres/src/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/build/dbc/yacclex/dbc_tokeniser.o<br class="">/home/ice/u0/leres/src/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/dbc/src/dbc_tokeniser.l:38:26: fatal error: dbc_parser.hpp: No such file or directory<br class="">    compilation terminated.<br class="">    gmake[1]: *** [/home/ice/u0/leres/esp/openvehicles-xtensa-esp32-elf/make/component_wrapper.mk:286: yacclex/dbc_tokeniser.o] Error 1<br class=""><br class="">I suspect the makefile is assuming flex/lex will generate dbc_parser.hpp; mine generates dbc_parser.cpp. If i put in a symlink for dbc_parser.hppI can get incrementally further:<br class=""><br class="">    CC /home/ice/u0/leres/src/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/build/dbc/yacclex/dbc_tokeniser.o<br class="">    In file included from /home/ice/u0/leres/src/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/dbc/src/dbc_tokeniser.l:38:0:<br class="">/home/ice/u0/leres/src/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/dbc/src/dbc_parser.y:43:18: fatal error: string: No such file or directory<br class="">    compilation terminated.<br class="">    gmake[1]: *** [/home/ice/u0/leres/esp/openvehicles-xtensa-esp32-elf/make/component_wrapper.mk:286: yacclex/dbc_tokeniser.o] Error 1<br class="">    gmake: *** [/home/ice/u0/leres/esp/esp-idf/make/project.mk:468: component-dbc-build] Error 2<br class=""><br class="">That looks c++ code in dbc_parser.y that's being compiled with the C compiler?<br class=""><br class="">    #include <string><br class=""><br class="">If I change it to string.h then I have problems with dbc.h:<br class=""><br class="">    #include <string><br class="">    #include <map><br class="">    #include <list><br class=""><br class="">And in this case it looks like dbc.h is included by both c++ and C sources.<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">      </span><span class="Apple-tab-span" style="white-space:pre">    </span>Craig<br class=""></div></div></blockquote></div><br class=""></div></body></html>