Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross compiling kernel, using Makefile. How to suppress -Wunused-but-set-variable warning

I'm trying to Cross compile a kernel for Android using Ubuntu.

After successfully setting up the menuconfig, and compiling with the following option:

make ARCH=arm CROSS_COMPILE="arm-bravo-" -i -j10

It starts building, but then terminates with a lot of these errors:

error: variable '*something*' set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors

Now I understand that this can be fixed by running gcc with --disable-werror option. Probem is that this is a huge project (kernel) and I am not well versed enough with make and Makefile, to know where I have to set this value. Kindly help me understand and fix this problem.

like image 356
Joel G Mathew Avatar asked Oct 31 '11 07:10

Joel G Mathew


Video Answer


1 Answers

After weeks, I'm now in a position to answer my own question..

Look for KBUILD_CFLAGS in the main Makefile, and add the following to suppress warnings as errors:

KBUILD_CFLAGS += -w
// if all errors are to be suppressed

KBUILD_CFLAGS += -Wno-error=unused-but-set-variable
// if that specific error is to be suppressed.
like image 150
Joel G Mathew Avatar answered Oct 22 '22 02:10

Joel G Mathew