Swi-fx30-3g_1.0.1 fails to build with make wp85

Hi, I am trying to build legato that comes with the above package i.e. SDK for FX30-3G (Release R17.0.1.007 + Legato 18.06.5)

I downloaded it with leaf, I am in a leaf shell, and make clean does not make a difference

I get the truncation error e.g.

mkPatch.c:1412:55: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size between 4045 and 4063 [-Werror=format-truncation=]
 1412 |                   "cat patch.%u.cwe.hdr patch.%u.cwe >%s/patch-%s.cwe",
      |                                                       ^~
 1413 |                   pid, pid, CurrentWorkDir, targetPtr );
      |                             ~~~~~~~~~~~~~

gcc -version → gcc (Ubuntu 9.5.0-1ubuntu1~22.04) 9.5.0
make --version → GNU Make 4.3

Have I got something wrong. Why does it not build…

I am able to build swi-fx30-catm.xxx and swi-fx30-cat1.xxx fine in this environment.


you might need to change mkPatch.c to increase the array size of CmdBuf.

Thanks for the quick reply as always…

This makes we think this is possibly a gcc version issue. Are there recommended version of gcc etc to build the various version of legato with?

Is this documented somehwhere?

this is just warning problem, have you modified mkPatch.c to confirm?

I see the later verison of legato 19.x has an edit in the makefile for mkPatch… in particular it manages the warnings as below…

HOST_CFLAGS = -Wall -Werror
ifeq ($(shell test $(GCC_VERSION) -ge 80000 && echo 1), 1)
  HOST_CFLAGS += -Wno-format-truncation

Based on this it seems an issue in legato that was adapted in later versions… for gcc >= 8.xx. I’ve adapted the makefile for the 3g’s legato 18.xxx to include this adjustment for the warnings…

I can now build mkPatch without any other changes…


Ok… but there are more issues… I am not inclinded to change the source file if at all possible… The problem is because of different versions of gcc/g++… so the easiest solution here is to just compile in the original version of gcc/g++ which is 7.

So install gcc7 and g++7 add to update-alternatives… then select v7 as the current version

sudo apt -y install gcc-7 g+±7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g+±7 7

then update the current version to use v7…
sudo update-alternatives --config gcc
sudo update-alternatives --config g++

now rebuild using make wp85… Everything builds… no need to change source files…