how to build mbuffer for macox

All your general support questions for OpenZFS on OS X.

how to build mbuffer for macox

Postby tristank » Tue Apr 22, 2014 7:33 am

I noticed that there is a mbuffer sourcefile at lundmans ftp space: http://lundman.net/ftp/osx.zfs/

I tried to compile it, but it failed:

Code: Select all
$ ./configure --enable-debug
checking build system type... i686-apple-darwin12.5.0
checking host system type... i686-apple-darwin12.5.0
checking target system type... i686-apple-darwin12.5.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... none needed
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking for C/C++ restrict keyword... __restrict
checking for inline... inline
checking whether gcc supports -g -O2 -O2 -Wall -m64... yes
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking for rm... /bin/rm
checking for mt... /usr/local/bin/mt
checking return type of signal handlers... void
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for struct stat.st_blksize... yes
checking whether to enable assertions... yes
checking for pthread_mutex_init in -lpthread... yes
checking for library containing clock_gettime... no
as_fn_error 1 could not find the library containing clock_gettime! 4867 5
checking for library containing sem_init... none required
checking for library containing rint... none required
checking for library containing seteuid... none required
checking for library containing atoll... none required
checking for library containing hstrerror... none required
checking for library containing getaddrinfo... none required
checking for library containing socket... none required
checking for library containing gethostbyname... none required
checking for library containing sendfile... none required
checking sys/sendfile.h usability... no
checking sys/sendfile.h presence... no
checking for sys/sendfile.h... no
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for library containing mhash_init... no
checking for library containing MD5Init... no
checking for library containing MD5_Init... -lcrypto
configure: creating ./config.status
config.status: creating Makefile
config.status: creating mbuffer.1
config.status: creating config.h
config.status: config.h is unchanged
tk-pb4540s-macosx:mbuffer-20130220 tristank$ 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
         ^
mbuffer.c:503:9: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
        (void) clock_gettime(ClockSrc,&now);
               ^
mbuffer.c:563:10: warning: implicit declaration of function 'mac_sem_post' is invalid in C99 [-Wimplicit-function-declaration]
                        err = sem_post(&Buf2Dev);
                              ^
mbuffer.c:216:18: note: expanded from macro 'sem_post'
#define sem_post mac_sem_post
                 ^
mbuffer.c:721:9: warning: implicit declaration of function 'mac_sem_wait' is invalid in C99 [-Wimplicit-function-declaration]
                err = sem_wait(&Dev2Buf); /* Wait for one or more buffer blocks to be free */
                      ^
mbuffer.c:215:18: note: expanded from macro 'sem_wait'
#define sem_wait mac_sem_wait
                 ^
mbuffer.c:766:19: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
                                        pthread_exit((void *) in);
                                                     ^
mbuffer.c:767:12: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
                                return (void *) in;
                                       ^
mbuffer.c:864:15: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
        pthread_exit((void *) ret);
                     ^
mbuffer.c:962:2: warning: 'MD5_Init' is deprecated [-Wdeprecated-declarations]
        MD5_INIT(MD5ctxt);
        ^
mbuffer.c:88:25: note: expanded from macro 'MD5_INIT'
#define MD5_INIT(ctxt)          MD5_Init(&ctxt);
                                ^
/usr/include/openssl/md5.h:113:5: note: 'MD5_Init' declared here
int MD5_Init(MD5_CTX *c) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
    ^
mbuffer.c:985:4: warning: 'MD5_Final' is deprecated [-Wdeprecated-declarations]
                        MD5_END(hashvalue,MD5ctxt);
                        ^
mbuffer.c:90:28: note: expanded from macro 'MD5_END'
#define MD5_END(hash,ctxt)      MD5_Final(hash,&(ctxt))
                                ^
/usr/include/openssl/md5.h:115:5: note: 'MD5_Final' declared here
int MD5_Final(unsigned char *md, MD5_CTX *c) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
    ^
mbuffer.c:1008:3: warning: 'MD5_Update' is deprecated [-Wdeprecated-declarations]
                MD5_UPDATE(MD5ctxt,SendAt,size);
                ^
mbuffer.c:89:33: note: expanded from macro 'MD5_UPDATE'
#define MD5_UPDATE(ctxt,at,num) MD5_Update(&ctxt,at,num)
                                ^
/usr/include/openssl/md5.h:114:5: note: 'MD5_Update' declared here
int MD5_Update(MD5_CTX *c, const void *data, size_t len) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
    ^
mbuffer.c:1171:15: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
        pthread_exit((void *)status);
                     ^
mbuffer.c:2060:11: warning: implicit declaration of function 'mac_sem_init' is invalid in C99 [-Wimplicit-function-declaration]
        if (0 != sem_init(&Buf2Dev,0,0))
                 ^
mbuffer.c:213:18: note: expanded from macro 'sem_init'
#define sem_init mac_sem_init
                 ^
mbuffer.c:2106:19: warning: incompatible pointer types assigning to 'void (*)(int, struct __siginfo *, void *)' from 'void (*)(int)' [-Wincompatible-pointer-types]
        sig.sa_sigaction = SIG_IGN;
                         ^ ~~~~~~~
13 warnings generated.
gcc -g -O2 -O2 -Wall -m64 -DHAVE_CONFIG_H -I. -I.  log.o network.o mbuffer.o -lcrypto -lpthread  -o mbuffer
Undefined symbols for architecture x86_64:
  "_clock_gettime", referenced from:
      _outputThread in mbuffer.o
      _inputThread in mbuffer.o
      _enforceSpeedLimit in mbuffer.o
  "_mac_sem_init", referenced from:
      _main in mbuffer.o
  "_mac_sem_post", referenced from:
      _outputThread in mbuffer.o
      _inputThread in mbuffer.o
      _requestInputVolume in mbuffer.o
      _terminateOutputThread in mbuffer.o
      _syncSenders in mbuffer.o
  "_mac_sem_wait", referenced from:
      _outputThread in mbuffer.o
      _inputThread in mbuffer.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mbuffer] Error 1


Any suggestions? Thanks.
tristank
 
Posts: 7
Joined: Thu Apr 17, 2014 7:56 am

Re: how to build mbuffer for macox

Postby lundman » Tue Apr 22, 2014 7:42 pm

Get my source tarball and you can see my changes, hacks and diff. Then you can build it. The original author rejected my changes so we will always have to maintain separate mbuffer.
User avatar
lundman
 
Posts: 1337
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: how to build mbuffer for macox

Postby tristank » Thu Apr 24, 2014 3:59 am

lundman wrote:Get my source tarball and you can see my changes, hacks and diff.


I'm sorry, maybe that sounds rather siily, but I downloaded this sourceball and I folllowed the instruction to compile.

Code: Select all
# To install run
./configure

# with the options you desire.
# To get a list of the possible options, run:
./configure --help

# possible options are
./configure --enable-debug --enable-networking --disable-multivolume

# Then just do a:
make && make install


Still I'm unable to do so.
tristank
 
Posts: 7
Joined: Thu Apr 17, 2014 7:56 am

Re: how to build mbuffer for macox

Postby lundman » Thu Apr 24, 2014 6:13 pm

And you got my source ball of mbuffer?

mbuffer-20130220-osx

Code: Select all
./configure
make
12 warnings generated.
gcc -g -O2 -O2 -Wall -m64 -DHAVE_CONFIG_H -I. -I.  log.o network.o mbuffer.o -lcrypto -lpthread  -o mbuffer
./mbuffer
mbuffer: warning: Blocksize should be a multiple of the blocksize of the output device!
User avatar
lundman
 
Posts: 1337
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: how to build mbuffer for macox

Postby tristank » Fri Apr 25, 2014 1:24 am

Yeah, here is my terminal output:

Code: Select all
$ cd ~/Downloads/mbuffer-20130220
$ ./configure
checking build system type... i686-apple-darwin12.5.0
checking host system type... i686-apple-darwin12.5.0
checking target system type... i686-apple-darwin12.5.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... none needed
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking for C/C++ restrict keyword... __restrict
checking for inline... inline
checking whether gcc supports -g -O2 -O2 -Wall -m64... yes
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking for rm... /bin/rm
checking for mt... /usr/local/bin/mt
checking return type of signal handlers... void
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for struct stat.st_blksize... yes
checking whether to enable assertions... yes
checking for pthread_mutex_init in -lpthread... yes
checking for library containing clock_gettime... no
as_fn_error 1 could not find the library containing clock_gettime! 4867 5
checking for library containing sem_init... none required
checking for library containing rint... none required
checking for library containing seteuid... none required
checking for library containing atoll... none required
checking for library containing hstrerror... none required
checking for library containing getaddrinfo... none required
checking for library containing socket... none required
checking for library containing gethostbyname... none required
checking for library containing sendfile... none required
checking sys/sendfile.h usability... no
checking sys/sendfile.h presence... no
checking for sys/sendfile.h... no
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for library containing mhash_init... no
checking for library containing MD5Init... no
checking for library containing MD5_Init... -lcrypto
configure: creating ./config.status
config.status: creating Makefile
config.status: creating mbuffer.1
config.status: creating config.h
config.status: config.h is unchanged

$ 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
         ^
mbuffer.c:503:9: warning: implicit declaration of function 'clock_gettime' is invalid in
      C99 [-Wimplicit-function-declaration]
        (void) clock_gettime(ClockSrc,&now);
               ^
mbuffer.c:563:10: warning: implicit declaration of function 'mac_sem_post' is invalid in
      C99 [-Wimplicit-function-declaration]
                        err = sem_post(&Buf2Dev);
                              ^
mbuffer.c:216:18: note: expanded from macro 'sem_post'
#define sem_post mac_sem_post
                 ^
mbuffer.c:721:9: warning: implicit declaration of function 'mac_sem_wait' is invalid in
      C99 [-Wimplicit-function-declaration]
                err = sem_wait(&Dev2Buf); /* Wait for one or more buffer blocks ...
                      ^
mbuffer.c:215:18: note: expanded from macro 'sem_wait'
#define sem_wait mac_sem_wait
                 ^
mbuffer.c:766:19: warning: cast to 'void *' from smaller integer type 'int'
      [-Wint-to-void-pointer-cast]
                                        pthread_exit((void *) in);
                                                     ^
mbuffer.c:767:12: warning: cast to 'void *' from smaller integer type 'int'
      [-Wint-to-void-pointer-cast]
                                return (void *) in;
                                       ^
mbuffer.c:864:15: warning: cast to 'void *' from smaller integer type 'int'
      [-Wint-to-void-pointer-cast]
        pthread_exit((void *) ret);
                     ^
mbuffer.c:962:2: warning: 'MD5_Init' is deprecated [-Wdeprecated-declarations]
        MD5_INIT(MD5ctxt);
        ^
mbuffer.c:88:25: note: expanded from macro 'MD5_INIT'
#define MD5_INIT(ctxt)          MD5_Init(&ctxt);
                                ^
/usr/include/openssl/md5.h:113:5: note: 'MD5_Init' declared here
int MD5_Init(MD5_CTX *c) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
    ^
mbuffer.c:985:4: warning: 'MD5_Final' is deprecated [-Wdeprecated-declarations]
                        MD5_END(hashvalue,MD5ctxt);
                        ^
mbuffer.c:90:28: note: expanded from macro 'MD5_END'
#define MD5_END(hash,ctxt)      MD5_Final(hash,&(ctxt))
                                ^
/usr/include/openssl/md5.h:115:5: note: 'MD5_Final' declared here
int MD5_Final(unsigned char *md, MD5_CTX *c) DEPRECATED_IN_MAC_OS_X_VERSION_10_7...
    ^
mbuffer.c:1008:3: warning: 'MD5_Update' is deprecated [-Wdeprecated-declarations]
                MD5_UPDATE(MD5ctxt,SendAt,size);
                ^
mbuffer.c:89:33: note: expanded from macro 'MD5_UPDATE'
#define MD5_UPDATE(ctxt,at,num) MD5_Update(&ctxt,at,num)
                                ^
/usr/include/openssl/md5.h:114:5: note: 'MD5_Update' declared here
int MD5_Update(MD5_CTX *c, const void *data, size_t len) DEPRECATED_IN_MAC_OS_X_...
    ^
mbuffer.c:1171:15: warning: cast to 'void *' from smaller integer type 'int'
      [-Wint-to-void-pointer-cast]
        pthread_exit((void *)status);
                     ^
mbuffer.c:2060:11: warning: implicit declaration of function 'mac_sem_init' is invalid
      in C99 [-Wimplicit-function-declaration]
        if (0 != sem_init(&Buf2Dev,0,0))
                 ^
mbuffer.c:213:18: note: expanded from macro 'sem_init'
#define sem_init mac_sem_init
                 ^
mbuffer.c:2106:19: warning: incompatible pointer types assigning to 'void (*)(int,
      struct __siginfo *, void *)' from 'void (*)(int)' [-Wincompatible-pointer-types]
        sig.sa_sigaction = SIG_IGN;
                         ^ ~~~~~~~
13 warnings generated.
gcc -g -O2 -O2 -Wall -m64 -DHAVE_CONFIG_H -I. -I.  log.o network.o mbuffer.o -lcrypto -lpthread  -o mbuffer
Undefined symbols for architecture x86_64:
  "_clock_gettime", referenced from:
      _outputThread in mbuffer.o
      _inputThread in mbuffer.o
      _enforceSpeedLimit in mbuffer.o
  "_mac_sem_init", referenced from:
      _main in mbuffer.o
  "_mac_sem_post", referenced from:
      _outputThread in mbuffer.o
      _inputThread in mbuffer.o
      _requestInputVolume in mbuffer.o
      _terminateOutputThread in mbuffer.o
      _syncSenders in mbuffer.o
  "_mac_sem_wait", referenced from:
      _outputThread in mbuffer.o
      _inputThread in mbuffer.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mbuffer] Error 1


Would be awesome, if you could provide a package for brew.
tristank
 
Posts: 7
Joined: Thu Apr 17, 2014 7:56 am

Re: how to build mbuffer for macox

Postby lundman » Sun Apr 27, 2014 4:55 pm

Ah you need to compile and link in clock-get.c as well, I changed the Makefile to include it, but clearly that failed on your machine.
User avatar
lundman
 
Posts: 1337
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: how to build mbuffer for macox

Postby tristank » Mon Apr 28, 2014 2:07 am

lundman wrote:I changed the Makefile to include it ...


Are the changes already online? I redownloaded you source ball, but it still fails. Is there a git repository?
tristank
 
Posts: 7
Joined: Thu Apr 17, 2014 7:56 am

Re: how to build mbuffer for macox

Postby lundman » Tue Apr 29, 2014 3:39 pm

I tared it up against in case it was an old version.
User avatar
lundman
 
Posts: 1337
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: how to build mbuffer for macox

Postby tristank » Thu May 01, 2014 12:38 pm

Thanks. This time it worked. For everyone which is interessted in mbuffer, here is a nice blogpost to get you started with zfs send and receive.
tristank
 
Posts: 7
Joined: Thu Apr 17, 2014 7:56 am

Re: how to build mbuffer for macox

Postby antikus » Fri May 02, 2014 11:43 am

Thanks guys. I was wondering about that source tarball as well. :) It seems like it's working now.
antikus
 
Posts: 4
Joined: Fri May 02, 2014 11:41 am

Next

Return to General Help

Who is online

Users browsing this forum: No registered users and 13 guests