android-kernellineageos

bionic/libc/include/sys/epoll.h:67:8: error: redefinition of 'epoll_event'


I am getting the following exception while building the ROM for a lineageos project and need some help diagnosing and resolving the issue:

In file included from device/lenovo/tb8504f/camera/QCamera2/util/QCameraDisplay.cpp:53:
In file included from system/core/libutils/include/utils/Looper.h:25:
bionic/libc/include/sys/epoll.h:67:8: error: redefinition of 'epoll_event'
struct epoll_event {
       ^
out/target/product/tb8504f/obj/KERNEL_OBJ/usr/include/linux/eventpoll.h:59:8: note: previous definition is here
struct epoll_event {
       ^

1 error generated.

Device tree:= https://github.com/darran-kelinske-fivestars/android_device_lenovo_tb8504f/tree/lineage-15.1

Vendor tree:= https://github.com/darran-kelinske-fivestars/android_vendor_lenovo_tb8504f/tree/lineage-15.1

Kernel source:= https://github.com/dazza5000/android_kernel_lenovo_msm8937/tree/tb8504f

ROM Source:= https://github.com/LineageOS/android

Command:

repo sync -j20 && source build/envsetup.sh && breakfast tb8504f && make -j20 | tee rom.log

Full log:

https://del.dog/qaridufuca


Solution

  • I fixed this by borrowing code from a different kernel version that includes the following check

    #ifdef __KERNEL__
    

    Full snippet below:

    #ifdef __KERNEL__
    struct epoll_event {
    struct epoll_event {
        __u32 events;
        __u32 events;
        __u64 data;
        __u64 data;
    @@ -73,4 +74,5 @@ static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
        epev->events &= ~EPOLLWAKEUP;
        epev->events &= ~EPOLLWAKEUP;
    }
    }
    #endif
    #endif
    #endif /* __KERNEL__ */
    

    Commit:

    https://github.com/dazza5000/android_kernel_lenovo_msm8937/commit/ab8195cd2bc6f1c283d79568540d5792c9ed55c2