Cannot setup Leaf Application Framework (WP76xx)

Hi,

I am trying to setup the Leaf application framework by following the instructions on the leaf setup page. Only the swi-wp76_1.0.0 successfully works. All other packages versions after this (3.0.0, 4.0.0 and so on) fail to setup properly and give the following error:

SHIPPED scripts/dtc/dtc-lexer.lex.c
SHIPPED scripts/dtc/dtc-parser.tab.h
HOSTCC scripts/dtc/dtc-lexer.lex.o
SHIPPED scripts/dtc/dtc-parser.tab.c
HOSTCC scripts/dtc/dtc-parser.tab.o
HOSTLD scripts/dtc/dtc
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x50): multiple definition of `yylloc’; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.host scripts/dtc/dtc] Error 1
make[1]: *** [scripts/Makefile.build:402: scripts/dtc] Error 2
make: *** [Makefile:559: scripts] Error 2
“Failed to install driver build environment.”
Command ‘/home/mughees@entreng.com/.leaf/wp76-toolchain_SWI9X07Y_02.37.07.00-linux64/toolChainExtractor.sh -y -d /home/mughees@entreng.com/.leaf/wp76-toolchain_SWI9X07Y_02.37.07.00-linux64/’ exited with 1
Error during installation: Error during install step for wp76-toolchain_SWI9X07Y_02.37.07.00-linux64 (command returned 1)

My OS is Ubuntu 22.04.1 LTS. Kernel version is 5.15.0-53-generic. Does anyone has an idea, what maybe wrong here. Thanks.

Regards,
Mughees

does this help?

Hi jyijyi,

Thanks for your response. I do believe that it will work with older versions of host OS, maybe because it might be using an older version of gcc or a setting that does not give this build error. The problem is in toolchain, that the file ‘usr/scripts/dtc/dtc-lexer.l’ has a multiple definition problem with the variable yylloc. This should be fixed by the legato community. I am not sure who is the right person to address this issue to. This seriously hurts the out of the box experience.

Regards,
Mughees

see if this patch on dtc-lexer helps:

https://lkml.org/lkml/2020/4/1/1206

Yeah, this patch should work, but it is very difficult to apply this patch on the sources downloaded by the legato’s automated application framework which does all the builds and tools setup using a big script. The other way was to downgrade the gcc version to 9 something, as in that gcc version, such error was ignored and the build is successful. I downgraded the gcc version and now it works. :slight_smile: