ptrrkssn / psmsd

Peter's SMS gateway daemon
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

Compiling on Raspberry Pi #1

Closed daddyfix closed 3 years ago

daddyfix commented 3 years ago

Hey. I trying to compile your C program on Raspberry Pi but I keep getting header conflicting errors... ie. types.h:15:26: error: conflicting types for ‘fd_set’

  1. Installed the Raspberrypi headers
  2. modified the gcccommand in Makefile to -I (include the header path)
  3. modified the includes to point to the correct subdir path

But I still get these errors... can you please help?

make
gcc -I /usr/src/linux-headers-5.10.63-v8+/include -O2 -g -Wall   -c -o psmsd.o psmsd.c
In file included from /usr/include/aarch64-linux-gnu/asm/sigcontext.h:22,
                 from /usr/include/aarch64-linux-gnu/bits/sigcontext.h:30,
                 from /usr/include/signal.h:291,
                 from psmsd.c:40:
/usr/src/linux-headers-5.10.63-v8+/include/linux/types.h:15:26: error: conflicting types for ‘fd_set’
 typedef __kernel_fd_set  fd_set;
                          ^~~~~~
In file included from /usr/include/aarch64-linux-gnu/sys/types.h:196,
                 from /usr/include/stdlib.h:394,
                 from psmsd.c:35:
/usr/include/aarch64-linux-gnu/sys/select.h:70:5: note: previous declaration of ‘fd_set’ was here
   } fd_set;
     ^~~~~~
In file included from /usr/include/aarch64-linux-gnu/asm/sigcontext.h:22,
                 from /usr/include/aarch64-linux-gnu/bits/sigcontext.h:30,
                 from /usr/include/signal.h:291,
                 from psmsd.c:40:
/usr/src/linux-headers-5.10.63-v8+/include/linux/types.h:16:25: error: conflicting types for ‘dev_t’
 typedef __kernel_dev_t  dev_t;
                         ^~~~~
In file included from /usr/include/stdlib.h:394,
                 from psmsd.c:35:
/usr/include/aarch64-linux-gnu/sys/types.h:59:17: note: previous declaration of ‘dev_t’ was here
 typedef __dev_t dev_t;
                 ^~~~~
In file included from /usr/include/aarch64-linux-gnu/asm/sigcontext.h:22,
                 from /usr/include/aarch64-linux-gnu/bits/sigcontext.h:30,
                 from /usr/include/signal.h:291,
                 from psmsd.c:40:
/usr/src/linux-headers-5.10.63-v8+/include/linux/types.h:26:26: error: conflicting types for ‘timer_t’
 typedef __kernel_timer_t timer_t;
                          ^~~~~~~
In file included from /usr/include/aarch64-linux-gnu/sys/types.h:130,
                 from /usr/include/stdlib.h:394,
                 from psmsd.c:35:
/usr/include/aarch64-linux-gnu/bits/types/timer_t.h:7:19: note: previous declaration of ‘timer_t’ was here
 typedef __timer_t timer_t;
                   ^~~~~~~
In file included from /usr/include/aarch64-linux-gnu/asm/sigcontext.h:22,
                 from /usr/include/aarch64-linux-gnu/bits/sigcontext.h:30,
                 from /usr/include/signal.h:291,
                 from psmsd.c:40:
/usr/src/linux-headers-5.10.63-v8+/include/linux/types.h:46:26: error: conflicting types for ‘loff_t’
 typedef __kernel_loff_t  loff_t;
                          ^~~~~~
In file included from /usr/include/stdlib.h:394,
                 from psmsd.c:35:
/usr/include/aarch64-linux-gnu/sys/types.h:42:18: note: previous declaration of ‘loff_t’ was here
 typedef __loff_t loff_t;
                  ^~~~~~
In file included from /usr/include/aarch64-linux-gnu/asm/sigcontext.h:22,
                 from /usr/include/aarch64-linux-gnu/bits/sigcontext.h:30,
                 from /usr/include/signal.h:291,
                 from psmsd.c:40:
/usr/src/linux-headers-5.10.63-v8+/include/linux/types.h:108:15: error: conflicting types for ‘u_int64_t’
 typedef u64   u_int64_t;
               ^~~~~~~~~
In file included from /usr/include/stdlib.h:394,
                 from psmsd.c:35:
/usr/include/aarch64-linux-gnu/sys/types.h:180:1: note: previous declaration of ‘u_int64_t’ was here
 __u_intN_t (64, __DI__);
 ^~~~~~~~~~
In file included from /usr/include/aarch64-linux-gnu/asm/sigcontext.h:22,
                 from /usr/include/aarch64-linux-gnu/bits/sigcontext.h:30,
                 from /usr/include/signal.h:291,
                 from psmsd.c:40:
/usr/src/linux-headers-5.10.63-v8+/include/linux/types.h:109:15: error: conflicting types for ‘int64_t’
 typedef s64   int64_t;
               ^~~~~~~
In file included from /usr/include/aarch64-linux-gnu/sys/types.h:155,
                 from /usr/include/stdlib.h:394,
                 from psmsd.c:35:
/usr/include/aarch64-linux-gnu/bits/stdint-intn.h:27:19: note: previous declaration of ‘int64_t’ was here
 typedef __int64_t int64_t;
                   ^~~~~~~
In file included from /usr/include/aarch64-linux-gnu/asm/sigcontext.h:22,
                 from /usr/include/aarch64-linux-gnu/bits/sigcontext.h:30,
                 from /usr/include/signal.h:291,
                 from psmsd.c:40:
/usr/src/linux-headers-5.10.63-v8+/include/linux/types.h:126:13: error: conflicting types for ‘blkcnt_t’
 typedef u64 blkcnt_t;
             ^~~~~~~~
In file included from /usr/include/stdlib.h:394,
                 from psmsd.c:35:
/usr/include/aarch64-linux-gnu/sys/types.h:209:20: note: previous declaration of ‘blkcnt_t’ was here
 typedef __blkcnt_t blkcnt_t;  /* Type to count number of disk blocks.  */
                    ^~~~~~~~
In file included from /usr/include/aarch64-linux-gnu/asm/stat.h:17,
                 from /usr/src/linux-headers-5.10.63-v8+/include/linux/stat.h:6,
                 from psmsd.c:55:
/usr/include/asm-generic/stat.h:24:8: error: redefinition of ‘struct stat’
 struct stat {
        ^~~~
In file included from /usr/include/fcntl.h:78,
                 from psmsd.c:45:
/usr/include/aarch64-linux-gnu/bits/stat.h:55:8: note: originally defined here
 struct stat
        ^~~~
/usr/include/asm-generic/stat.h:37:8: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘.’ token
  long  st_atime; /* Time of last access.  */
        ^~~~~~~~
In file included from /usr/src/linux-headers-5.10.63-v8+/include/linux/time.h:5,
                 from /usr/src/linux-headers-5.10.63-v8+/include/linux/stat.h:19,
                 from psmsd.c:55:
/usr/src/linux-headers-5.10.63-v8+/include/linux/cache.h:6:10: fatal error: asm/cache.h: No such file or directory
 #include <asm/cache.h>
          ^~~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: psmsd.o] Error 1
ptrrkssn commented 3 years ago

Yeah, that code was never ported to Linux - it was written for Solaris systems a long time ago. I've made a quick go at fixing parts of the code so that it atleast compiles on an Ubuntu 20 Linux system now. Not really tested though...

daddyfix commented 3 years ago

Wow. Thats great. Im going to give it a try! Thanks

daddyfix commented 3 years ago

Thanks Peter. Compiled and runs on Raspberry Pi Model 4 B.

# make
gcc -O2 -g -Wall    -c -o psmsd.o psmsd.c
gcc -O2 -g -Wall    -c -o gsm.o gsm.c
gcc -O2 -g -Wall    -c -o serial.o serial.c
gcc -O2 -g -Wall    -c -o uucp.o uucp.c
gcc -O2 -g -Wall    -c -o cap.o cap.c
gcc -O2 -g -Wall    -c -o queue.o queue.c
gcc -O2 -g -Wall    -c -o argv.o argv.c
gcc -O2 -g -Wall    -c -o spawn.o spawn.c
gcc -O2 -g -Wall    -c -o ptime.o ptime.c
gcc -O2 -g -Wall    -c -o buffer.o buffer.c
gcc -O2 -g -Wall    -c -o users.o users.c
gcc -O2 -g -Wall    -c -o strmisc.o strmisc.c
gcc -o psmsd psmsd.o gsm.o serial.o uucp.o cap.o queue.o argv.o spawn.o ptime.o buffer.o users.o strmisc.o -lpthread -lpthread
gcc -O2 -g -Wall    -c -o psmsc.o psmsc.c
gcc -o psmsc psmsc.o buffer.o users.o strmisc.o -lpthread