martinezjavier / ldd3

Linux Device Drivers 3 examples updated to work in recent kernels
http://examples.oreilly.com/9780596005900/
Other
2.35k stars 905 forks source link

Error compiling misc-progs in ARM aarch64. #61

Open oliver-almaraz opened 3 years ago

oliver-almaraz commented 3 years ago

I tried running these examples in two different ARM aarch64 kernels, but I got the same error after running the main Makefile. I built only the misc-modules dir with the Makefile in it and it worked. Apparently, the problem lies inside misc-progs. First kernel I tried with (Raspberri Pi 4B):

5.4.83-1-MANJARO-ARM #1 SMP PREEMPT Mon Dec 14 08:37:33 CST 2020 aarch64 GNU/Linux

Second one (Jetson Nano):

4.9.201-tegra #1 SMP PREEMPT Fri Jan 15 14:41:02 PST 2021 aarch64 GNU/Linux

After cloning and running the main Makefile I got:

[oliver@ManjaroARM ldd3]$ make
for n in misc-progs misc-modules skull scull scullc scullp lddbus sculld scullv shortprint simple tty pci usb sbull snull short; do make -C $n || exit 1; done
make[1]: Entering directory '/home/oliver/Documentos/GitClone/ldd3/misc-progs'
cc -O2 -fomit-frame-pointer -Wall -I/lib/modules/5.4.83-1-MANJARO-ARM/build/include    asynctest.c   -o asynctest
In file included from /usr/include/asm/sigcontext.h:22,
                 from /usr/include/bits/sigcontext.h:30,
                 from /usr/include/signal.h:288,
                 from asynctest.c:20:
/lib/modules/5.4.83-1-MANJARO-ARM/build/include/linux/types.h:15:26: error: conflicting types for ‘fd_set’
   15 | typedef __kernel_fd_set  fd_set;
      |                          ^~~~~~
In file included from /usr/include/sys/types.h:179,
                 from /usr/include/stdlib.h:394,
                 from asynctest.c:17:
/usr/include/sys/select.h:70:5: note: previous declaration of ‘fd_set’ was here
   70 |   } fd_set;
      |     ^~~~~~
In file included from /usr/include/asm/sigcontext.h:22,
                 from /usr/include/bits/sigcontext.h:30,
                 from /usr/include/signal.h:288,
                 from asynctest.c:20:
/lib/modules/5.4.83-1-MANJARO-ARM/build/include/linux/types.h:16:25: error: conflicting types for ‘dev_t’
   16 | typedef __kernel_dev_t  dev_t;
      |                         ^~~~~
In file included from /usr/include/stdlib.h:394,
                 from asynctest.c:17:
/usr/include/sys/types.h:59:17: note: previous declaration of ‘dev_t’ was here
   59 | typedef __dev_t dev_t;
      |                 ^~~~~
In file included from /usr/include/asm/sigcontext.h:22,
                 from /usr/include/bits/sigcontext.h:30,
                 from /usr/include/signal.h:288,
                 from asynctest.c:20:
/lib/modules/5.4.83-1-MANJARO-ARM/build/include/linux/types.h:26:26: error: conflicting types for ‘timer_t’
   26 | typedef __kernel_timer_t timer_t;
      |                          ^~~~~~~
In file included from /usr/include/sys/types.h:130,
                 from /usr/include/stdlib.h:394,
                 from asynctest.c:17:
/usr/include/bits/types/timer_t.h:7:19: note: previous declaration of ‘timer_t’ was here
    7 | typedef __timer_t timer_t;
      |                   ^~~~~~~
In file included from /usr/include/asm/sigcontext.h:22,
                 from /usr/include/bits/sigcontext.h:30,
                 from /usr/include/signal.h:288,
                 from asynctest.c:20:
/lib/modules/5.4.83-1-MANJARO-ARM/build/include/linux/types.h:46:26: error: conflicting types for ‘loff_t’
   46 | typedef __kernel_loff_t  loff_t;
      |                          ^~~~~~
In file included from /usr/include/stdlib.h:394,
                 from asynctest.c:17:
/usr/include/sys/types.h:42:18: note: previous declaration of ‘loff_t’ was here
   42 | typedef __loff_t loff_t;
      |                  ^~~~~~
In file included from /usr/include/asm/sigcontext.h:22,
                 from /usr/include/bits/sigcontext.h:30,
                 from /usr/include/signal.h:288,
                 from asynctest.c:20:
/lib/modules/5.4.83-1-MANJARO-ARM/build/include/linux/types.h:113:15: error: conflicting types for ‘u_int64_t’
  113 | typedef u64   u_int64_t;
      |               ^~~~~~~~~
In file included from /usr/include/stdlib.h:394,
                 from asynctest.c:17:
/usr/include/sys/types.h:161:20: note: previous declaration of ‘u_int64_t’ was here
  161 | typedef __uint64_t u_int64_t;
      |                    ^~~~~~~~~
In file included from /usr/include/asm/sigcontext.h:22,
                 from /usr/include/bits/sigcontext.h:30,
                 from /usr/include/signal.h:288,
                 from asynctest.c:20:
/lib/modules/5.4.83-1-MANJARO-ARM/build/include/linux/types.h:114:15: error: conflicting types for ‘int64_t’
  114 | typedef s64   int64_t;
      |               ^~~~~~~
In file included from /usr/include/sys/types.h:155,
                 from /usr/include/stdlib.h:394,
                 from asynctest.c:17:
/usr/include/bits/stdint-intn.h:27:19: note: previous declaration of ‘int64_t’ was here
   27 | typedef __int64_t int64_t;
      |                   ^~~~~~~
In file included from /usr/include/asm/sigcontext.h:22,
                 from /usr/include/bits/sigcontext.h:30,
                 from /usr/include/signal.h:288,
                 from asynctest.c:20:
/lib/modules/5.4.83-1-MANJARO-ARM/build/include/linux/types.h:131:13: error: conflicting types for ‘blkcnt_t’
  131 | typedef u64 blkcnt_t;
      |             ^~~~~~~~
In file included from /usr/include/stdlib.h:394,
                 from asynctest.c:17:
/usr/include/sys/types.h:192:20: note: previous declaration of ‘blkcnt_t’ was here
  192 | typedef __blkcnt_t blkcnt_t;  /* Type to count number of disk blocks.  */
      |                    ^~~~~~~~
make[1]: *** [<builtin>: asynctest] Error 1
make[1]: Leaving directory '/home/oliver/Documentos/GitClone/ldd3/misc-progs'
make: *** [Makefile:10: subdirs] Error 1

I know aarch64 is not a "standard" kernel, but I would be great to run all the examples in a cheap computer. Thank you.

qodroi commented 3 years ago

May this patch help you?

dwalkes commented 2 years ago

Probably relates to https://github.com/martinezjavier/ldd3/issues/66. I suspect there's work to do here to get everything running on aarch64. Pull requests welcome.