Android kernel compile error gcc6 linaro 6

2019-07-23 19:09发布

问题:

I'm trying to compile using Linaro 6 and I'm receiving this error which I believe have something do do with GCC 6? I'm very amateur with compiling kernels or coding for that matter, but I couldn't figure this out even search similar terms:

  CC      drivers/iommu/msm_iommu-v1.o
In file included from include/linux/io.h:22:0,
                 from drivers/iommu/msm_iommu-v1.c:20:
drivers/iommu/msm_iommu-v1.c: In function '__program_context':
drivers/iommu/msm_iommu_hw-v1.h:78:31: warning: result of '16777215 << 14' requires 39 bits to represent, but 'int' only has 32 bits [-Wshift-overflow=]
error, forbidden warning: msm_iommu_hw-v1.h:78
scripts/Makefile.build:308: recipe for target 'drivers/iommu/msm_iommu-v1.o' failed

this is my GitHUB:

https://github.com/mykesorrel/surnia_kernel

回答1:

Looks like a bug with that iommu driver. It's trying to do a bit-shift into an int instead of a long, an int doesn't have enough bits to complete the operation. I'm guessing the -Wno-error isn't used, so all warnings are treated as errors.

This question will help you: How to compile without warnings being treated as errors?

What I personally do is update CFLAGS in my .bashrc (Assuming you're using Linux). This is what I use:

# Ensure C builds don't fail on warnings
export CFLAGS="-Wno-error"
export CXXFLAGS="-Wno-error"