Dependency
Working Versions
Using Clang 16.0.0
The XCode that matches MacOS Sequoia 15.3 bundles Clang 16.0.0. It has a performance regression when instantiating templates from large enum ranges.
If you experience any hanging compiles, make sure you to merge the following PR: https://github.com/Xahau/xahaud/pull/436
Force Apple Clang 14.3.1
Download an older version of Xcode
Search for the version of Xcode that includes Apple Clang 14. This is typically specified in the release notes for each Xcode version.
Download the Xcode `.xip` file for the version you need.
Install the older version of Xcode:
Once the download is complete, extract the `.xip` file, which will give you an Xcode application.
Rename this Xcode application if you want to keep multiple versions of Xcode on your system (e.g., `Xcode_14.3.1.app`).
Drag the Xcode application to your `/Applications` directory.
Switch to the desired version of the toolchain
If you want to use the newly installed version of Xcode and its toolchain by default, you can switch to it using the `xcode-select` command:
Copy sudo xcode-select -s /Applications/Xcode_14.3.1.app/Contents/Developer
Replace `Xcode_14.3.1.app` with the actual name of the Xcode version you installed.
Open Terminal and run the following command to check the version of Clang:
clang --version
If you want to use a specific version of Apple Clang for command line builds you can use the following;
Copy export DEVELOPER_DIR=/Applications/Xcode_14.3.1.app/Contents/Developer
clang --version
Set Build Env Variables
First make a dependency directory. I like to use ~/dependencies
Next we need to set the environment variables.
Set Version Env Variables
Copy export LLVM_VERSION=14
export BOOST_VERSION=1.86.0
export WASMEDGE_VERSION=0.11.2
export PROTOBUF_VERSION=3.20.0
Set Build Env Variables
Copy export DEP_DIR=~/dependencies
export BOOST_FOLDER_NAME="boost_$(echo "$BOOST_VERSION" | sed 's/\./_/g')"
export BOOST_ROOT="$DEP_DIR/$BOOST_FOLDER_NAME"
export BOOST_LIBRARY_DIRS="$BOOST_ROOT/libs"
export BOOST_INCLUDE_DIR="$BOOST_ROOT/boost"
export BOOST_CXXFLAGS="${BOOST_CXXFLAGS:-} -DBOOST_ASIO_HAS_STD_INVOKE_RESULT"
export LLVM_PREFIX=`brew --prefix llvm@$LLVM_VERSION`
export LLVM_DIR="$LLVM_PREFIX/lib/cmake/llvm"
export LLVM_LIBRARY_DIR="$LLVM_PREFIX/lib"
export LLD_DIR="$LLVM_PREFIX/lib/cmake/lld"
export CC=clang
export CXX=clang++
export LDFLAGS="${LDFLAGS:-} -L$BOOST_LIBRARY_DIRS -L$LLVM_PREFIX/lib"
export CPPFLAGS="${CPPFLAGS:-} -I$BOOST_ROOT/include -I$LLVM_PREFIX/include"
export CFLAGS="${CFLAGS:-} -DBOOST_ASIO_HAS_STD_INVOKE_RESULT"
export CXXFLAGS="${CXXFLAGS:-} -DBOOST_ASIO_HAS_STD_INVOKE_RESULT"
Install Core Dependencies
Copy brew update
brew install automake \
wget \
curl \
git \
pkg-config \
openssl \
autoconf \
libtool \
unzip \
cmake \
"llvm@$LLVM_VERSION"
Install Rippled Dependencies
Install Protobuf
Copy cd $DEP_DIR && \
wget -nc https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOBUF_VERSION/protobuf-all-$PROTOBUF_VERSION.tar.gz && \
tar -xzf protobuf-all-$PROTOBUF_VERSION.tar.gz && \
cd protobuf-$PROTOBUF_VERSION/ && \
./autogen.sh && \
./configure --disable-shared link=static && \
make -j$(sysctl -n hw.logicalcpu) && \
sudo make install
Note that it's currently necessary to remove any homebrew installations of protobuf otherwise cmake will mix up both installations. There would of course be better workarounds for this, but simply removing the homebrew installations is a quick fix.
Install Boost
Copy cd $DEP_DIR && \
wget https://archives.boost.io/release/$BOOST_VERSION/source/$BOOST_FOLDER_NAME.tar.gz && \
tar -xvzf $BOOST_FOLDER_NAME.tar.gz && \
cd $BOOST_FOLDER_NAME && \
./bootstrap.sh && \
./b2 -j$(sysctl -n hw.logicalcpu)
Install WasmEdge
Copy cd $DEP_DIR && \
wget -nc -q https://github.com/WasmEdge/WasmEdge/archive/refs/tags/$WASMEDGE_VERSION.zip && \
unzip -o $WASMEDGE_VERSION.zip && \
cd WasmEdge-$WASMEDGE_VERSION && \
sed -i '' \
's|https://boostorg\.jfrog\.io/artifactory/main/release/|https://archives.boost.io/release/|g' CMakeLists.txt && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DWASMEDGE_BUILD_SHARED_LIB=OFF \
-DWASMEDGE_BUILD_STATIC_LIB=ON \
-DWASMEDGE_BUILD_AOT_RUNTIME=ON \
-DWASMEDGE_FORCE_DISABLE_LTO=ON \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DWASMEDGE_LINK_LLVM_STATIC=ON \
-DWASMEDGE_BUILD_PLUGINS=OFF \
-DWASMEDGE_LINK_TOOLS_STATIC=ON \
.. && \
make -j$(sysctl -n hw.logicalcpu) && \
sudo make install
Clone the repository
Copy mkdir ~/projects && \
cd ~/projects && \
git clone https://github.com/Xahau/xahaud.git && \
cd xahaud && \
git checkout dev
Build Xahaud
From the root xahaud
directory:
Copy mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_DIR=$LLVM_DIR -DLLVM_LIBRARY_DIR=$LLVM_LIBRARY_DIR .. && \
cmake --build . --target rippled --parallel -j$(sysctl -n hw.logicalcpu)
Start the built node
Last updated 18 hours ago