On Thu, Dec 01, 2011 at 03:31:38PM +0700, tknv wrote:
> I could not find that WERROR override code at my kernels...
> 
> Sorry delay it, I did make V=1.
> There are three kinds test.
> All targets are ARM.
> All Makefiles(top of kernel tree)-KBUILD_CFLAGS are same.
> KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
>                    -fno-strict-aliasing -fno-common \
>                    -Wno-format-security \
>                    -fno-delete-null-pointer-checks
> 
> I think linaro Werror behaviour is different or I need to add FLAGS more.
> 
> Compile CM-kernel with android SDK
> make -f scripts/Makefile.build obj=drivers/net/wireless/bcm4329
>      rm -f drivers/net/wireless/bcm4329/built-in.o;
>      /home/tknv/android/Oxygen/prebuil
>      t/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-ar rcs
>      drivers/net/wireless/bcm43  29/built-in.o
>          
> /home/tknv/android/Oxygen/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eab
>        i-gcc -Wp,-MD,drivers/net/wireless/bcm4329/.dhd_linux.o.d
>        -nostdinc -isystem /home
>        
> /tknv/android/Oxygen/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm
>        -eabi/4.4.3/include
>        -I/home/tknv/android/SuperSonic/kernels/CM-kernel/arch/arm/incl
>        ude -Iinclude  -include include/generated/autoconf.h
>        -D__KERNEL__ -mlittle-endian -  Iarch/arm/mach-msm/include
>        -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-st
>        rict-aliasing -fno-common -Wno-format-security
>        -fno-delete-null-pointer-checks -Os   -marm -mabi=aapcs-linux
>        -mno-thumb-interwork -funwind-tables -D__LINUX_ARM_ARCH__=7
>        -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024
>        -fno-stack-protector -f  omit-frame-pointer
>        -Wdeclaration-after-statement -Wno-pointer-sign
>        -fno-strict-over  flow -fno-dwarf2-cfi-asm -fconserve-stack
>        -DLINUX -DBCMDRIVER -DBCMDONGLEHOST -DDHD  THREAD -DBCMWPA2
>        -DUNRELEASEDCHIP -Dlinux -DDHD_SDALIGN=64 -DMAX_HDR_READ=64
>        -DDHD_  FIRSTREAD=64 -DDHD_GPL -DDHD_SCHED -DBDC -DTOE
>        -DDHD_BCMEVENTS -DSHOW_EVENTS -DBCMS  DIO -DDHD_GPL
>        -DBCMLXSDMMC -DBCMPLATFORM_BUS -Wall -Wstrict-prototypes
>        -Werror -DOO  B_INTR_ONLY -DCUSTOMER_HW2 -DDHD_USE_STATIC_BUF
>        -DMMC_SDIO_ABORT -DDHD_DEBUG_TRAP -  DSOFTAP
>        -DEMBEDDED_PLATFORM -DARP_OFFLOAD_SUPPORT -DPKT_FILTER_SUPPORT
>        -DGET_CUSTOM  _MAC_ENABLE -DSET_RANDOM_MAC_SOFTAP -DHW_OOB
>        -Idrivers/net/wireless/bcm4329 -Idrive
>        rs/net/wireless/bcm4329/include  -DMODULE -D"KBUILD_STR(s)=#s"
>        -D"KBUILD_BASENAME=K  BUILD_STR(dhd_linux)"
>        -D"KBUILD_MODNAME=KBUILD_STR(bcm4329)"  -c -o drivers/net/wi
>        reless/bcm4329/dhd_linux.o
>        drivers/net/wireless/bcm4329/dhd_linux.
>        ...
> [1]+  Done                    make V=1 > build.log 2>&1
> 
> Compile CM-kernel with linaro.
> make -f scripts/Makefile.build obj=drivers/net/wireless/bcm4329
>    rm -f drivers/net/wireless/bcm4329/built-in.o;
>    /usr/bin/arm-linux-gnueabi-ar rcs
>    drivers/net/wireless/bcm4329/built-in.o
>      /usr/bin/arm-linux-gnueabi-gcc
>      -Wp,-MD,drivers/net/wireless/bcm4329/.dhd_linux.o.d  -nostdinc
>      -isystem /usr/lib/gcc/arm-linux-gnueabi/4.6.1/include
>      -I/home/tknv/android/SuperSonic/kernels/CM-kernel/arch/arm/include
>      -Iinclude  -include include/generated/autoconf.h -D__KERNEL__
>      -mlittle-endian -Iarch/arm/mach-msm/include -Wall -Wundef
>      -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
>      -Wno-format-security -fno-delete-null-pointer-checks -Os -marm
>      -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables
>      -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm
>      -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer
>      -Wdeclaration-after-statement -Wno-pointer-sign
>      -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -DLINUX
>      -DBCMDRIVER -DBCMDONGLEHOST -DDHDTHREAD -DBCMWPA2 -DUNRELEASEDCHIP
>      -Dlinux -DDHD_SDALIGN=64 -DMAX_HDR_READ=64 -DDHD_FIRSTREAD=64
>      -DDHD_GPL -DDHD_SCHED -DBDC -DTOE -DDHD_BCMEVENTS -DSHOW_EVENTS
>      -DBCMSDIO -DDHD_GPL -DBCMLXSDMMC -DBCMPLATFORM_BUS -Wall
>      -Wstrict-prototypes -Werror -DOOB_INTR_ONLY -DCUSTOMER_HW2
>      -DDHD_USE_STATIC_BUF -DMMC_SDIO_ABORT -DDHD_DEBUG_TRAP -DSOFTAP
>      -DEMBEDDED_PLATFORM -DARP_OFFLOAD_SUPPORT -DPKT_FILTER_SUPPORT
>      -DGET_CUSTOM_MAC_ENABLE -DSET_RANDOM_MAC_SOFTAP -DHW_OOB
>      -Idrivers/net/wireless/bcm4329
>      -Idrivers/net/wireless/bcm4329/include  -DMODULE
>      -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(dhd_linux)"
>      -D"KBUILD_MODNAME=KBUILD_STR(bcm4329)"  -c -o
>      drivers/net/wireless/bcm4329/dhd_linux.o
>      drivers/net/wireless/bcm4329/dhd_linux.c
>      drivers/net/wireless/bcm4329/dhd_linux.c: In function ‘
>      dhd_rx_frame’:
>      drivers/net/wireless/bcm4329/dhd_linux.c:1282:24: error: variable
>      ‘save_pktbuf’ set but not used [-Werror=unused-but-set-variable]
>      drivers/net/wireless/bcm4329/dhd_linux.c: In function ‘
>      dhd_os_wd_timer’:
>      drivers/net/wireless/bcm4329/dhd_linux.c:2737:14: error: variable
>      ‘save_dhd_watchdog_ms’ set but not used
>      [-Werror=unused-but-set-variable]
>      cc1: all warnings being treated as errors
> 
>      make[4]: *** [drivers/net/wireless/bcm4329/dhd_linux.o] Error 1
>      make[3]: *** [drivers/net/wireless/bcm4329] Error 2
>      make[2]: *** [drivers/net/wireless] Error 2
>      make[1]: *** [drivers/net] Error 2
>      make: *** [drivers] Error 2
>      ^C[1]+  Exit 2                  make V=1 > build.log 2>&1
> 
> Compile tiamatat-kernel with linaro.
> make -f scripts/Makefile.build obj=drivers/net/wireless/bcm4329
>   /usr/bin/arm-linux-gnueabi-gcc
>   -Wp,-MD,drivers/net/wireless/bcm4329/.dhd_linux.o.d  -nostdinc
>   -isystem /usr/lib/gcc/arm-linux-gnueabi/4.6.1/include
>   -I/home/tknv/android/SuperSonic/kernels/tiamat-kernel/arch/arm/include
>   -Iinclude  -include include/generated/autoconf.h -D__KERNEL__
>   -mlittle-endian -Iarch/arm/mach-msm/include -Wall -Wundef
>   -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
>   -Wno-format-security -fno-delete-null-pointer-checks -Os -marm
>   -fno-dwarf2-cfi-asm -fno-omit-frame-pointer -mapcs -mno-sched-prolog
>   -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=7
>   -march=armv7-a -mhard-float -Uarm -Wframe-larger-than=1024
>   -fno-stack-protector -fno-omit-frame-pointer
>   -fno-optimize-sibling-calls -Wdeclaration-after-statement
>   -Wno-pointer-sign -fno-strict-overflow -fconserve-stack
>   -DCC_HAVE_ASM_GOTO -DLINUX -DBCMDRIVER -DBCMDONGLEHOST -DDHDTHREAD
>   -DBCMWPA2 -DUNRELEASEDCHIP -Dlinux -DDHD_SDALIGN=64 -DMAX_HDR_READ=64
>   -DDHD_FIRSTREAD=64 -DDHD_GPL -DDHD_SCHED -DBDC -DTOE -DDHD_BCMEVENTS
>   -DSHOW_EVENTS -DBCMSDIO -DDHD_GPL -DBCMLXSDMMC -DBCMPLATFORM_BUS -Wall
>   -Wstrict-prototypes -Werror -DOOB_INTR_ONLY -DCUSTOMER_HW2
>   -DDHD_USE_STATIC_BUF -DMMC_SDIO_ABORT -DDHD_DEBUG_TRAP -DSOFTAP
>   -DEMBEDDED_PLATFORM -DARP_OFFLOAD_SUPPORT -DPKT_FILTER_SUPPORT
>   -DGET_CUSTOM_MAC_ENABLE -DSET_RANDOM_MAC_SOFTAP -DCSCAN -DHW_OOB
>   -DKEEP_ALIVE -DPNO_SUPPORT -Idrivers/net/wireless/bcm4329
>   -Idrivers/net/wireless/bcm4329/include  -DMODULE -DMODULE
>   -march=armv7-a -mfpu=vfpv3 -ftree-vectorize -D"KBUILD_STR(s)=#s"
>   -D"KBUILD_BASENAME=KBUILD_STR(dhd_linux)"
>   -D"KBUILD_MODNAME=KBUILD_STR(bcm4329)" -c -o
>   drivers/net/wireless/bcm4329/dhd_linux.o
>   drivers/net/wireless/bcm4329/dhd_linux.c
>   drivers/net/wireless/bcm4329/dhd_linux.c: In function ‘dhd_rx_frame’
>   :
>   drivers/net/wireless/bcm4329/dhd_linux.c:1256:24: error: variable ‘
>   save_pktbuf’ set but not used [-Werror=unused-but-set-variable]
>   cc1: all warnings being treated as errors
> 
>   make[4]: *** [drivers/net/wireless/bcm4329/dhd_linux.o] Error 1
>   make[3]: *** [drivers/net/wireless/bcm4329] Error 2
>   make[2]: *** [drivers/net/wireless] Error 2
>   make[1]: *** [drivers/net] Error 2
>   make: *** [drivers] Error 2
>   ^C[1]+  Exit 2                  make V=1 > build.log 2>&1

OK, so the reason why you can't turn -Werror off is because
drivers/net/wireless/bcm4329/Makefile adds it again:

DHDCFLAGS = -DLINUX -DBCMDRIVER -DBCMDONGLEHOST -DDHDTHREAD -DBCMWPA2 \
-DUNRELEASEDCHIP -Dlinux -DDHD_SDALIGN=64 -DMAX_HDR_READ=64 \
-DDHD_FIRSTREAD=64 -DDHD_GPL -DDHD_SCHED -DBDC -DTOE -DDHD_BCMEVENTS \
-DSHOW_EVENTS -DBCMSDIO -DDHD_GPL -DBCMLXSDMMC -DBCMPLATFORM_BUS \
-Wall -Wstrict-prototypes -Werror -DOOB_INTR_ONLY -DCUSTOMER_HW2 \
-DDHD_USE_STATIC_BUF -DMMC_SDIO_ABORT -DDHD_DEBUG_TRAP -DSOFTAP \
-DEMBEDDED_PLATFORM -DARP_OFFLOAD_SUPPORT -DPKT_FILTER_SUPPORT \
-DGET_CUSTOM_MAC_ENABLE -DSET_RANDOM_MAC_SOFTAP -DCSCAN -DHW_OOB \
-DKEEP_ALIVE -DPNO_SUPPORT \
-Idrivers/net/wireless/bcm4329 -Idrivers/net/wireless/bcm4329/include

EXTRA_CFLAGS = $(DHDCFLAGS)

Kbuild doesn't allow you to override such things from the top level.

Adding -Werror overrides any preceding -Wno-error flag.


-Werror really should only be added in subdirectory Makefiles if
the code in that directory is super-clean.  The exact behaviour of GCC
with -Werror *will* change between different compiler versions -- this
is not a bug.  It explicitly allows GCC to fail to compile code which
might be correct.

There seems to be no good way to override -Werror in a subdirectory
Makefile from higher-level Makefiles.  You may be able to remove the
error behaviour for individual warnings with -Wno-error=<warning>, but
it's not really a good idea to do this at the top level because it will
affect the whole kernel.


So far as I can see, the warnings/errors you get probably indicate real
issues in the code.  It doesn't look like a compiler bug, or a problem
with Kbuild -- it's just an effect of the way the writers of that
subdirectory wrote their Makefile.


If you have not already done so, you should check for newer versions of
the code which may fix the problems.  If there is no newer version, it
would be a good idea to fix the source code issues and propose those
changes for merging so that the problem gets solved for everyone.

You can also simply remove -Werror from DHDCFLAGS in your local
build tree.  This will allow you to build the kernel, but it won't
prevent other people from encountering the same problem.


Since this appears to be an issue with an Android kernel tree, I suggest
if you have more questions on this you should reply via
linaro-dev@lists.linaro.org, or ask questions on the #linaro or
#linaro-android channels on IRC at chat.freenode.net if you need
additional help.

Cheers
---Dave

_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to