Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building for macOS (ARM) #686

Open
gubatron opened this issue Oct 23, 2024 · 20 comments
Open

Building for macOS (ARM) #686

gubatron opened this issue Oct 23, 2024 · 20 comments
Assignees
Labels

Comments

@gubatron
Copy link

gubatron commented Oct 23, 2024

configure:

$ ./configure CXXFLAGS="-std=c++20" --with-boost=$BOOST_ROOT --with-boost-libdir=/opt/homebrew/Cellar/boost/1.76.0/lib --with-boost-includedir=/opt/homebrew/Cellar/boost/1.76.0/include

make:

$ make -j10 CXXFLAGS='-std=c++20 -w -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT'
 cd . && /bin/sh /Users/gubatron/workspace/libbitcoin-node/build-aux/missing automake-1.17 --gnu Makefile
 cd . && /bin/sh ./config.status Makefile depfiles
config.status: creating Makefile
config.status: executing depfiles commands
  CXX      console/bn-executor.o
  CXX      console/bn-main.o
  CXX      src/libbitcoin_node_la-full_node.lo
  CXX      src/libbitcoin_node_la-parser.lo
  CXX      src/chasers/libbitcoin_node_la-chaser.lo
  CXX      src/chasers/libbitcoin_node_la-chaser_block.lo
  CXX      src/chasers/libbitcoin_node_la-chaser_check.lo
  CXX      src/chasers/libbitcoin_node_la-chaser_confirm.lo
  CXX      src/chasers/libbitcoin_node_la-chaser_header.lo
  CXX      src/chasers/libbitcoin_node_la-chaser_snapshot.lo
src/chasers/chaser_check.cpp:66:11: error: no member named 'merge' in 'libbitcoin::database::associations'
   66 |     half->merge(index, index.begin(), end);
      |     ~~~~~~^
1 error generated.
make: *** [src/chasers/libbitcoin_node_la-chaser_check.lo] Error 1
make: *** Waiting for unfinished jobs....
  CXX      src/chasers/libbitcoin_node_la-chaser_storage.lo

At chaser_check.cpp:

// static                                                                                                                                                                                    
map_ptr chaser_check::split(const map_ptr& map) NOEXCEPT
{
    const auto half = empty_map();
    auto& index = map->get<association::pos>();
    const auto end = std::next(index.begin(), to_half(map->size()));
    half->merge(index, index.begin(), end);
    return half;
}

offending line, a call to merge...
half->merge(index, index.begin(), end);

half is a map_ptr, which I believe is a shared pointer to a database::associations:

typedef std::shared_ptr<database::associations> map_ptr;

defined at node/define.hpp

which is in turn a class that extends from a hashed and ordered keys based boost::multi_index_container

typedef boost::multi_index_container
<
    association,
    boost::multi_index::indexed_by
    <
        boost::multi_index::hashed_unique
        <
            boost::multi_index::tag<association::key>,
            boost::multi_index::key<&association::hash>
        >,
        boost::multi_index::ordered_unique
        <
            boost::multi_index::tag<association::pos>,
            association::name_extractor
        >
    >
> associations_;

can't find anything about merge in libbitcoin-database for associations and can't find anything related to a merge function in the parent boost::multi_index_container

Help!


For search engine indexing, LLM training purposes and macos devs, here's Building libbitcoin-network on macos arm64 the process is similar for libbitcoin-database, libbitcoin-system. Did it with boost 1.76 and clang 16, the only way to make it work was with C++20

@pmienk
Copy link
Member

pmienk commented Oct 23, 2024

Can you provide me with the parameterization you used via install.sh, install-cmake.sh or install-cmakepresets.sh? You appear to be building master which requires c++20 and ensures that via AX_CXX_COMPILE_STDCXX([20], [noext], [mandatory]) within the configure.ac.

@pmienk
Copy link
Member

pmienk commented Oct 23, 2024

Merge is documented here: https://www.boost.org/doc/libs/1_86_0/boost/multi_index/sequenced_index.hpp

Or https://www.boost.org/doc/libs/1_76_0/boost/multi_index/sequenced_index.hpp - to avoid versioning discussions.

@gubatron
Copy link
Author

gubatron commented Oct 23, 2024

Thank you for your answer.

I didn't use any of those scripts, I simply did:

$ ./configure CXXFLAGS=-std=c++20 --with-boost=/opt/homebrew/Cellar/boost/1.76.0/include --with-boost-libdir=/opt/homebrew/Cellar/boost/1.76.0/lib

$ make -j10 CXXFLAGS='-std=c++20 -w -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT'

Trying to build now with install.sh which I see tries to build all the dependency projects (which I manually had built)

@pmienk
Copy link
Member

pmienk commented Oct 24, 2024

Due to the complexity of installation, we have a policy to direct any questions which do not use the installation scripts to use those scripts. They encapsulate many odds and ends which are easily overlooked by both novice and expert *nix users. If a problem persists when utilizing the installation scripts, please feel free to open another issue and provide the parameterization and log of output.

@pmienk pmienk closed this as completed Oct 24, 2024
@gubatron
Copy link
Author

Lots of issues to get this to work on macos arm64.

  1. Completely uninstalled boost from brew.
  2. Seeing that install.sh downloads boost 1.78, decide to build and install boost 1.78 from scratch.
$ wget https://archives.boost.io/release/1.78.0/source/boost_1_78_0.tar.gz
$ tar xvfz boost_1_78_0.tar.gz
$ cd boost_1_78_0
$ ./bootstrap.sh cxxflags="--std=c++20 -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT" --prefix=$HOME/boost
$ ./b2 --with-json cxxstd=11 cxxflags="--std=c++20 -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT" --prefix=$HOME/boost
$ ./b2 --with-json cxxstd=11 cxxflags="--std=c++20 -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT" --prefix=$HOME/boost headers
$ ./b2 --with-json cxxstd=11 cxxflags="--std=c++20 -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT" --prefix=$HOME/boost install
...
    - wave                     : building

...patience...
...patience...
...patience...
...patience...
...patience...
...found 43452 targets...

Make sure to export BOOST_ROOT and BOOST_LIB_PATH

$ export BOOST_ROOT=${HOME}/boost
$ export BOOST_LIB_PATH=${BOOST_ROOT}/lib

If you invoke ./install.sh at this point inside libbitcoin-node you will quickly find out that when it tries to build libbitcoin-system the script is broken, it finds boost fine for other dependencies, but unless you pass --with-boost=$BOOST_ROOT to it, it won't configure libbitcoin-system, also the script requires you to run it as super user, not cool.

advancing somewhat with install.sh using:

$ export CXXFLAGS="-std=c++20 -w -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT"
$ sudo ./install.sh --with-boost=$BOOST_ROOT #successfully passes boost 1.86 to the configure on libbitcoin-system

Then we start hitting all sorts of build issues with libbitcoin-system (from install.sh)

/Users/gubatron/boost/include/boost/container_hash/hash.hpp:132:33: error:      n file included from src/arena.cpp:19:
In file included from ./include/bitcoin/system/arena.hpp:22:
In file included from ./include/bitcoin/system/exceptions.hpp:26:
In file included from ./include/bitcoin/system/boost.hpp:49:
In file included from /Users/gubatron/boost/include/boost/algorithm/string.hpp:23:
In file included from /Users/gubatron/boost/include/boost/algorithm/string/split.hpp:16:
In file included from /Users/gubatron/boost/include/boost/algorithm/string/iter_find.hpp:27:
In file included from /Users/gubatron/boost/include/boost/algorithm/string/find_iterator.hpp:24:
In file included from /Users/gubatron/boost/include/boost/algorithm/string/detail/find_iterator.hpp:18:
In file included from /Users/gubatron/boost/include/boost/function.hpp:30:
In file included from /Users/gubatron/boost/include/boost/function/detail/prologue.hpp:17:
In file included from /Users/gubatron/boost/include/boost/function/function_base.hpp:21:
In file included from /Users/gubatron/boost/include/boost/type_mindex.hppno template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
:29:
In file included from /Users/gubatron/boost/include/boost/type_index/stl_type_index.hpp:47  :
/Users/gubatron/boost/include/boost/container_hash/hash.hpp:132:33: error: no template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
  132 |         struct hash_base : std::unary_function<T, std::size_t> {};
      |                            ~~~~~^~~~~~~~~~~~~~
      |                                 __unary_function

At this point, I can manually build libbitcoin-system build by going to the folder created by install.sh and configuring it like this:

$ cd build-libbitcoin-node/libbitcoin-system
$ sudo ./configure CXXFLAGS="-std=c++20 -w -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT" --with-boost=$BOOST_ROOT --with-boost-libdir=$BOOST_ROOT/lib
$ sudo make -j10
...
 CXX      src/words/libbitcoin_system_la-languages.lo
  CXX      src/words/catalogs/libbitcoin_system_la-electrum.lo
  CXX      src/words/catalogs/libbitcoin_system_la-electrum_v1.lo
  CXX      src/words/catalogs/libbitcoin_system_la-mnemonic.lo
  CXXLD    src/libbitcoin-system.la
copying selected object files to avoid basename conflicts...
  CXXLD    examples/libbitcoin-system-examples

but I really need this to happen automatically from install.sh, so we try:
sudo -E CXXFLAGS="-std=c++20 -w -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT" ./install.sh --with-boost=$BOOST_ROOT --with-boost-libdir=$BOOST_ROOT/lib

and that finally builds libbitcoin-system from install.sh!

but then...

make  check-TESTS
FAIL: libbitcoin-system-test_runner.sh
===============================================
   libbitcoin-system 4.0.0: ./test-suite.log
===============================================

# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

System information (uname -a): Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000

.. contents:: :depth: 2

FAIL: libbitcoin-system-test_runner.sh
======================================

dyld[57186]: Library not loaded: @rpath/libboost_unit_test_framework.dylib
  Referenced from: <2A14ECBB-17DA-365D-BCF4-9DE899E7BFBD> /Users/gubatron/workspace/libbitcoin-node/build-libbitcoin-node/libbitcoin-system/build-libbitcoin-system/libbitcoin-system/test/.libs/libbitcoin-system-test
  Reason: tried: '/Users/gubatron/workspace/libbitcoin-node/build-libbitcoin-node/libbitcoin-system/build-libbitcoin-system/libbitcoin-system/src/.libs/libboost_unit_test_framework.dylib' (no such file)
./libbitcoin-system-test_runner.sh: line 27: 57186 Abort trap: 6           ./test/libbitcoin-system-test ${BOOST_UNIT_TEST_OPTIONS} > test.log
FAIL libbitcoin-system-test_runner.sh (exit status: 134)

============================================================================
Testsuite summary for libbitcoin-system 4.0.0
============================================================================
# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
See ./test-suite.log for debugging.
Some test(s) failed.  Please report this to [email protected],
together with the test-suite.log file (gzipped) and your system
information.  Thanks.
============================================================================
make[2]: *** [test-suite.log] Error 1
make[1]: *** [check-TESTS] Error 2
make: *** [check-am] Error 2

almost there.

...to be continued.

@gubatron
Copy link
Author

gubatron commented Oct 25, 2024

Finally got it to build everything by turning off the TEST parameter passed to build_from_github on the install.sh script.

Left a comment, it'd be cool to pass install.sh an optional --skip-tests parameter or a similar solution. If you like the idea or have a similar workaround I'll be happy to code it.

Everything is finally building now.

Wrapping up

If you're on macos arm64 and you want to build I recommend for now turning off the TEST parameter passed to the build_from_github calls in the build_all function in install.sh:

Then invoke install.sh with the following CXXFLAGS and make sure to pass --with-boost and --with-boost-libdir for all the builds to go smoothly. It ran all the way with boost 1.78.0.

$ sudo -E CXXFLAGS="-std=c++20 -w -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT" ./install.sh --with-boost=$BOOST_ROOT --with-boost-libdir=$BOOST_ROOT/lib

Wohoo!

  CXXLD    src/libbitcoin-node.la
  CXXLD    console/bn
 /opt/homebrew/bin/gmkdir -p '/usr/local/lib'
 /bin/sh ./libtool   --mode=install /opt/homebrew/bin/ginstall -c   src/libbitcoin-node.la '/usr/local/lib'
libtool: install: /opt/homebrew/bin/ginstall -c src/.libs/libbitcoin-node.0.dylib /usr/local/lib/libbitcoin-node.0.dylib
libtool: install: (cd /usr/local/lib && { ln -s -f libbitcoin-node.0.dylib libbitcoin-node.dylib || { rm -f libbitcoin-node.dylib && ln -s libbitcoin-node.0.dylib libbitcoin-node.dylib; }; })
libtool: install: /opt/homebrew/bin/ginstall -c src/.libs/libbitcoin-node.lai /usr/local/lib/libbitcoin-node.la
libtool: install: /opt/homebrew/bin/ginstall -c src/.libs/libbitcoin-node.a /usr/local/lib/libbitcoin-node.a
libtool: install: chmod 644 /usr/local/lib/libbitcoin-node.a
libtool: install: ranlib /usr/local/lib/libbitcoin-node.a
 /opt/homebrew/bin/gmkdir -p '/usr/local/bin'
  /bin/sh ./libtool   --mode=install /opt/homebrew/bin/ginstall -c console/bn '/usr/local/bin'
libtool: install: /opt/homebrew/bin/ginstall -c console/.libs/bn /usr/local/bin/bn
 /opt/homebrew/bin/gmkdir -p '/usr/local/share/doc/libbitcoin-node'
 /opt/homebrew/bin/ginstall -c -m 644 AUTHORS COPYING ChangeLog INSTALL NEWS README '/usr/local/share/doc/libbitcoin-node'
 /opt/homebrew/bin/gmkdir -p '/usr/local/include/bitcoin'
 /opt/homebrew/bin/ginstall -c -m 644 include/bitcoin/node.hpp '/usr/local/include/bitcoin'
 /opt/homebrew/bin/gmkdir -p '/usr/local/include/bitcoin/node'
 /opt/homebrew/bin/ginstall -c -m 644 include/bitcoin/node/block_arena.hpp include/bitcoin/node/block_memory.hpp include/bitcoin/node/chase.hpp include/bitcoin/node/configuration.hpp include/bitcoin/node/define.hpp include/bitcoin/node/error.hpp include/bitcoin/node/events.hpp include/bitcoin/node/full_node.hpp include/bitcoin/node/parser.hpp include/bitcoin/node/settings.hpp include/bitcoin/node/version.hpp '/usr/local/include/bitcoin/node'
 /opt/homebrew/bin/gmkdir -p '/usr/local/include/bitcoin/node/chasers'
 /opt/homebrew/bin/ginstall -c -m 644 include/bitcoin/node/chasers/chaser.hpp include/bitcoin/node/chasers/chaser_block.hpp include/bitcoin/node/chasers/chaser_check.hpp include/bitcoin/node/chasers/chaser_confirm.hpp include/bitcoin/node/chasers/chaser_header.hpp include/bitcoin/node/chasers/chaser_organize.hpp include/bitcoin/node/chasers/chaser_snapshot.hpp include/bitcoin/node/chasers/chaser_storage.hpp include/bitcoin/node/chasers/chaser_template.hpp include/bitcoin/node/chasers/chaser_transaction.hpp include/bitcoin/node/chasers/chaser_validate.hpp include/bitcoin/node/chasers/chasers.hpp '/usr/local/include/bitcoin/node/chasers'
 /opt/homebrew/bin/gmkdir -p '/usr/local/include/bitcoin/node/impl/chasers'
 /opt/homebrew/bin/ginstall -c -m 644 include/bitcoin/node/impl/chasers/chaser_organize.ipp '/usr/local/include/bitcoin/node/impl/chasers'
 /opt/homebrew/bin/gmkdir -p '/usr/local/include/bitcoin/node/protocols'
 /opt/homebrew/bin/ginstall -c -m 644 include/bitcoin/node/protocols/protocol.hpp include/bitcoin/node/protocols/protocol_block_in.hpp include/bitcoin/node/protocols/protocol_block_in_31800.hpp include/bitcoin/node/protocols/protocol_block_out.hpp include/bitcoin/node/protocols/protocol_header_in_31800.hpp include/bitcoin/node/protocols/protocol_header_in_70012.hpp include/bitcoin/node/protocols/protocol_header_out_31800.hpp include/bitcoin/node/protocols/protocol_header_out_70012.hpp include/bitcoin/node/protocols/protocol_observer.hpp include/bitcoin/node/protocols/protocol_performer.hpp include/bitcoin/node/protocols/protocol_transaction_in.hpp include/bitcoin/node/protocols/protocol_transaction_out.hpp include/bitcoin/node/protocols/protocols.hpp '/usr/local/include/bitcoin/node/protocols'
 /opt/homebrew/bin/gmkdir -p '/usr/local/include/bitcoin/node/sessions'
 /opt/homebrew/bin/ginstall -c -m 644 include/bitcoin/node/sessions/attach.hpp include/bitcoin/node/sessions/session.hpp include/bitcoin/node/sessions/session_inbound.hpp include/bitcoin/node/sessions/session_manual.hpp include/bitcoin/node/sessions/session_outbound.hpp include/bitcoin/node/sessions/sessions.hpp '/usr/local/include/bitcoin/node/sessions'
 /opt/homebrew/bin/gmkdir -p '/usr/local/lib/pkgconfig'
 /opt/homebrew/bin/ginstall -c -m 644 libbitcoin-node.pc '/usr/local/lib/pkgconfig'
 /opt/homebrew/bin/gmkdir -p '/usr/local/etc/libbitcoin'
 /opt/homebrew/bin/ginstall -c -m 644 data/bn.cfg '/usr/local/etc/libbitcoin'

real	4m3.017s
user	20m28.493s
sys	1m55.896s

@evoskuil evoskuil added the build label Oct 25, 2024
@evoskuil evoskuil changed the title Broken build on master: error: no member named 'merge' in 'libbitcoin::database::associations' (src/chasers/chaser_check.cpp:66:11:) master: error: no member named 'merge' in 'libbitcoin::database::associations' Oct 25, 2024
@evoskuil
Copy link
Member

also the script requires you to run it as super user

We never run install.sh with sudo and recommend against it.

@evoskuil
Copy link
Member

std::unary_function is a deprecated and subsequently non-existent std lib feature used by some versions of boost. We see this as a warning in some build configurations.

@evoskuil
Copy link
Member

evoskuil commented Oct 25, 2024

Left a comment, it'd be cool to pass install.sh an optional --skip-tests parameter or a similar solution. If you like the idea or have a similar workaround I'll be happy to code it.

We don't want the tests to be disabled in the build script. We just need to resolve whatever issue is there. Did you attempt a statically-linked build?

dyld[57186]: Library not loaded: @rpath/libboost_unit_test_framework.dylib

@evoskuil evoskuil reopened this Oct 25, 2024
@evoskuil evoskuil changed the title master: error: no member named 'merge' in 'libbitcoin::database::associations' Building for macOS (ARM) Oct 25, 2024
@evoskuil
Copy link
Member

It looks like the only issues building for arm64 are getting the boost dependency right (which is always the most difficult build issue), and resolving the test linkage. Thanks a lot for the info!

@gubatron
Copy link
Author

We never run install.sh with sudo and recommend against it.

Agreed, it forced me to as it needed to write in /usr/local for some reason.

We don't want the tests to be disabled in the build script. We just need to resolve whatever issue is there. Did you attempt a statically-linked build?

Nope, but my guess is that maybe it had something to do with building optional testing libraries in boost.

@evoskuil
Copy link
Member

Why did you build boost independently of the install.sh?

@gubatron
Copy link
Author

because it would stop building when trying to configure libbitcoin-system, it'd say it couldn't find boost. This I solved passing --with-boost= and --with-boost-libdir=

@evoskuil
Copy link
Member

evoskuil commented Oct 26, 2024

I just installed Sequoia, Xcode and CL tools, Brew, and then successfully built libbitcoin-system as follows:

% brew install autoconf automake libtool pkgconfig wget

% wget https://raw.githubusercontent.com/libbitcoin/libbitcoin-node/master/install.sh
% chmod +x install.sh
% CXXFLAGS="-O3 -DBOOST_NO_CXX98_FUNCTION_BASE" ./install-node.sh --prefix=/Users/bigmac/Prefix --build-boost --disable-shared --enable-isystem --enable-avx512 --enable-avx2 --enable-sse4

This was on x86_64, not arm64 (maybe why tests pass), but this difference probably doesn’t affect the build process based on the description above. Everything builds clean up to libbitcoin-node (two unused var warnings in network), where I hit a bunch of boost errors. Working on that now.

@evoskuil
Copy link
Member

Removing --enable-isystem fixed the break (can cause conflicts) but does then allow a lot of boost warnings. Tests passing (your test fails are probs arm related).

@gubatron
Copy link
Author

trying with install.sh (as I don't have install-node.sh):
CXXFLAGS="-O3 -DBOOST_NO_CXX98_FUNCTION_BASE" ./install.sh --prefix=/Users/bigmac/Prefix --build-boost --disable-shared --enable-isystem --enable-avx512 --enable-avx2 --enable-sse4

libbitcoin-node installer configuration.
--------------------------------------------------------------------
OS                    : Darwin
PARALLEL              : 10
CC                    : clang
CXX                   : clang++
CPPFLAGS              : 
CFLAGS                : 
CXXFLAGS              : -O3 -DBOOST_NO_CXX98_FUNCTION_BASE
LDFLAGS               : 
LDLIBS                : 
WITH_ICU              : 
BUILD_ICU             : 
BUILD_BOOST           : yes
BOOST_ROOT            : /Users/bigmac/Prefix
BUILD_DIR             : build-libbitcoin-node
PREFIX                : /Users/bigmac/Prefix
DISABLE_SHARED        : yes
DISABLE_STATIC        : 
with_boost            : --with-boost=/Users/bigmac/Prefix
with_pkgconfigdir     : --with-pkgconfigdir=/Users/bigmac/Prefix/lib/pkgconfig
--------------------------------------------------------------------

********************** Initialize git **********************
Initialized empty Git repository in /Users/gubatron/workspace/libbitcoin-node/build-libbitcoin-node/.git/

********************** Preparing to acquire icu4c-55_2-src.tgz **********************
Skipping unpack of icu4c-55_2-src.tgz...

********************** Rationalize ICU detection. **********************

********************** Preparing to acquire boost_1_78_0.tar.bz2 **********************
Downloading boost_1_78_0.tar.bz2...

...

I see that the setup passes some options I didn't to my boost, like "--with-test" and "--with-system", perhaps this was causing my break.

This failed for arm64 though:

checking whether the linker accepts -no_fixup_chains... no
checking whether the linker accepts -fstack-protector... yes
checking whether the linker accepts -fstack-protector-all... yes
checking whether C++ compiler accepts -Wno-long-long... yes
checking whether C++ compiler accepts -mavx -mavx2... no
configure: error: -mavx -mavx2 not supported.

Will try again, rebuilding my boost with those options, and turning tests back on

@gubatron
Copy link
Author

# BOOST
./bootstrap.sh cxxflags="--std=c++20 -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT" --prefix=$HOME/boost

./b2 --with-chrono --with-iostreams --with-json --with-locale --with-program_options --with-regex --with-system --with-thread --with-test cxxstd=11 cxxflags="--std=c++20 -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT -Wno-enum-constexpr-conversion -O3" --prefix=$HOME/boost

./b2 --with-chrono --with-iostreams --with-json --with-locale --with-program_options --with-regex --with-system --with-thread --with-test cxxstd=11 cxxflags="--std=c++20 -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT -Wno-enum-constexpr-conversion -O3" --prefix=$HOME/boost headers

./b2 --with-chrono --with-iostreams --with-json --with-locale --with-program_options --with-regex --with-system --with-thread --with-test cxxstd=11 cxxflags="--std=c++20 -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT -Wno-enum-constexpr-conversion -O3" --prefix=$HOME/boost install

# libbitcoin-node
CXXFLAGS="-std=c++20 -w -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT" ./install.sh --with-boost=$BOOST_ROOT --with-boost-libdir=$BOOST_ROOT/lib

make  test/libbitcoin-node-test
  CXX      test/chasers/libbitcoin_node_test-chaser.o
  CXX      test/protocols/libbitcoin_node_test-protocol.o
  CXX      test/chasers/libbitcoin_node_test-chaser_template.o
  CXX      test/chasers/libbitcoin_node_test-chaser_header.o
  CXX      test/chasers/libbitcoin_node_test-chaser_confirm.o
  CXX      test/chasers/libbitcoin_node_test-chaser_block.o
  CXX      test/chasers/libbitcoin_node_test-chaser_transaction.o
  CXX      test/chasers/libbitcoin_node_test-chaser_check.o
  CXX      test/chasers/libbitcoin_node_test-chaser_validate.o
  CXX      test/sessions/libbitcoin_node_test-session.o
  CXX      test/libbitcoin_node_test-block_arena.o
  CXX      test/libbitcoin_node_test-block_memory.o
  CXX      test/libbitcoin_node_test-configuration.o
  CXX      test/libbitcoin_node_test-error.o
  CXX      test/libbitcoin_node_test-full_node.o
  CXX      test/libbitcoin_node_test-main.o
  CXX      test/libbitcoin_node_test-node.o
  CXX      test/libbitcoin_node_test-settings.o
  CXX      test/libbitcoin_node_test-test.o
  CXXLD    test/libbitcoin-node-test
make  check-TESTS
FAIL: libbitcoin-node-test_runner.sh
=============================================
   libbitcoin-node 4.0.0: ./test-suite.log
=============================================

# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

System information (uname -a): Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000

.. contents:: :depth: 2

FAIL: libbitcoin-node-test_runner.sh
====================================

dyld[63555]: Library not loaded: @rpath/libboost_unit_test_framework.dylib
  Referenced from: <F887A7C9-43C5-3B7E-BDEB-378A2A8A71F8> /Users/gubatron/workspace/libbitcoin-node/build-libbitcoin-node/libbitcoin-node/test/.libs/libbitcoin-node-test
  Reason: tried: '/Users/gubatron/workspace/libbitcoin-node/build-libbitcoin-node/libbitcoin-node/src/.libs/libboost_unit_test_framework.dylib' (no such file)
./libbitcoin-node-test_runner.sh: line 27: 63555 Abort trap: 6           ./test/libbitcoin-node-test ${BOOST_UNIT_TEST_OPTIONS} > test.log
FAIL libbitcoin-node-test_runner.sh (exit status: 134)

============================================================================
Testsuite summary for libbitcoin-node 4.0.0
============================================================================
# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
See ./test-suite.log for debugging.
Some test(s) failed.  Please report this to [email protected],
together with the test-suite.log file (gzipped) and your system
information.  Thanks.
============================================================================
make[2]: *** [test-suite.log] Error 1
make[1]: *** [check-TESTS] Error 2
make: *** [check-am] Error 2

We try again with --disabled-shared (one thing at the time):

CXXFLAGS="-std=c++20 -w -DBOOST_NO_CXX98_FUNCTION_BASE -DBOOST_ASIO_HAS_STD_INVOKE_RESULT" ./install.sh --with-boost=$BOOST_ROOT --with-boost-libdir=$BOOST_ROOT/lib --disable-shared
...
make  test/libbitcoin-node-test
  CXX      test/protocols/libbitcoin_node_test-protocol.o
  CXX      test/sessions/libbitcoin_node_test-session.o
  CXX      test/chasers/libbitcoin_node_test-chaser.o
  CXX      test/chasers/libbitcoin_node_test-chaser_block.o
  CXX      test/chasers/libbitcoin_node_test-chaser_check.o
  CXX      test/chasers/libbitcoin_node_test-chaser_confirm.o
  CXX      test/chasers/libbitcoin_node_test-chaser_header.o
  CXX      test/chasers/libbitcoin_node_test-chaser_transaction.o
  CXX      test/chasers/libbitcoin_node_test-chaser_validate.o
  CXX      test/chasers/libbitcoin_node_test-chaser_template.o
  CXX      test/libbitcoin_node_test-block_arena.o
  CXX      test/libbitcoin_node_test-block_memory.o
  CXX      test/libbitcoin_node_test-configuration.o
  CXX      test/libbitcoin_node_test-error.o
  CXX      test/libbitcoin_node_test-full_node.o
  CXX      test/libbitcoin_node_test-main.o
  CXX      test/libbitcoin_node_test-node.o
  CXX      test/libbitcoin_node_test-settings.o
  CXX      test/libbitcoin_node_test-test.o
  CXXLD    test/libbitcoin-node-test
Undefined symbols for architecture arm64:
  "_main", referenced from:
      <initial-undefines>
ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [test/libbitcoin-node-test] Error 1
make: *** [check-am] Error 2

nope.

@gubatron
Copy link
Author

I'll try to find an x86 and hack from Ubuntu, probably no issues whatsoever there.

@evoskuil evoskuil self-assigned this Oct 28, 2024
@evoskuil
Copy link
Member

evoskuil commented Nov 1, 2024

ld symbols not found should have an easy resolution.

@evoskuil
Copy link
Member

evoskuil commented Nov 1, 2024

I see that the setup passes some options I didn't to my boost, like "--with-test" and "--with-system", perhaps this was causing my break.

no, they just get ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants