iPXE discussion forum
build error in nrv2b.c on Ubuntu 11.10 32bits - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: build error in nrv2b.c on Ubuntu 11.10 32bits (/showthread.php?tid=3152)



build error on Ubuntu 11.10 32bits - MrLeV - 2012-04-19 01:35

Hello -


git cloned today ( git clone git://git.ipxe.org/ipxe.git )

and immediately ran make

The first "make" command failed with this error:

ar: creating bin/blib.a
[HOSTCC] util/zbin
In file included from util/zbin.c:6:0:
util/nrv2b.c: In function ‘find_match’:
util/nrv2b.c:633:17: error: array subscript is above array bounds [-Werror=array-bounds]
util/nrv2b.c:634:14: error: array subscript is above array bounds [-Werror=array-bounds]
cc1: all warnings being treated as errors

make: *** [util/zbin] Error 1


I am using a Ubuntu 11.10 (upgraded from 10.10, upgraded from 10.04) x86 environment in a VMWare guest (but I don't think this is important).
All updates applied. I undertsand what the error mean and that I could even get rid of it by making the build environment considering it a non-stopping warning, but this is not clean and is certainly not expected.

Thanks in advance for your help


build error in nrv2b.c on Ubuntu 11.10 32bits - MrLeV - 2012-04-20 18:59

Hello


Fresh git clone of ipxe code, tried to build on Ubuntu 11.10 (all updates applied), I get this error:

[AR] bin/blib.a
ar: creating bin/blib.a
[HOSTCC] util/zbin
In file included from util/zbin.c:6:0:
util/nrv2b.c: In function ‘find_match’:
util/nrv2b.c:633:17: error: array subscript is above array bounds [-Werror=array-bounds]
util/nrv2b.c:634:14: error: array subscript is above array bounds [-Werror=array-bounds]
cc1: all warnings being treated as errors

make: *** [util/zbin] Error 1
user@Ubuntu-VM1:~/iPXE/ipxe/src$


Any idea how to solve it?


RE: build error in nrv2b.c on Ubuntu 11.10 32bits - robinsmidsrod - 2012-04-21 07:52

That one has been puzzling the development team for a short while.

You can work around it by adding a NO_WERROR=1 to your make command line, as mentioned on the mailing list


RE: build error in nrv2b.c on Ubuntu 11.10 32bits - qq75513036 - 2012-07-02 17:45

The same error to me.
util/nrv2b.c like this
Code:
...
#define SWD_BEST_OFF    1
...

struct ucl_swd
{
...
#if defined(SWD_BEST_OFF)
        unsigned int best_pos[ SWD_BEST_OFF ];
#endif
...
}

...
#if defined(SWD_BEST_OFF)
        if (s->best_pos[2] == 0)  /*line 633*/
                s->best_pos[2] = key + 1;  /*line 634*/
#endif
...

I insert one line before line 633, like this
Code:
#if defined(SWD_BEST_OFF)
    if(sizeof(s->best_pos)/sizeof(s->best_pos[0])>2)
        if (s->best_pos[2] == 0)  /*line 633*/
                s->best_pos[2] = key + 1;  /*line 634*/
#endif