Page 1 of 1

Build mbuffer on Monterey?

PostPosted: Mon Jan 31, 2022 9:04 pm
by zandr
I just tried building mbuffer from lundman's tarball, and am having difficulty.
I'm running on Monterey (12.1), on an M1 Mini.

configure looked fine aside from not finding mt and not finding an MD5 library.

Code: Select all
 % make
gcc -g -O2 -O2 -Wall -m64 -DHAVE_CONFIG_H -I. -I.   -c -o log.o log.c
gcc -g -O2 -O2 -Wall -m64 -DHAVE_CONFIG_H -I. -I.   -c -o network.o network.c
gcc -g -O2 -O2 -Wall -m64 -DHAVE_CONFIG_H -I. -I.   -c -o mbuffer.o mbuffer.c
mbuffer.c:65:3: warning: sendfile is unable to send from buffers [-W#warnings]
        #warning sendfile is unable to send from buffers
         ^
In file included from mbuffer.c:211:
./mbuffer_darwin.h:22:10: warning: incompatible pointer to integer conversion assigning to 'sem_t' (aka 'int') from 'sem_t *' (aka 'int *'); dereference with * [-Wint-conversion]
    *sem = sem_open(fname, O_CREAT, 0600, value);
         ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           *
./mbuffer_darwin.h:36:21: warning: incompatible integer to pointer conversion passing 'sem_t' (aka 'int') to parameter of type 'sem_t *' (aka 'int *'); remove * [-Wint-conversion]
    return sem_wait(*sem);
                    ^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/semaphore.h:60:21: note: passing argument to parameter here
int sem_wait(sem_t *) __DARWIN_ALIAS_C(sem_wait);
                    ^
In file included from mbuffer.c:211:
./mbuffer_darwin.h:41:21: warning: incompatible integer to pointer conversion passing 'sem_t' (aka 'int') to parameter of type 'sem_t *' (aka 'int *'); remove * [-Wint-conversion]
    return sem_post(*sem);
                    ^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/semaphore.h:57:21: note: passing argument to parameter here
int sem_post(sem_t *);
                    ^
In file included from mbuffer.c:211:
./mbuffer_darwin.h:54:19: error: static declaration of 'clock_gettime' follows non-static declaration
static inline int clock_gettime(unsigned long int id, struct timespec *ts)
                  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/time.h:178:5: note: previous declaration is here
int clock_gettime(clockid_t __clock_id, struct timespec *__tp);
    ^
In file included from mbuffer.c:211:
./mbuffer_darwin.h:70:23: error: typedef redefinition with different types ('unsigned long' vs 'enum clockid_t')
typedef unsigned long clockid_t;
                      ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/time.h:172:3: note: previous definition is here
} clockid_t;
  ^
In file included from mbuffer.c:211:
./mbuffer_darwin.h:71:9: warning: 'CLOCK_REALTIME' macro redefined [-Wmacro-redefined]
#define CLOCK_REALTIME 0
        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/time.h:155:9: note: previous definition is here
#define CLOCK_REALTIME _CLOCK_REALTIME
        ^
mbuffer.c:356:15: warning: cast to smaller integer type 'unsigned int' from 'void *' [-Wvoid-pointer-to-int-cast]
        unsigned t = (unsigned) timeout;
                     ^~~~~~~~~~~~~~~~~~
mbuffer.c:760:19: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
                                        pthread_exit((void *) in);
                                                     ^~~~~~~~~~~
mbuffer.c:761:12: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
                                return (void *) in;
                                       ^~~~~~~~~~~
mbuffer.c:858:15: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
        pthread_exit((void *) ret);
                     ^~~~~~~~~~~~
mbuffer.c:1165:15: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
        pthread_exit((void *)status);
                     ^~~~~~~~~~~~~~
mbuffer.c:2100:19: warning: incompatible function pointer types assigning to 'void (*)(int, struct __siginfo *, void *)' from 'void (*)(int)' [-Wincompatible-function-pointer-types]
        sig.sa_sigaction = SIG_IGN;
                         ^ ~~~~~~~
11 warnings and 2 errors generated.
make: *** [mbuffer.o] Error 1


Any suggestions would be appreciated.

Thanks!

Re: Build mbuffer on Monterey?

PostPosted: Tue Feb 01, 2022 2:34 am
by lundman
The first error is:

./mbuffer_darwin.h:54:19: error: static declaration of 'clock_gettime' follows non-static declaration


in monterey and newer, has clock_gettime() built in now, so it doesnt need that extra work.

Re: Build mbuffer on Monterey?

PostPosted: Sun Feb 12, 2023 8:57 pm
by _max_
Just following up on this post.

Zandar...any success with the mbuffer compile on M1? Was looking to also utilize w/ zfs-autobackup. Not many mbuffer posts out there in general in recent history re MacOS.