kozyilmaz / zcash-apple

Zcash for Apple platforms
78 stars 21 forks source link

Failed to build #8

Closed lindanlee closed 6 years ago

lindanlee commented 6 years ago

I've followed the README and I received this error. Help?

checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -mmacosx-version-min=10.8 supports -fno-rtti -fno-exceptions... yes
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -mmacosx-version-min=10.8 option to produce PIC... -fno-common -DPIC
checking if /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -mmacosx-version-min=10.8 PIC flag -fno-common -DPIC works... yes
checking if /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -mmacosx-version-min=10.8 static flag -static works... no
checking if /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -mmacosx-version-min=10.8 supports -c -o file.o... yes
checking if /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -mmacosx-version-min=10.8 supports -c -o file.o... (cached) yes
checking whether the /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -mmacosx-version-min=10.8 linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -mmacosx-version-min=10.8 -stdlib=libc++ -std=c++11 -E
checking for ld used by /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -mmacosx-version-min=10.8 -stdlib=libc++ -std=c++11... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking whether the /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -mmacosx-version-min=10.8 -stdlib=libc++ -std=c++11 linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -mmacosx-version-min=10.8 -stdlib=libc++ -std=c++11 option to produce PIC... -fno-common -DPIC
checking if /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -mmacosx-version-min=10.8 -stdlib=libc++ -std=c++11 PIC flag -fno-common -DPIC works... yes
checking if /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -mmacosx-version-min=10.8 -stdlib=libc++ -std=c++11 static flag -static works... no
checking if /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -mmacosx-version-min=10.8 -stdlib=libc++ -std=c++11 supports -c -o file.o... yes
checking if /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -mmacosx-version-min=10.8 -stdlib=libc++ -std=c++11 supports -c -o file.o... (cached) yes
checking whether the /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -mmacosx-version-min=10.8 -stdlib=libc++ -std=c++11 linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin17.3.0 dyld
checking how to hardcode library paths into programs... immediate
checking for x86_64-apple-darwin17.3.0-ar... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar
checking for x86_64-apple-darwin17.3.0-ranlib... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib
checking for x86_64-apple-darwin17.3.0-strip... no
checking for strip... /usr/bin/strip
checking for x86_64-apple-darwin17.3.0-gcov... no
checking for gcov... /usr/bin/gcov
checking for lcov... no
checking for genhtml... no
checking for git... /usr/bin/git
checking for ccache... /Users/lindanaeunlee/Desktop/zcash-apple-attempt/zcash-apple/zcash/zcash_master/depends/x86_64-apple-darwin17.3.0/share/../native/bin/ccache
checking for xgettext... no
checking for hexdump... /usr/bin/hexdump
checking for x86_64-apple-darwin17.3.0-readelf... no
checking for readelf... no
checking for x86_64-apple-darwin17.3.0-c++filt... no
checking for c++filt... /usr/bin/c++filt
checking whether C++ compiler accepts -Werror... no
configure: error: "enable-werror set but -Werror is not usable"
make[2]: *** [zcash_build] Error 1
make[1]: *** [build] Error 1
make: *** [zcash_all] Error 2
kozyilmaz commented 6 years ago

@lindanlee ~Are you using El Capitan like the previous report by any chance?~

lindanlee commented 6 years ago

@kozyilmaz, I'm using High Sierra.

kozyilmaz commented 6 years ago

Can you please send me the outputs of these two commands below $ cat zcash/zcash_master/config.log |grep enable-werror $ cat zcash/zcash_master/config.log |grep Werror

Can you try with master again? I guess a simple git pull will do. Following commits (https://github.com/kozyilmaz/zcash-apple/commit/00260cf22b342dbf6de0f9fd9cbebd1e88b95ae7 and https://github.com/kozyilmaz/zcash-apple/commit/b972042e6f9572f6434617fc3501707959cedda1) will fix the build for now but I'll look why -Werror is not supported anymore.

lindanlee commented 6 years ago

@kozyilmaz, thanks for the help.

the output for $ cat zcash/zcash_master/config.log |grep enable-werror is :

Serenity-2:zcash-apple lindanaeunlee$ cat zcash/zcash_master/config.log |grep enable-werror
  $ ./configure --prefix=/Users/lindanaeunlee/Desktop/zcash-apple-attempt/zcash-apple/zcash/zcash_master/depends/x86_64-apple-darwin17.3.0/ --host=x86_64-apple-darwin17.3.0 --build=x86_64-apple-darwin17.3.0  --enable-hardening    --enable-proton=no --without-libs --enable-werror CXXFLAGS=-Wno-undefined-var-template -g
configure:18214: error: "enable-werror set but -Werror is not usable"

the output for $ cat zcash/zcash_master/config.log |grep Werror is :

Serenity-2:zcash-apple lindanaeunlee$ cat zcash/zcash_master/config.log |grep Werror
configure:18164: checking whether C++ compiler accepts -Werror
configure:18183: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -mmacosx-version-min=10.8 -stdlib=libc++ -std=c++11 -c -pipe -O2 -Wno-undefined-var-template -g  -Werror -I/Users/lindanaeunlee/Desktop/zcash-apple-attempt/zcash-apple/zcash/zcash_master/depends/x86_64-apple-darwin17.3.0/share/../include/  conftest.cpp >&5
error: unknown warning option '-Wno-undefined-var-template'; did you mean '-Wno-undefined-internal'? [-Werror,-Wunknown-warning-option]
configure:18214: error: "enable-werror set but -Werror is not usable"
ax_cv_check_cxxflags___Werror=no

As you instructed, I ran the following commands afterwards in the zcash-apple directory: git pull source environment PRINT_DEBUG=y make all

I get the following error:

( cd zcash_v1.0.14; \
        LIBTOOLIZE=glibtoolize ./zcutil/build.sh --disable-libs; \
    )
/bin/sh: line 0: cd: zcash_v1.0.14: No such file or directory
/bin/sh: ./zcutil/build.sh: No such file or directory
make[2]: *** [zcash_build] Error 127
make[1]: *** [build] Error 1
make: *** [zcash_all] Error 2
kozyilmaz commented 6 years ago

oh please execute this command in zcash directory $ cd zcash $ rm -rf .cloned .configured .patched zcash-master

then build all

lindanlee commented 6 years ago

I executed: $ cd zcash $ rm -rf .cloned .configured .patched zcash-master

And tried to make again by: source environment PRINT_DEBUG=y make all

It's been building for a while! I'm hopeful... I'll let you know soon.

kozyilmaz commented 6 years ago

Yes it probably will but it was not the correct fix :) I'll commit another patch to fix it for good

Anyway your built binaries will be fine even with current master so no worries

lindanlee commented 6 years ago

Sad! It was building for 25+ minutes or so, and then failed. :(

Do you know what could cause this?

init.cpp:56:10: fatal error: 'libsnark/common/profiling.hpp' file not found
#include <libsnark/common/profiling.hpp>
         ^
2 warnings and 1 error generated.
make[5]: *** [libbitcoin_server_a-init.o] Error 1
make[4]: *** [all-recursive] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [zcash_build] Error 2
make[1]: *** [build] Error 1
make: *** [zcash_all] Error 2
kozyilmaz commented 6 years ago

Hmm @lindanlee I'll fixed the previous issue properly and pushed it to master.

The last one however is really weird. Do you have macports or brew installed (although very unlikely to be the source of such an issue)?

I'll appreciate a clean build (I mean even clone from scratch) with logs (only Zcash will do). Sorry for the trouble and thanks for your patience.

lindanlee commented 6 years ago

@kozyilmaz, thank you so much for the continued assistance.

I do have macports and brew installed, if that makes a difference. I'll try the process from the top following the instructions from https://github.com/kozyilmaz/zcash-apple in a new directory.

kozyilmaz commented 6 years ago

Unfortunately macports and brew cause too much trouble, I'll try to limit the interference but sometimes it is impossible. If both are present can you also post the results of the following commands too?

$ gcc -v
$ g++ -v
$ clang -v
$ which autoconf
$ which automake
$ which libtool
$ autoconf --version
$ automake --version

Thanks again!

lindanlee commented 6 years ago

I made another directory, and ran the following commands:

git clone https://github.com/kozyilmaz/zcash-apple.git
cd zcash-apple
source environment
PRINT_DEBUG=y make all

It's still building--I'll let you know if it succeeds.

In another tab, in the zcash-apple directory I am building in,, I ran the commands you suggested:

for gcc -v:

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

for g++ -v:

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

for clang -v:

Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin17.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

for which autoconf: /Users/lindanaeunlee/Desktop/zcash-apple-attempt-2/zcash-apple/tools/o/bin/autoconf

for which automake: /Users/lindanaeunlee/Desktop/zcash-apple-attempt-2/zcash-apple/tools/o/bin/automake

for which libtool: /usr/bin/libtool

for autoconf --version:

autoconf (GNU Autoconf) 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+/Autoconf: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David J. MacKenzie and Akim Demaille.

for automake --version:

automake (GNU automake) 1.15.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey <tromey@redhat.com>
       and Alexandre Duret-Lutz <adl@gnu.org>.

Those last two seem concerning. but maybe I shouldn't have run them while things were still building; maybe they haven't been downloaded yet. :o

kozyilmaz commented 6 years ago

No worries, it is fine. If you would have run source environment in zcash-apple directory first, autoconf/automake commands will return correctly but again, it is just fine.

lindanlee commented 6 years ago

@kozyilmaz, I updated the results above by running the command after running source environment.

The build failed again:

init.cpp:56:10: fatal error: 'libsnark/common/profiling.hpp' file not found
#include <libsnark/common/profiling.hpp>
         ^
1 error generated.
make[5]: *** [libbitcoin_server_a-init.o] Error 1
make[4]: *** [all-recursive] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [zcash_build] Error 2
make[1]: *** [build] Error 1
make: *** [zcash_all] Error 2

I pulled after the build and confirmed that it was up to date.

Hmm, do you have additional ideas of what I should do? Or do you have an idea of what could be causing this?

kozyilmaz commented 6 years ago

can you please paste (or copy to a text file and attach) the complete Zcash build log?

lindanlee commented 6 years ago

It's so long that it was truncated in my terminal, but here's the last bit of it.

terminal-build-output.txt

kozyilmaz commented 6 years ago

@lindanlee There are a lot of errors present (see log below) but I know for certain that it is not possible to build Zcash with earlier clang versions like yours. Latest clang that came with Xcode 9 fixed the template related issues and after this commit https://github.com/kozyilmaz/zcash-apple/commit/3613b572f75fa82394cff4962559ff5df2f0d920 on December 1st it was possible to build natively with clang

So I recommend you to upgrade Xcode/Command Line Tools to latest first. I can confirm that this version below works. Is it possible for you to update Xcode?

$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/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-darwin16.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Found CUDA installation: /usr/local/cuda, version unknown

Build errors here:

Making all in src
CXXFLAGS="-fPIC -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1 -fstack-protector-all" /Applications/Xcode.app/Contents/Developer/usr/bin/make  -C snark/ install PREFIX=./build DEPINST="/Users/lindanaeunlee/Desktop/zcash-apple-attempt-2/zcash-apple/zcash/zcash_v1.0.14/depends/x86_64-apple-darwin17.3.0/share/.." CURVE=ALT_BN128 NO_PROCPS=1 NO_DOCS=1 STATIC=1 NO_SUPERCOP=1 FEATUREFLAGS=-DMONTGOMERY_OUTPUT NO_COPY_DEPINST=1 NO_COMPILE_LIBGTEST=1  OPTFLAGS="-O2 -march=x86-64"
c++ -o src/algebra/curves/alt_bn128/alt_bn128_g1.o   src/algebra/curves/alt_bn128/alt_bn128_g1.cpp -c -MMD -fPIC -DBINARY_OUTPUT -DNO_PT_COMPRESSION=1 -fstack-protector-all -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wno-comment -Wfatal-errors -O2 -march=x86-64 -DMONTGOMERY_OUTPUT -DCURVE_ALT_BN128 -I/Users/lindanaeunlee/Desktop/zcash-apple-attempt-2/zcash-apple/zcash/zcash_v1.0.14/depends/x86_64-apple-darwin17.3.0/share/../include -Isrc -DNO_PROCPS -static -DSTATIC
src/algebra/curves/alt_bn128/alt_bn128_g1.cpp:411:9: fatal error: invalid operands to binary expression
      ('std::ostream' (aka 'basic_ostream<char>') and 'alt_bn128_Fq' (aka 'Fp_model<alt_bn128_q_limbs,
      alt_bn128_modulus_q>'))
    out << copy.X << OUTPUT_SEPARATOR << copy.Y;
    ~~~ ^  ~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ostream:207:20: note: 
      candidate function not viable: no known conversion from 'alt_bn128_Fq' (aka 'Fp_model<alt_bn128_q_limbs,
      alt_bn128_modulus_q>') to 'const void *' for 1st argument; take the address of the argument with &
    basic_ostream& operator<<(const void* __p);
                   ^
lindanlee commented 6 years ago

@kozyilmaz, thanks. I've updated:

Serenity-2:zcash-apple lindanaeunlee$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Serenity-2:zcash-apple lindanaeunlee$ softwareupdate --list
Software Update Tool

Finding available software
Software Update found the following new or updated software:
   * macOS High Sierra 10.13.2 Supplemental Update- 
    macOS High Sierra 10.13.2 Supplemental Update ( ), 138293K [recommended] [restart]
Serenity-2:zcash-apple lindanaeunlee$ softwareupdate --install -a
Software Update Tool

Finding available software

Downloading macOS High Sierra 10.13.2 Supplemental Update
Downloaded macOS High Sierra 10.13.2 Supplemental Update
Installing macOS High Sierra 10.13.2 Supplemental Update
Done.

You have installed one or more updates that requires that you restart your
computer.  Please restart immediately.

I'll restart my computer and try building again in a new directory.

kozyilmaz commented 6 years ago

Great! Hopefully this time. Can you please paste $ gcc -v output to make sure?

lindanlee commented 6 years ago

I restarted my

Here's the gcc -v output:

Serenity-2:zcash-apple lindanaeunlee$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin17.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

It doesn't look like the anything changed. But now, if I try to upgrade, there are no upgrades.

Serenity-2:zcash-apple lindanaeunlee$ softwareupdate --list
Software Update Tool

Finding available software
No new software available.
Serenity-2:zcash-apple lindanaeunlee$ softwareupdate --install -a
Software Update Tool

Finding available software
No updates are available.

This is strange.

kozyilmaz commented 6 years ago

Strange indeed, do you have an Xcode installation? Checked mine and Xcode version is "Version 9.2 (9C40b)"

lindanlee commented 6 years ago

I thought I downloaded all the updates in the command line, but when I check the app on my computer, it's quite old, 8.2.1. I'll try to update the app and try again.

lindanlee commented 6 years ago

I've updated xcode; I'll try building later tonight. If it doesn't work, I'll try on another computer (I just got a new macbook, so it'll be a couple days until I set it up/try again).

Thanks for so much of your help!

lindanlee commented 6 years ago

I'll update you on if that works, when I do it. :)

kozyilmaz commented 6 years ago

Sure, please do. Sorry for the trouble!

lindanlee commented 6 years ago

I tried it after updating xcode, I got it to work on my old computer. :) Thanks for all the help!

image