Microsemi / switchtec-kernel

A kernel module for the Microsemi PCIe switch
GNU General Public License v2.0
45 stars 31 forks source link

Cannot build on Ubuntu 18.04-latest #78

Closed cristgal closed 4 years ago

cristgal commented 4 years ago

Hi, I'm running the latest Ubuntu 18.04-LTS and the build won't complete, any idea if it should work? thanks.

# uname -a
Linux u1804 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

# gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

# make
  VER   1.3
make -C /lib/modules/4.15.0-66-generic/build M=$PWD modules
make[1]: Entering directory '/usr/src/linux-headers-4.15.0-66-generic'
  CC [M]  /root/github/switchtec-kernel/switchtec.o
/root/github/switchtec-kernel/switchtec.c:578:8: error: unknown type name ‘__poll_t’
 static __poll_t switchtec_dev_poll(struct file *filp, poll_table *wait)
        ^~~~~~~~
/root/github/switchtec-kernel/switchtec.c: In function ‘switchtec_dev_poll’:
/root/github/switchtec-kernel/switchtec.c:582:2: error: unknown type name ‘__poll_t’; did you mean ‘__cold’?
  __poll_t ret = 0;
  ^~~~~~~~
  __cold
/root/github/switchtec-kernel/switchtec.c:588:10: error: ‘EPOLLIN’ undeclared (first use in this function); did you mean ‘POLLIN’?
   return EPOLLIN | EPOLLRDHUP | EPOLLOUT | EPOLLERR | EPOLLHUP;
          ^~~~~~~
          POLLIN
/root/github/switchtec-kernel/switchtec.c:588:10: note: each undeclared identifier is reported only once for each function it appears in
/root/github/switchtec-kernel/switchtec.c:588:20: error: ‘EPOLLRDHUP’ undeclared (first use in this function); did you mean ‘POLLRDHUP’?
   return EPOLLIN | EPOLLRDHUP | EPOLLOUT | EPOLLERR | EPOLLHUP;
                    ^~~~~~~~~~
                    POLLRDHUP
/root/github/switchtec-kernel/switchtec.c:588:33: error: ‘EPOLLOUT’ undeclared (first use in this function); did you mean ‘POLLOUT’?
   return EPOLLIN | EPOLLRDHUP | EPOLLOUT | EPOLLERR | EPOLLHUP;
                                 ^~~~~~~~
                                 POLLOUT
/root/github/switchtec-kernel/switchtec.c:588:44: error: ‘EPOLLERR’ undeclared (first use in this function); did you mean ‘POLLERR’?
   return EPOLLIN | EPOLLRDHUP | EPOLLOUT | EPOLLERR | EPOLLHUP;
                                            ^~~~~~~~
                                            POLLERR
/root/github/switchtec-kernel/switchtec.c:588:55: error: ‘EPOLLHUP’ undeclared (first use in this function); did you mean ‘POLLHUP’?
   return EPOLLIN | EPOLLRDHUP | EPOLLOUT | EPOLLERR | EPOLLHUP;
                                                       ^~~~~~~~
                                                       POLLHUP
/root/github/switchtec-kernel/switchtec.c:593:20: error: ‘EPOLLRDNORM’ undeclared (first use in this function); did you mean ‘POLLRDNORM’?
   ret |= EPOLLIN | EPOLLRDNORM;
                    ^~~~~~~~~~~
                    POLLRDNORM
/root/github/switchtec-kernel/switchtec.c:596:10: error: ‘EPOLLPRI’ undeclared (first use in this function); did you mean ‘POLLPRI’?
   ret |= EPOLLPRI | EPOLLRDBAND;
          ^~~~~~~~
          POLLPRI
/root/github/switchtec-kernel/switchtec.c:596:21: error: ‘EPOLLRDBAND’ undeclared (first use in this function); did you mean ‘POLLRDBAND’?
   ret |= EPOLLPRI | EPOLLRDBAND;
                     ^~~~~~~~~~~
                     POLLRDBAND
/root/github/switchtec-kernel/switchtec.c: At top level:
/root/github/switchtec-kernel/switchtec.c:1172:10: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
  .poll = switchtec_dev_poll,
          ^~~~~~~~~~~~~~~~~~
/root/github/switchtec-kernel/switchtec.c:1172:10: note: (near initialization for ‘switchtec_fops.poll’)
cc1: all warnings being treated as errors
scripts/Makefile.build:337: recipe for target '/root/github/switchtec-kernel/switchtec.o' failed
make[2]: *** [/root/github/switchtec-kernel/switchtec.o] Error 1
Makefile:1577: recipe for target '_module_/root/github/switchtec-kernel' failed
make[1]: *** [_module_/root/github/switchtec-kernel] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-66-generic'
Makefile:26: recipe for target 'modules' failed
make: *** [modules] Error 2
lsgunth commented 4 years ago

You probably need to use the "backport_4.15" branch from this repo.

Though, with a 4.15 kernel, I'd instead recommend using the upstream version of this module and just rebuild your kernel with it selected (if it isn't already).