iPXE discussion forum

Full Version: build error in nrv2b.c on Ubuntu 11.10 32bits
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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?
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
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
Reference URL's