manymouse icon indicating copy to clipboard operation
manymouse copied to clipboard

Conflicting typedefs when building linux_evdev.c

Open 4LT opened this issue 2 years ago • 2 comments

OS

Arch Linux

Linux version 6.5.6-arch2-1

Build Output

gcc -O0 -Wall -g -c -I. -fPIC -I/usr/src/linux/include   -c -o linux_evdev.o linux_evdev.c
In file included from /usr/src/linux/include/linux/limits.h:6,
                 from /usr/include/bits/local_lim.h:38,
                 from /usr/include/bits/posix1_lim.h:161,
                 from /usr/include/dirent.h:235,
                 from linux_evdev.c:20:
/usr/src/linux/include/linux/types.h:20:33: error: conflicting types for ‘fd_set’; have ‘__kernel_fd_set’
   20 | typedef __kernel_fd_set         fd_set;
      |                                 ^~~~~~
In file included from /usr/include/sys/types.h:179,
                 from /usr/include/stdlib.h:514,
                 from linux_evdev.c:17:
/usr/include/sys/select.h:70:5: note: previous declaration of ‘fd_set’ with type ‘fd_set’
   70 |   } fd_set;
      |     ^~~~~~
/usr/src/linux/include/linux/types.h:21:33: error: conflicting types for ‘dev_t’; have ‘__kernel_dev_t’ {aka ‘unsigned int’}
   21 | typedef __kernel_dev_t          dev_t;
      |                                 ^~~~~
/usr/include/sys/types.h:59:17: note: previous declaration of ‘dev_t’ with type ‘dev_t’ {aka ‘long unsigned int’}
   59 | typedef __dev_t dev_t;
      |                 ^~~~~
/usr/src/linux/include/linux/types.h:25:33: error: conflicting types for ‘nlink_t’; have ‘u32’ {aka ‘unsigned int’}
   25 | typedef u32                     nlink_t;
      |                                 ^~~~~~~
/usr/include/sys/types.h:74:19: note: previous declaration of ‘nlink_t’ with type ‘nlink_t’ {aka ‘long unsigned int’}
   74 | typedef __nlink_t nlink_t;
      |                   ^~~~~~~
/usr/src/linux/include/linux/types.h:31:33: error: conflicting types for ‘timer_t’; have ‘__kernel_timer_t’ {aka ‘int’}
   31 | typedef __kernel_timer_t        timer_t;
      |                                 ^~~~~~~
In file included from /usr/include/sys/types.h:130:
/usr/include/bits/types/timer_t.h:7:19: note: previous declaration of ‘timer_t’ with type ‘timer_t’ {aka ‘void *’}
    7 | typedef __timer_t timer_t;
      |                   ^~~~~~~
/usr/src/linux/include/linux/types.h:52:33: error: conflicting types for ‘loff_t’; have ‘__kernel_loff_t’ {aka ‘long long int’}
   52 | typedef __kernel_loff_t         loff_t;
      |                                 ^~~~~~
/usr/include/sys/types.h:42:18: note: previous declaration of ‘loff_t’ with type ‘loff_t’ {aka ‘long int’}
   42 | typedef __loff_t loff_t;
      |                  ^~~~~~
/usr/src/linux/include/linux/types.h:114:33: error: conflicting types for ‘u_int64_t’; have ‘u64’ {aka ‘long long unsigned int’}
  114 | typedef u64                     u_int64_t;
      |                                 ^~~~~~~~~
/usr/include/sys/types.h:161:20: note: previous declaration of ‘u_int64_t’ with type ‘u_int64_t’ {aka ‘long unsigned int’}
  161 | typedef __uint64_t u_int64_t;
      |                    ^~~~~~~~~
/usr/src/linux/include/linux/types.h:115:33: error: conflicting types for ‘int64_t’; have ‘s64’ {aka ‘long long int’}
  115 | typedef s64                     int64_t;
      |                                 ^~~~~~~
In file included from /usr/include/sys/types.h:155:
/usr/include/bits/stdint-intn.h:27:19: note: previous declaration of ‘int64_t’ with type ‘int64_t’ {aka ‘long int’}
   27 | typedef __int64_t int64_t;
      |                   ^~~~~~~
/usr/src/linux/include/linux/types.h:132:13: error: conflicting types for ‘blkcnt_t’; have ‘u64’ {aka ‘long long unsigned int’}
  132 | typedef u64 blkcnt_t;
      |             ^~~~~~~~
/usr/include/sys/types.h:192:20: note: previous declaration of ‘blkcnt_t’ with type ‘blkcnt_t’ {aka ‘long int’}
  192 | typedef __blkcnt_t blkcnt_t;     /* Type to count number of disk blocks.  */
      |                    ^~~~~~~~
In file included from /usr/src/linux/include/linux/time.h:5,
                 from /usr/src/linux/include/linux/input.h:8,
                 from linux_evdev.c:27:
/usr/src/linux/include/linux/cache.h:6:10: fatal error: asm/cache.h: No such file or directory
    6 | #include <asm/cache.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: linux_evdev.o] Error 1

4LT avatar Oct 10 '23 21:10 4LT

Does this fix it for you?

diff --git a/Makefile b/Makefile
index 0e8ca27..7487ee3 100644
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,7 @@ ifeq ($(strip $(macosx)),true)
 endif
 
 ifeq ($(strip $(linux)),true)
-  CFLAGS += -fPIC -I/usr/src/linux/include
+  CFLAGS += -fPIC
   LDFLAGS += -ldl
   JDKPATH := $(LINUX_JDK_PATH)
   JAVAC := $(JDKPATH)bin/javac

icculus avatar Oct 11 '23 04:10 icculus

Yes, that fixes it, thank you!

I'm seeing the following warning now though

gcc -O0 -Wall -g -c -I. -fPIC    -c -o linux_evdev.o linux_evdev.c
linux_evdev.c: In function ‘linux_evdev_init’:
linux_evdev.c:267:53: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 117 [-Wformat-truncation=]
  267 |         snprintf(fname, sizeof (fname), "/dev/input/%s", dent->d_name);
      |                                                     ^~
linux_evdev.c:267:9: note: ‘snprintf’ output between 12 and 267 bytes into a destination of size 128
  267 |         snprintf(fname, sizeof (fname), "/dev/input/%s", dent->d_name);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4LT avatar Oct 11 '23 09:10 4LT