Page MenuHomePhabricator

Build broken on MacOS X
Closed, ResolvedPublic

Description

This error does not seem to happen under the linux builds, although both src/Makefiles contain the following line:

libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)

On MacOS X removing -no-undefined from src/Makefile.am fixes the problem, or adding uint256.h and uint256.cpp to the libbitcoinconsensus_a_SOURCES variable.

Neither of these solutions seem particularly good. With the first, the sources are compiled twice and there may be duplicate symbols in some of the libraries. In the second case, the shared library may not be useful unless libbitcoin_util.a is also linked against.

The error is:

  CXXLD    libbitcoinconsensus.la
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
Undefined symbols for architecture x86_64:
  "base_blob<256u>::ToString() const", referenced from:
      CBlock::ToString() const in libbitcoinconsensus_la-block.o
      COutPoint::ToString() const in libbitcoinconsensus_la-transaction.o
      CTransaction::ToString() const in libbitcoinconsensus_la-transaction.o
  "base_blob<256u>::GetHex() const", referenced from:
      base_uint<256u>::GetHex() const in libbitcoinconsensus_la-arith_uint256.o
      base_uint<256u>::ToString() const in libbitcoinconsensus_la-arith_uint256.o
  "base_blob<256u>::SetHex(char const*)", referenced from:
      base_uint<256u>::base_uint(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libbitcoinconsensus_la-arith_uint256.o
      base_uint<256u>::SetHex(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libbitcoinconsensus_la-arith_uint256.o
      base_uint<256u>::base_uint(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libbitcoinconsensus_la-arith_uint256.o
      base_uint<256u>::SetHex(char const*) in libbitcoinconsensus_la-arith_uint256.o
      SignatureHash(CScript const&, CTransaction const&, unsigned int, unsigned int, Amount, PrecomputedTransactionData const*, unsigned int) in libbitcoinconsensus_la-interpreter.o
ld: symbol(s) not found for architecture x86_64

Event Timeline

Is this fixed already? I built in macos the current master (88232d52a91478c9cc765ea6de0bc4ac44c35ede) and built on osx 10.13.2 without problems.

schancel claimed this task.

It would be nice not to have to include the files in two different places, but yes it's fixed.