wolfcw / libfaketime

libfaketime modifies the system time for a single application
https://github.com/wolfcw/libfaketime
GNU General Public License v2.0
2.64k stars 321 forks source link

Build of libfaketime fails with many errors on RH7 #395

Closed j-xella closed 2 years ago

j-xella commented 2 years ago

This is the machine I am trying to build LFT on:

Operating System: Red Hat Enterprise Linux Server 7.9 (Maipo) CPE OS Name: cpe:/o:redhat:enterprise_linux:7.9:GA:server Kernel: Linux 3.10.0-1160.36.2.el7.x86_64 Architecture: x86-64

I check out the project from github,

commit b61fade280d6124597a35c9f27a5c9ca1276d24c (HEAD -> master, origin/master, origin/HEAD)

Then cd to the folder and make. I get this:

make  -C src all
make[1]: Entering directory `/path/to/libfaketime/src'
cc -o libfaketime.o -c -std=gnu99 -Wall -Wextra -Werror -Wno-nonnull-compare -DFAKE_PTHREAD -DFAKE_STAT -DFAKE_UTIME -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'/usr/local'"' -DLIBDIRNAME='"'/lib/faketime'"'    libfaketime.c
"uthash.h", line 78: typedef redeclared: uint32_t
"uthash.h", line 79: typedef redeclared: uint8_t
"libfaketime.c", line 692: void function cannot return value
"libfaketime.c", line 736: void function cannot return value
"libfaketime.c", line 861: void function cannot return value
"libfaketime.c", line 1003: statement not reached
"libfaketime.c", line 1012: statement not reached
"libfaketime.c", line 1021: statement not reached
"libfaketime.c", line 1028: statement not reached
"libfaketime.c", line 1036: statement not reached
"libfaketime.c", line 1045: statement not reached
"libfaketime.c", line 1054: statement not reached
"libfaketime.c", line 1062: statement not reached
"libfaketime.c", line 1070: statement not reached
"libfaketime.c", line 1079: statement not reached
"libfaketime.c", line 1088: statement not reached
"libfaketime.c", line 2038: invalid cast expression
"libfaketime.c", line 2060: invalid cast expression
"libfaketime.c", line 2131: invalid cast expression
"libfaketime.c", line 2151: invalid cast expression
"libfaketime.c", line 2179: invalid cast expression
"libfaketime.c", line 2199: invalid cast expression
"libfaketime.c", line 2490: statement not reached
"libfaketime.c", line 2510: statement not reached
"libfaketime.c", line 2538: statement not reached
"libfaketime.c", line 2566: statement not reached
"libfaketime.c", line 2634: assignment type mismatch:
    pointer to function(pointer to const char, pointer to struct stat {unsigned long st_dev, unsigned long st_ino, unsigned long st_nlink, unsigned int st_mode, unsigned int st_uid, unsigned int st_gid, int __pad0, unsigned long st_rdev, long st_size, long st_blksize, long st_blocks, struct timespec {..} st_atim, struct timespec {..} st_mtim, struct timespec {..} st_ctim, array[3] of long __unused}) returning int "=" pointer to void
"libfaketime.c", line 2635: assignment type mismatch:
    pointer to function(pointer to const char, pointer to struct stat {unsigned long st_dev, unsigned long st_ino, unsigned long st_nlink, unsigned int st_mode, unsigned int st_uid, unsigned int st_gid, int __pad0, unsigned long st_rdev, long st_size, long st_blksize, long st_blocks, struct timespec {..} st_atim, struct timespec {..} st_mtim, struct timespec {..} st_ctim, array[3] of long __unused}) returning int "=" pointer to void
"libfaketime.c", line 2636: assignment type mismatch:
    pointer to function(int, pointer to struct stat {unsigned long st_dev, unsigned long st_ino, unsigned long st_nlink, unsigned int st_mode, unsigned int st_uid, unsigned int st_gid, int __pad0, unsigned long st_rdev, long st_size, long st_blksize, long st_blocks, struct timespec {..} st_atim, struct timespec {..} st_mtim, struct timespec {..} st_ctim, array[3] of long __unused}) returning int "=" pointer to void
"libfaketime.c", line 2637: assignment type mismatch:
    pointer to function(int, pointer to const char, pointer to struct stat {unsigned long st_dev, unsigned long st_ino, unsigned long st_nlink, unsigned int st_mode, unsigned int st_uid, unsigned int st_gid, int __pad0, unsigned long st_rdev, long st_size, long st_blksize, long st_blocks, struct timespec {..} st_atim, struct timespec {..} st_mtim, struct timespec {..} st_ctim, array[3] of long __unused}) returning int "=" pointer to void
"libfaketime.c", line 2638: assignment type mismatch:
    pointer to function(int, int, pointer to struct stat {unsigned long st_dev, unsigned long st_ino, unsigned long st_nlink, unsigned int st_mode, unsigned int st_uid, unsigned int st_gid, int __pad0, unsigned long st_rdev, long st_size, long st_blksize, long st_blocks, struct timespec {..} st_atim, struct timespec {..} st_mtim, struct timespec {..} st_ctim, array[3] of long __unused}) returning int "=" pointer to void
"libfaketime.c", line 2639: assignment type mismatch:
    pointer to function(int, int, pointer to const char, pointer to struct stat {unsigned long st_dev, unsigned long st_ino, unsigned long st_nlink, unsigned int st_mode, unsigned int st_uid, unsigned int st_gid, int __pad0, unsigned long st_rdev, long st_size, long st_blksize, long st_blocks, struct timespec {..} st_atim, struct timespec {..} st_mtim, struct timespec {..} st_ctim, array[3] of long __unused}, int) returning int "=" pointer to void
"libfaketime.c", line 2640: assignment type mismatch:
    pointer to function(int, pointer to const char, pointer to struct stat {unsigned long st_dev, unsigned long st_ino, unsigned long st_nlink, unsigned int st_mode, unsigned int st_uid, unsigned int st_gid, int __pad0, unsigned long st_rdev, long st_size, long st_blksize, long st_blocks, struct timespec {..} st_atim, struct timespec {..} st_mtim, struct timespec {..} st_ctim, array[3] of long __unused}) returning int "=" pointer to void
"libfaketime.c", line 2641: assignment type mismatch:
    pointer to function(int, pointer to const char, pointer to struct stat64 {unsigned long st_dev, unsigned long st_ino, unsigned long st_nlink, unsigned int st_mode, unsigned int st_uid, unsigned int st_gid, int __pad0, unsigned long st_rdev, long st_size, long st_blksize, long st_blocks, struct timespec {..} st_atim, struct timespec {..} st_mtim, struct timespec {..} st_ctim, array[3] of long __unused}) returning int "=" pointer to void
"libfaketime.c", line 2642: assignment type mismatch:
    pointer to function(int, int, pointer to struct stat64 {unsigned long st_dev, unsigned long st_ino, unsigned long st_nlink, unsigned int st_mode, unsigned int st_uid, unsigned int st_gid, int __pad0, unsigned long st_rdev, long st_size, long st_blksize, long st_blocks, struct timespec {..} st_atim, struct timespec {..} st_mtim, struct timespec {..} st_ctim, array[3] of long __unused}) returning int "=" pointer to void
"libfaketime.c", line 2643: assignment type mismatch:
    pointer to function(int, int, pointer to const char, pointer to struct stat64 {unsigned long st_dev, unsigned long st_ino, unsigned long st_nlink, unsigned int st_mode, unsigned int st_uid, unsigned int st_gid, int __pad0, unsigned long st_rdev, long st_size, long st_blksize, long st_blocks, struct timespec {..} st_atim, struct timespec {..} st_mtim, struct timespec {..} st_ctim, array[3] of long __unused}, int) returning int "=" pointer to void
"libfaketime.c", line 2644: assignment type mismatch:
    pointer to function(int, pointer to const char, pointer to struct stat64 {unsigned long st_dev, unsigned long st_ino, unsigned long st_nlink, unsigned int st_mode, unsigned int st_uid, unsigned int st_gid, int __pad0, unsigned long st_rdev, long st_size, long st_blksize, long st_blocks, struct timespec {..} st_atim, struct timespec {..} st_mtim, struct timespec {..} st_ctim, array[3] of long __unused}) returning int "=" pointer to void
"libfaketime.c", line 2645: assignment type mismatch:
    pointer to function(pointer to long) returning long "=" pointer to void
"libfaketime.c", line 2646: assignment type mismatch:
    pointer to function(pointer to struct timeb {long time, unsigned short millitm, short timezone, short dstflag}) returning int "=" pointer to void
"libfaketime.c", line 2647: assignment type mismatch:
    pointer to function(pointer to struct timespec {long tv_sec, long tv_nsec}, int) returning int "=" pointer to void
"libfaketime.c", line 2649: assignment type mismatch:
    pointer to function(pointer to const char, pointer to const struct timeval {long tv_sec, long tv_usec}) returning int "=" pointer to void
"libfaketime.c", line 2650: assignment type mismatch:
    pointer to function(pointer to const char, pointer to const struct utimbuf {long actime, long modtime}) returning int "=" pointer to void
"libfaketime.c", line 2651: assignment type mismatch:
    pointer to function(int, pointer to const char, pointer to const struct timespec {long tv_sec, long tv_nsec}, int) returning int "=" pointer to void
"libfaketime.c", line 2652: assignment type mismatch:
    pointer to function(int, pointer to const struct timespec {long tv_sec, long tv_nsec}) returning int "=" pointer to void
"libfaketime.c", line 2657: assignment type mismatch:
    pointer to function(pointer to struct timeval {long tv_sec, long tv_usec}, pointer to void) returning int "=" pointer to void
"libfaketime.c", line 2660: assignment type mismatch:
    pointer to function(pointer to const struct timespec {long tv_sec, long tv_nsec}, pointer to struct timespec {long tv_sec, long tv_nsec}) returning int "=" pointer to void
"libfaketime.c", line 2662: assignment type mismatch:
    pointer to function(int, int, pointer to const struct timespec {long tv_sec, long tv_nsec}, pointer to struct timespec {long tv_sec, long tv_nsec}) returning int "=" pointer to void
"libfaketime.c", line 2664: assignment type mismatch:
    pointer to function(unsigned int) returning int "=" pointer to void
"libfaketime.c", line 2665: assignment type mismatch:
    pointer to function(unsigned int) returning unsigned int "=" pointer to void
"libfaketime.c", line 2666: assignment type mismatch:
    pointer to function(unsigned int) returning unsigned int "=" pointer to void
"libfaketime.c", line 2667: assignment type mismatch:
    pointer to function(pointer to struct pollfd {int fd, short events, short revents}, unsigned long, int) returning int "=" pointer to void
"libfaketime.c", line 2668: assignment type mismatch:
    pointer to function(pointer to struct pollfd {int fd, short events, short revents}, unsigned long, pointer to const struct timespec {long tv_sec, long tv_nsec}, pointer to const struct  {array[16] of unsigned long __val}) returning int "=" pointer to void
"libfaketime.c", line 2670: assignment type mismatch:
    pointer to function(int, pointer to struct epoll_event {unsigned int events, union epoll_data {..} data}, int, int) returning int "=" pointer to void
"libfaketime.c", line 2671: assignment type mismatch:
    pointer to function(int, pointer to struct epoll_event {unsigned int events, union epoll_data {..} data}, int, int, pointer to const struct  {array[16] of unsigned long __val}) returning int "=" pointer to void
"libfaketime.c", line 2673: assignment type mismatch:
    pointer to function(int, restrict pointer to struct  {array[16] of long fds_bits}, restrict pointer to struct  {array[16] of long fds_bits}, restrict pointer to struct  {array[16] of long fds_bits}, restrict pointer to struct timeval {long tv_sec, long tv_usec}) returning int "=" pointer to void
"libfaketime.c", line 2675: assignment type mismatch:
    pointer to function(int, restrict pointer to struct  {array[16] of long fds_bits}, restrict pointer to struct  {array[16] of long fds_bits}, restrict pointer to struct  {array[16] of long fds_bits}, pointer to const struct timespec {long tv_sec, long tv_nsec}, pointer to const struct  {array[16] of unsigned long __val}) returning int "=" pointer to void
"libfaketime.c", line 2677: assignment type mismatch:
    pointer to function(pointer to union  {array[32] of char __size, long __align}, pointer to const struct timespec {long tv_sec, long tv_nsec}) returning int "=" pointer to void
"libfaketime.c", line 2678: assignment type mismatch:
    pointer to function(pointer to union  {array[32] of char __size, long __align}, int, pointer to const struct timespec {long tv_sec, long tv_nsec}) returning int "=" pointer to void
"libfaketime.c", line 2681: assignment type mismatch:
    pointer to function(pointer to struct timeb {long time, unsigned short millitm, short timezone, short dstflag}) returning int "=" pointer to void
"libfaketime.c", line 2685: assignment type mismatch:
    pointer to function(pointer to struct timeval {long tv_sec, long tv_usec}, pointer to void) returning int "=" pointer to void
"libfaketime.c", line 2687: assignment type mismatch:
    pointer to function(int, pointer to struct timespec {long tv_sec, long tv_nsec}) returning int "=" pointer to void
"libfaketime.c", line 2706: assignment type mismatch:
    pointer to function(pointer to union  {struct  {..} __data, array[48] of char __size, long long __align}, pointer to union  {struct __pthread_mutex_s {..} __data, array[40] of char __size, long __align}, pointer to struct timespec {long tv_sec, long tv_nsec}) returning int "=" pointer to void
"libfaketime.c", line 2708: assignment type mismatch:
    pointer to function(pointer to union  {struct  {..} __data, array[48] of char __size, long long __align}, pointer to union  {struct __pthread_mutex_s {..} __data, array[40] of char __size, long __align}, pointer to struct timespec {long tv_sec, long tv_nsec}) returning int "=" pointer to void
"libfaketime.c", line 2709: assignment type mismatch:
    pointer to function(restrict pointer to union  {struct  {..} __data, array[48] of char __size, long long __align}, restrict pointer to const union  {array[4] of char __size, int __align}) returning int "=" pointer to void
"libfaketime.c", line 2710: assignment type mismatch:
    pointer to function(pointer to union  {struct  {..} __data, array[48] of char __size, long long __align}) returning int "=" pointer to void
"libfaketime.c", line 2715: assignment type mismatch:
    pointer to function(pointer to union  {struct  {..} __data, array[48] of char __size, long long __align}, pointer to union  {struct __pthread_mutex_s {..} __data, array[40] of char __size, long __align}, pointer to struct timespec {long tv_sec, long tv_nsec}) returning int "=" pointer to void
"libfaketime.c", line 2719: assignment type mismatch:
    pointer to function(restrict pointer to union  {struct  {..} __data, array[48] of char __size, long long __align}, restrict pointer to const union  {array[4] of char __size, int __align}) returning int "=" pointer to void
"libfaketime.c", line 2723: assignment type mismatch:
    pointer to function(pointer to union  {struct  {..} __data, array[48] of char __size, long long __align}) returning int "=" pointer to void
"libfaketime.c", line 2735: assignment type mismatch:
    pointer to function(int, pointer to struct timespec {long tv_sec, long tv_nsec}) returning int "=" pointer to void
"libfaketime.c", line 2738: assignment type mismatch:
    pointer to function(int, pointer to struct timespec {long tv_sec, long tv_nsec}) returning int "=" pointer to void
"libfaketime.c", line 2746: assignment type mismatch:
    pointer to function(int, int, pointer to const struct itimerspec {struct timespec {..} it_interval, struct timespec {..} it_value}, pointer to struct itimerspec {struct timespec {..} it_interval, struct timespec {..} it_value}) returning int "=" pointer to void
"libfaketime.c", line 2747: assignment type mismatch:
    pointer to function(pointer to void, int, pointer to const struct itimerspec {struct timespec {..} it_interval, struct timespec {..} it_value}, pointer to struct itimerspec {struct timespec {..} it_interval, struct timespec {..} it_value}) returning int "=" pointer to void
"libfaketime.c", line 2751: assignment type mismatch:
    pointer to function(pointer to void, int, pointer to const struct itimerspec {struct timespec {..} it_interval, struct timespec {..} it_value}, pointer to struct itimerspec {struct timespec {..} it_interval, struct timespec {..} it_value}) returning int "=" pointer to void
"libfaketime.c", line 2754: assignment type mismatch:
    pointer to function(int, pointer to struct itimerspec {struct timespec {..} it_interval, struct timespec {..} it_value}) returning int "=" pointer to void
"libfaketime.c", line 2755: assignment type mismatch:
    pointer to function(pointer to void, pointer to struct itimerspec {struct timespec {..} it_interval, struct timespec {..} it_value}) returning int "=" pointer to void
"libfaketime.c", line 2759: assignment type mismatch:
    pointer to function(pointer to void, pointer to struct itimerspec {struct timespec {..} it_interval, struct timespec {..} it_value}) returning int "=" pointer to void
"libfaketime.c", line 2763: assignment type mismatch:
    pointer to function(int, pointer to struct itimerspec {struct timespec {..} it_interval, struct timespec {..} it_value}) returning int "=" pointer to void
"libfaketime.c", line 2764: assignment type mismatch:
    pointer to function(int, int, pointer to const struct itimerspec {struct timespec {..} it_interval, struct timespec {..} it_value}, pointer to struct itimerspec {struct timespec {..} it_interval, struct timespec {..} it_value}) returning int "=" pointer to void
"libfaketime.c", line 3646: statement not reached
cc: acomp failed for libfaketime.c
make[1]: *** [libfaketime.o] Error 2
make[1]: Leaving directory `/path/to/libfaketime/src'
make: *** [all] Error 2
wolfcw commented 2 years ago

Thanks for reporting.

Until those are fixed, you might want to drop -Werror from the Makefile on your system.

j-xella commented 2 years ago

Hi, dropping -Werror helps, but it still does not build.

I suspect that I have too old version of gcc on my system that does not cope with some of the C features in the code.

gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
j-xella commented 2 years ago

OK, I figured this out. On my system, several compilers were installed, and cc that make uses by default is actually not gcc, but Sun Studio compiler. This compiler does not support gnu extensions, hence the errors. make CC=gcc fixed the problem for me, so that there is no need to change the Makefile at all.

On the positive side, though, I made some modifications to remove those Gnu extensions from the source code, so that the library compies and passes the tests using Sun Studio compiler as well now. See pull request #397

wolfcw commented 2 years ago

Thanks for the PR, just merged. :-)