Bug 213930 (zcash)

Summary: net-p2p/zcash: create initial port and package
Product: Ports & Packages Reporter: grarpamp
Component: Individual Port(s)Assignee: Kubilay Kocak <koobs>
Status: Closed Feedback Timeout    
Severity: Affects Some People CC: freebsd, grarpamp, nullius, peter, radix42, rednull, rehak
Priority: --- Keywords: feature, needs-patch
Version: Latest   
Hardware: amd64   
OS: Any   
URL: https://z.cash/
Attachments:
Description Flags
Add support for FreeBSD none

Description grarpamp 2016-10-31 02:27:09 UTC
https://z.cash/
https://github.com/zcash/zcash
http://zerocash-project.org/

A FreeBSD port and package of zcash should be created.
Comment 1 rednull 2016-10-31 14:15:49 UTC
I tried to build it manually with no success. Boost, GMP and other deps installed from ports, you would also need openssl-devel port because of some new EDCSA defs, libsnark lib builds ok with clang3.4. But zcash compile with clang fails with some "ambiguous error", the same failure with clang3.4 and 3.8:


/bin/sh ../libtool  --tag=CXX   --mode=compile clang++ -DHAVE_CONFIG_H -I. -I../src/config  -I/usr/include/crypto -I./obj -DBUILD_BITCOIN_INTERNAL -I/usr/local/libsnark/include/libsnark -I/usr/local/libsnark/include -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2  -std=c++11 -I/usr/local/include -I/usr/local/include/db6 -I/usr/local/libsnark/include -I/usr/local/include/openssl -fwrapv -fno-strict-aliasing -g  -Wformat -Wformat-security -Wstack-protector -fstack-protector-all -fPIE -MT primitives/libzcashconsensus_la-transaction.lo -MD -MP -MF primitives/.deps/libzcashconsensus_la-transaction.Tpo -c -o primitives/libzcashconsensus_la-transaction.lo `test -f 'primitives/transaction.cpp' || echo './'`primitives/transaction.cpp
libtool: compile:  clang++ -DHAVE_CONFIG_H -I. -I../src/config -I/usr/include/crypto -I./obj -DBUILD_BITCOIN_INTERNAL -I/usr/local/libsnark/include/libsnark -I/usr/local/libsnark/include -DBOOST_SPIRIT_THREADSAFE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -std=c++11 -I/usr/local/include -I/usr/local/include/db6 -I/usr/local/libsnark/include -I/usr/local/include/openssl -fwrapv -fno-strict-aliasing -g -Wformat -Wformat-security -Wstack-protector -fstack-protector-all -MT primitives/libzcashconsensus_la-transaction.lo -MD -MP -MF primitives/.deps/libzcashconsensus_la-transaction.Tpo -c primitives/transaction.cpp  -fPIC -DPIC -o primitives/libzcashconsensus_la-transaction.o
In file included from primitives/transaction.cpp:6:
In file included from ./primitives/transaction.h:9:
In file included from ./amount.h:9:
./serialize.h:653:9: error: call to 'Serialize' is ambiguous
        ::Serialize(os, (*vi), nType, nVersion);
        ^~~~~~~~~~~
./serialize.h:659:5: note: in instantiation of function template specialization 'Serialize_impl<CSizeComputer, bool, std::__1::allocator<bool>, bool>' requested here
    Serialize_impl(os, v, nType, nVersion, T());
    ^
./serialize.h:653:11: note: in instantiation of function template specialization 'Serialize<CSizeComputer, bool, std::__1::allocator<bool> >' requested here
        ::Serialize(os, (*vi), nType, nVersion);
          ^
./serialize.h:659:5: note: in instantiation of function template specialization 'Serialize_impl<CSizeComputer, std::__1::vector<bool, std::__1::allocator<bool> >, std::__1::allocator<std::__1::vector<bool, std::__1::allocator<bool> > >,
      std::__1::vector<bool, std::__1::allocator<bool> > >' requested here
    Serialize_impl(os, v, nType, nVersion, T());
    ^
./serialize.h:952:7: note: in instantiation of function template specialization 'Serialize<CSizeComputer, std::__1::vector<bool, std::__1::allocator<bool> >, std::__1::allocator<std::__1::vector<bool, std::__1::allocator<bool> > > >'
      requested here
    ::Serialize(s, obj, nType, nVersion);
      ^
./zcash/IncrementalMerkleTree.hpp:24:9: note: in instantiation of function template specialization 'SerReadWrite<CSizeComputer, std::__1::vector<std::__1::vector<bool, std::__1::allocator<bool> >,
      std::__1::allocator<std::__1::vector<bool, std::__1::allocator<bool> > > > >' requested here
        READWRITE(authentication_path);
        ^
./serialize.h:167:32: note: expanded from macro 'READWRITE'
#define READWRITE(obj)      (::SerReadWrite(s, (obj), nType, nVersion, ser_action))
                               ^
./zcash/IncrementalMerkleTree.hpp:20:5: note: in instantiation of function template specialization 'libzcash::MerklePath::SerializationOp<CSizeComputer, CSerActionSerialize>' requested here
    ADD_SERIALIZE_METHODS;
    ^
./serialize.h:178:27: note: expanded from macro 'ADD_SERIALIZE_METHODS'
        NCONST_PTR(this)->SerializationOp(s, CSerActionSerialize(), nType, nVersion);\
                          ^
./serialize.h:230:39: note: candidate function [with Stream = CSizeComputer]
template<typename Stream> inline void Serialize(Stream& s, bool a, int, int=0)    { char f=a; ser_writedata8(s, f); }
                                      ^
./serialize.h:210:39: note: candidate function [with Stream = CSizeComputer]
template<typename Stream> inline void Serialize(Stream& s, int32_t a,      int, int=0) { ser_writedata32(s, a); }
                                      ^
./serialize.h:205:39: note: candidate function [with Stream = CSizeComputer]
template<typename Stream> inline void Serialize(Stream& s, char a,         int, int=0) { ser_writedata8(s, a); } // TODO Get rid of bare char
                                      ^
./serialize.h:206:39: note: candidate function [with Stream = CSizeComputer]
template<typename Stream> inline void Serialize(Stream& s, int8_t a,       int, int=0) { ser_writedata8(s, a); }
                                      ^
./serialize.h:207:39: note: candidate function [with Stream = CSizeComputer]
template<typename Stream> inline void Serialize(Stream& s, uint8_t a,      int, int=0) { ser_writedata8(s, a); }
                                      ^
./serialize.h:208:39: note: candidate function [with Stream = CSizeComputer]
template<typename Stream> inline void Serialize(Stream& s, int16_t a,      int, int=0) { ser_writedata16(s, a); }
                                      ^
./serialize.h:209:39: note: candidate function [with Stream = CSizeComputer]
template<typename Stream> inline void Serialize(Stream& s, uint16_t a,     int, int=0) { ser_writedata16(s, a); }
                                      ^
./serialize.h:211:39: note: candidate function [with Stream = CSizeComputer]
template<typename Stream> inline void Serialize(Stream& s, uint32_t a,     int, int=0) { ser_writedata32(s, a); }
                                      ^
./serialize.h:212:39: note: candidate function [with Stream = CSizeComputer]
template<typename Stream> inline void Serialize(Stream& s, int64_t a,      int, int=0) { ser_writedata64(s, a); }
                                      ^
./serialize.h:213:39: note: candidate function [with Stream = CSizeComputer]
template<typename Stream> inline void Serialize(Stream& s, uint64_t a,     int, int=0) { ser_writedata64(s, a); }
                                      ^
./serialize.h:214:39: note: candidate function [with Stream = CSizeComputer]
template<typename Stream> inline void Serialize(Stream& s, float a,        int, int=0) { ser_writedata32(s, ser_float_to_uint32(a)); }
                                      ^
./serialize.h:215:39: note: candidate function [with Stream = CSizeComputer]
template<typename Stream> inline void Serialize(Stream& s, double a,       int, int=0) { ser_writedata64(s, ser_double_to_uint64(a)); }
                                      ^
./serialize.h:572:13: note: candidate function [with Stream = CSizeComputer, T = std::__1::__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool> > >]
inline void Serialize(Stream& os, const T& a, long nType, int nVersion)
            ^
1 error generated.
gmake[2]: *** [Makefile:6153: primitives/libzcashconsensus_la-transaction.lo] Error 1
gmake[2]: Leaving directory '/root/src/zcash/src'
gmake[1]: *** [Makefile:7452: all-recursive] Error 1
gmake[1]: Leaving directory '/root/src/zcash/src'
gmake: *** [Makefile:640: all-recursive] Error 1
Comment 2 David Mercer 2016-10-31 16:59:59 UTC
(In reply to rednull from comment #1)
This is the network serialization code that zcash inherited from bitcoin. Various different compilers (gcc5/6) on different non-linux platforms (OS X and Windows, native and cross compiled) are all hitting the same thing. 

I've been able to compile most of the source by manually compiling with somewhat different command line options that those generated by autoconf/configure. I'm going to post a "Call for C++ expertise" on the zcash forum and twitter to see if I can shake anyone out of the woodwork to help clean up the code in question, as of right now zcash only builds on a very narrow range of combinations of linux and compiler version.
Comment 3 Peter Zuidema 2017-06-01 18:20:30 UTC
Also tried a manual installation of zcash (prior to finding this thread)
I used the https://github.com/zcash/zcash/wiki/1.0-User-Guide as a guide line.

I also failed to produce a running package. The issues I ran into where the following
- flock is missing on a base systems (cheated this by editing the script)
- sha256sum is not installed (symlink to gsha256sum did the trick)
- the build script needs to be started with MAKE=gmake I have gcc5 installed from ports
- script calls "install -D" should be "ginstall -D" to have the linux compatible variant
- linker issues due to -ldl (removed this)

then I ran into cpp compiler issues.

Hope this helps in someway
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2017-06-02 00:10:57 UTC
I'll take this as I've been speaking with David Mercer (developer) about getting a FreeBSD port created.

One issue is that libsnark does not support Clang yet, but it may be possible in the short-term to create a port that depends on GCC.

If anybody has contributions or feedback to provide on either their testing of building zcash on FreeBSD or the port itself, please create attachments. 

For build failures/errors, please also use attachments, and not comments.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2020-05-18 02:01:38 UTC
This needs a QA'd patch to progress. If you are able to produce a patch, please re-open this issue with an QA'd attachment.
Comment 6 Alex Wied 2021-01-05 22:49:11 UTC
Created attachment 221310 [details]
Add support for FreeBSD

Related:

https://github.com/zcash/zcash/pull/4937