PoC-Consortium / engraver

PoCC Burstcoin Reference Plotter
MIT License
63 stars 39 forks source link

Build fails on Mac OS 10.13.3 (High Sierra) #23

Closed bitmelt closed 6 years ago

bitmelt commented 6 years ago

When building by following the instructions:

$ git clone https://github.com/PoC-Consortium/cg_obup
Cloning into 'cg_obup'...
remote: Counting objects: 214, done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 214 (delta 43), reused 70 (delta 39), pack-reused 134
Receiving objects: 100% (214/214), 112.51 KiB | 3.88 MiB/s, done.
Resolving deltas: 100% (127/127), done.

$ cd cg_obup/

$ make

The following warnings and errors are produced:

$ make
gcc -Wall -m64 -c -o shabal64-darwin.o shabal64-darwin.s
gcc -D OSX -D AMD64 -Wall -m64 -O3 -mtune=native -D_FILE_OFFSET_BITS=64 -c -o helper64.o helper.c
gcc -D OSX -D AMD64 -Wall -m64 -O3 -mtune=native -D_FILE_OFFSET_BITS=64 -c -o mshabal_sse4.o mshabal_sse4.c
gcc -D OSX -D AMD64 -Wall -m64 -O3 -mtune=native -D_FILE_OFFSET_BITS=64 -mavx2 -c -o mshabal256_avx2.o mshabal256_avx2.c
gcc -D OSX -D AMD64 -Wall -m64 -O3 -mtune=native -D_FILE_OFFSET_BITS=64 -o plot64 plot.c shabal64-darwin.o helper64.o mshabal_sse4.o mshabal256_avx2.o -lpthread -std=gnu99
plot.c:88:49: warning: format specifies type 'int' but the argument has type 'off_t' (aka 'long long') [-Wformat]
        printf("Allocating file of size %d.\n", len);
                                        ~~      ^~~
                                        %lld
plot.c:423:10: warning: implicit declaration of function 'lseek64' is invalid in C99 [-Wimplicit-function-declaration]
    if ( lseek64(ofd, -sizeof run, SEEK_END) < 0 ) {
         ^
plot.c:754:66: warning: format specifies type 'long' but the argument has type 'uint64_t' (aka 'unsigned long long')
      [-Wformat]
        printf("Resuming at nonce %ld with staggersize %d...\n", startnonce, staggersize);
                                  ~~~                            ^~~~~~~~~~
                                  %llu
plot.c:759:66: warning: format specifies type 'long' but the argument has type 'uint64_t' (aka 'unsigned long long')
      [-Wformat]
        printf("Pre-allocating space for file (%ld bytes)...\n", filesize);
                                               ~~~               ^~~~~~~~
                                               %llu
4 warnings generated.
Undefined symbols for architecture x86_64:
  "_lseek64", referenced from:
      _writestatus in plot-56a913.o
      _main in plot-56a913.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: *** [plot64] Error 1

Environment (Mac OS 10.13.3):

$ uname -a
Darwin tungsten.local 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ make --version
GNU Make 3.81
Copyright (C) 2006  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.

This program built for i386-apple-darwin11.3.0
rico666 commented 6 years ago

The warnings I can fix, but the linker error ... looks like your libc was compiled without large file support Ok - obviously you have a 64bit architecture... so not sure what the problem there is.

bitmelt commented 6 years ago

It looks like like there's a macro (LSEEK) that should be used instead of lseek64 directly. Created a pull request #28 . Tests pass.

rico666 commented 6 years ago

merged. Should compile now