EdgeApp / airbitz-core

Bitcoin wallet C/C++ API for building cross-platform applications that require user authentication, encryption, backup, and meta-data management. This library alone implements the full functionality of the Airbitz Edge Security platform and bitcoin wallet minus the graphical interface.
https://airbitz.co
Other
81 stars 43 forks source link

Cannot Compile Under MacOS 10.14 Mojave. #29

Closed wolfmcnally closed 5 years ago

wolfmcnally commented 5 years ago

I am attempting to compile airbitz-core under Mojave. Actually I want to experiment with a minimal build of libbitcoin right now, and your infrastructure for building libbitcoin for iOS looks fairly straightforward. Except, I'm running into compile errors. I am running MacOS 10.14 (Mojave.) I am using the latest Xcode (10.0) with the command line tools installed. I've installed all the other build prerequisites via Brew. Here's what I see for a basic build:

$ make abc.ios-universal
Running zlib.write-tasks
Running zeromq.write-tasks
Running protobuf.write-tasks
Running openssl.write-tasks
Running ndk.write-tasks
Running libsodium.write-tasks
Running libsecp256k1.write-tasks
Running libqrencode.write-tasks
Running libgit2.write-tasks
Running libcsv.write-tasks
Running libbitcoin.write-tasks
Running jansson.write-tasks
Running curl.write-tasks
Running boost.write-tasks
Running abc.write-tasks
Running abc.download
Running curl.download
Running openssl.download
Running zlib.download
Running zlib.build-ios-armv7
Running openssl.build-ios-armv7
Running curl.build-ios-armv7
Task failed (see build/curl/build-ios-armv7.log for full logs):
================================
  CC       libcurl_la-sendf.lo
  CC       libcurl_la-ftp.lo
  CC       libcurl_la-url.lo
url.c:55:2: error: "We can't compile without socket() support!"
#error "We can't compile without socket() support!"
 ^
1 error generated.
make[3]: *** [libcurl_la-url.lo] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
================================
make: *** [build/curl/build-ios-armv7.done] Error 2

The more complete build-ios-armv7.log contains:

configure: Configured to build curl/libcurl:

  curl version:     7.50.3
  Host setup:       arm-apple-darwin10
  Install prefix:   /Users/ironwolf/DevProjects/airbitz-core/deps/build/prefix/ios/armv7
  Compiler:         clang
  SSL support:      enabled (OpenSSL)
  SSH support:      no      (--with-libssh2)
  zlib support:     enabled
  GSS-API support:  no      (--with-gssapi)
  TLS-SRP support:  enabled
  resolver:         default (--enable-ares / --enable-threaded-resolver)
  IPv6 support:     enabled
  Unix sockets support: enabled
  IDN support:      no      (--with-{libidn,winidn})
  Build libcurl:    Shared=no, Static=yes
  Built-in manual:  enabled
  --libcurl option: enabled (--disable-libcurl-option)
  Verbose errors:   enabled (--disable-verbose)
  SSPI support:     no      (--enable-sspi)
  ca cert bundle:   no
  ca cert path:     no
  ca fallback:      no
  LDAP support:     no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)
  LDAPS support:    no      (--enable-ldaps)
  RTSP support:     enabled
  RTMP support:     no      (--with-librtmp)
  metalink support: no      (--with-libmetalink)
  PSL support:      no      (libpsl not found)
  HTTP2 support:    disabled (--with-nghttp2)
  Protocols:        DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP

Making all in lib
make  all-am
  CC       libcurl_la-file.lo
  CC       libcurl_la-timeval.lo
  CC       libcurl_la-base64.lo
  CC       libcurl_la-hostip.lo
  CC       libcurl_la-progress.lo
  CC       libcurl_la-formdata.lo
  CC       libcurl_la-cookie.lo
  CC       libcurl_la-http.lo
  CC       libcurl_la-sendf.lo
  CC       libcurl_la-ftp.lo
  CC       libcurl_la-url.lo
url.c:55:2: error: "We can't compile without socket() support!"
#error "We can't compile without socket() support!"
 ^
1 error generated.
make[3]: *** [libcurl_la-url.lo] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1

OK, so maybe I don't need libcurl, because I really only want a build of libbitcoin, which only depends on boost and libsec256pk1:

$ make libbitcoin.ios-universal
Running libbitcoin.download
Running boost.download
Running boost.build-ios-armv7
Task failed (see build/boost/build-ios-armv7.log for full logs):
================================
Unpacking download/boost_1_62_0.tar.bz2 to build/boost/ios-armv7...
Patching boost...
patching file boost/config/user.hpp
Bootstrapping boost...
Building Boost.Build engine with toolset darwin... 
Failed to build Boost.Build build engine
Consult 'bootstrap.log' for more details
================================
make: *** [build/boost/build-ios-armv7.done] Error 1

Hm, so boost won't bootstrap. Looking at its log at ./build/boost/ios-armv7/boost_1_62_0/bootstrap.log:

###
### Using 'darwin' toolset.
###
rm -rf bootstrap
mkdir bootstrap
cc -o bootstrap/jam0 command.c compile.c constants.c debug.c execcmd.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathsys.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c pathunix.c
In file included from command.c:17:
./jam.h:333:10: fatal error: 'sys/types.h' file not found
#include <sys/types.h>
         ^~~~~~~~~~~~~
1 error generated.
In file included from compile.c:23:
./jam.h:333:10: fatal error: 'sys/types.h' file not found
#include <sys/types.h>
         ^~~~~~~~~~~~~
1 error generated.
In file included from debug.c:8:
./jam.h:333:10: fatal error: 'sys/types.h' file not found
#include <sys/types.h>
         ^~~~~~~~~~~~~
1 error generated.
...

So the bootstrap script can't find <sys/types.h>.

Does anything build?

$ make libsecp256k1.ios-universal
Running libsecp256k1.download
Running libsecp256k1.build-ios-armv7
Running libsecp256k1.build-ios-armv7s
Running libsecp256k1.build-ios-arm64
Running libsecp256k1.build-ios-i386
Running libsecp256k1.build-ios-x86_64
Running libsecp256k1.ios-universal
$ lipo -info build/libsecp256k1/ios-universal/lib/libsecp256k1.a 
Architectures in the fat file: build/libsecp256k1/ios-universal/lib/libsecp256k1.a are: armv7 armv7s i386 x86_64 arm64 

So libsecp256k1 has no problem building.

Can you at least point me in the direction of a fix or workaround? Thank you!

— Wolf

wolfmcnally commented 5 years ago

This is an duplicate of issue #30. Apologies— for a minute I thought GitHub had eaten my previous submission and took the time to re-type it.