i.MX8MP package/boot/atf-imx failed to build

Im trying to build imx-openwrt-23.05 for i.MX8MP som, im pulling from https://github.com/NXP/imx_openwrt.git.

In the final stages of the build process the boot package atf-imx fails, I've been able to locate some online discussion about this particular error being caused by gcc 12 according to the gcc.gnu.org website (linked below).

The error message are actually warnings that are elevated to the status of errors because of '-Werror', my attempts have been as follows

  1. I've removed instances of that flag in numerous makefiles that I suspected as being tied to this build, none of those changes worked, I suspect that I have not pinpointed the correct file where the -Werror flag for this particular package is being defined.

  2. In the menu that opens up after 'make menuconfig' I've set the compiler to gcc11 and gcc13, neither seems to have fixed the issue. This thread here reports the same Issue and the blame is gcc 12, from the linux kernel archives [(https://lore.kernel.org/buildroot/20230921215633.34828-2-brandon.maier@collins.com], also this one from the gcc gnu website but not for the exact same package ([Preformatted text](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523))

Here is the first part of my error message.

CC plat/imx/imx8m/hab.c 5988 cc1: note: someone does not honour COPTS correctly, passed 0 times 5989 plat/imx/imx8m/hab.c: In function 'imx_hab_handler': 5990 plat/imx/imx8m/hab.c:64:57: error: array subscript 0 is outside array bounds of 'uint32_t[0]' {aka 'unsigned int[]'} [-Werror=array-bounds] 5991 64 | #define HAB_RVT_CHECK_TARGET_ARM64 ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x18)) 5992 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And you goal is to get the compilation done? You could exchange the called gcc binary by a script which filters away the -Werror and then exec's the original binary.

That is not an official OpenWrt repository, you should ask for help to the team that maintains it.

Thanks for your response, could you please provide a little bit more information on how I could go about that?

Find the invoked compiler /path/to/gcc. (Should be visible in verbose build output). Then rename it to /path/to/gcc.old. Create a script /path/to/gcc:



while [ "${1}" != "" ] 
    if [ "${ARG}" = "-Werror" ] 
    ARGLIST+=( "${ARG}" )

exec ${0}.old "${ARGLIST[@]}"

and make it executable

chmod a+x /path/to/gcc

Thanks for this! I used it to replace aarch64-openwrt-linux-musl-gcc and it got me past that particular issue. I dont have anymore questions, appreciate the help!