kozyilmaz / zcash-apple

Zcash for Apple platforms
78 stars 21 forks source link

Build Failing #4

Closed hoffmabc closed 6 years ago

hoffmabc commented 6 years ago

I've followed the README and receive this error:

iMac:zcash-apple brianhoffman$ make
  CLONE      autoconf
  CONFIG     autoconf
  BUILD      autoconf
  INSTALL    autoconf
  CLONE      automake
  CONFIG     automake
  BUILD      automake
  INSTALL    automake
  CLONE      libtool
  CONFIG     libtool
  BUILD      libtool
  INSTALL    libtool
  CLONE      pkgconfig
  CONFIG     pkgconfig
  BUILD      pkgconfig
make[2]: *** [build] Error 1
make[1]: *** [pkgconfig_all] Error 2
make: *** [tools_all] Error 2
iMac:zcash-apple brianhoffman$
kozyilmaz commented 6 years ago

@hoffmabc can you try with debug enabled? $ PRINT_DEBUG=y make all

hoffmabc commented 6 years ago

Relevant error part

  CLONE      pkgconfig
  CONFIG     pkgconfig
  BUILD      pkgconfig
make -C pkg-config-"0.29.2" -j 4
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in glib
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in .
make[8]: Nothing to be done for `all-am'.
Making all in m4macros
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
make[9]: Nothing to be done for `all-am'.
Making all in glib
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in libcharset
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
make[11]: Nothing to be done for `all-am'.
Making all in .
make[10]: Nothing to be done for `all-am'.
Making all in .
  CCLD     pkg-config
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      _g_iconv in libglib-2.0.a(libglib_2_0_la-gconvert.o)
      _g_convert_with_iconv in libglib-2.0.a(libglib_2_0_la-gconvert.o)
      _g_convert_with_fallback in libglib-2.0.a(libglib_2_0_la-gconvert.o)
  "_libiconv_close", referenced from:
      _g_iconv_close in libglib-2.0.a(libglib_2_0_la-gconvert.o)
      _g_convert in libglib-2.0.a(libglib_2_0_la-gconvert.o)
      _g_convert_with_fallback in libglib-2.0.a(libglib_2_0_la-gconvert.o)
      _g_filename_display_name in libglib-2.0.a(libglib_2_0_la-gconvert.o)
  "_libiconv_open", referenced from:
      _g_iconv_open in libglib-2.0.a(libglib_2_0_la-gconvert.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[6]: *** [pkg-config] Error 1
make[5]: *** [all-recursive] Error 1
make[4]: *** [all] Error 2
make[3]: *** [pkgconfig_build] Error 2
make[2]: *** [build] Error 1
make[1]: *** [pkgconfig_all] Error 2
make: *** [tools_all] Error 2
hoffmabc commented 6 years ago

Is it because I'm using clang instead of gcc?

kozyilmaz commented 6 years ago

no, I just made a clean Zcash build myself and these are just the tools so they should get built using native clang. Do you have brew installed?

Can you also paste:

$ sw_vers
and
$ gcc -v
hoffmabc commented 6 years ago
 iMac:zcash-apple brianhoffman$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.12.6
BuildVersion:   16G29
iMac:zcash-apple brianhoffman$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/7.2.0/libexec/gcc/x86_64-apple-darwin16.7.0/7.2.0/lto-wrapper
Target: x86_64-apple-darwin16.7.0
Configured with: ../configure --build=x86_64-apple-darwin16.7.0 --prefix=/usr/local/Cellar/gcc/7.2.0 --libdir=/usr/local/Cellar/gcc/7.2.0/lib/gcc/7 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-7 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --enable-checking=release --with-pkgversion='Homebrew GCC 7.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-nls
Thread model: posix
gcc version 7.2.0 (Homebrew GCC 7.2.0)
kozyilmaz commented 6 years ago

It seems you are using brew's gcc-7.2.0 to build, overridden macOS's native clang. Possibly a libiconv dependency sneaked in because of this. Let me look into it.

hoffmabc commented 6 years ago

ok thanks

kozyilmaz commented 6 years ago

sorry, can you please paste the output of this too? $ cat tools/pkgconfig/pkg-config-0.29.2/glib/config.h | grep ICONV

hoffmabc commented 6 years ago
iMac:zcash-apple brianhoffman$ cat tools/pkgconfig/pkg-config-0.29.2/glib/config.h | grep ICONV
/* #undef USE_LIBICONV_GNU */
#define USE_LIBICONV_NATIVE 1
hoffmabc commented 6 years ago

Ok I had macports installed. Once I removed it I was able to build properly.

sudo rm -rf \
        /opt/local \
        /Applications/DarwinPorts \
        /Applications/MacPorts \
        /Library/LaunchDaemons/org.macports.* \
        /Library/Receipts/DarwinPorts*.pkg \
        /Library/Receipts/MacPorts*.pkg \
        /Library/StartupItems/DarwinPortsStartup \
        /Library/Tcl/darwinports1.0 \
        /Library/Tcl/macports1.0 \
        ~/.macports
kozyilmaz commented 6 years ago

Can you copy this patch pkgconfig.patch.txt to zcash-apple directory and execute commands below. Thanks for the help!

$ rm -rf tools/pkgconfig/.built tools/pkgconfig/.configured tools/pkgconfig/.patched tools/pkgconfig/.cloned tools/pkgconfig/pkg-config-0.29.2
$ mv pkgconfig.patch.txt pkgconfig.patch
$ patch -p1 < pkgconfig.patch 
$ PRINT_DEBUG=y make all
kozyilmaz commented 6 years ago

@hoffmabc ah I missed it!