[Ovmsdev] yacc/lex on component/dbc

Craig Leres leres at xse.com
Sun Nov 25 05:33:47 HKT 2018


On 11/22/18 8:38 PM, Mark Webb-Johnson wrote:
> 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.

I'm unable to compile this under FreeBSD.

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:

     https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233481

After solving that my build fails with:

     CC 
/home/ice/u0/leres/src/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/build/dbc/yacclex/dbc_tokeniser.o
 
/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
     compilation terminated.
     gmake[1]: *** 
[/home/ice/u0/leres/esp/openvehicles-xtensa-esp32-elf/make/component_wrapper.mk:286: 
yacclex/dbc_tokeniser.o] Error 1

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:

     CC 
/home/ice/u0/leres/src/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/build/dbc/yacclex/dbc_tokeniser.o
     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:
 
/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
     compilation terminated.
     gmake[1]: *** 
[/home/ice/u0/leres/esp/openvehicles-xtensa-esp32-elf/make/component_wrapper.mk:286: 
yacclex/dbc_tokeniser.o] Error 1
     gmake: *** [/home/ice/u0/leres/esp/esp-idf/make/project.mk:468: 
component-dbc-build] Error 2

That looks c++ code in dbc_parser.y that's being compiled with the C 
compiler?

     #include <string>

If I change it to string.h then I have problems with dbc.h:

     #include <string>
     #include <map>
     #include <list>

And in this case it looks like dbc.h is included by both c++ and C sources.

		Craig



More information about the OvmsDev mailing list