From 2621f794b9985070fc66933d533d1529bf6fc122 Mon Sep 17 00:00:00 2001 From: woodser Date: Sun, 7 Jan 2024 14:23:38 -0500 Subject: [PATCH] update build instructions --- README.md | 97 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index fd00b48..9365fdc 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ A C++ library for creating Monero applications using native bindings to [monero * [Sample code](#sample-code) * [Documentation](#documentation) -* [Using this library in your project](#using-this-library-in-your-project) +* [Using monero-cpp in your project](#using-monero-cpp-in-your-project) * [Related projects](#related-projects) * [License](#license) * [Donations](#donations) @@ -162,56 +162,62 @@ delete wallet_random; * [API and model overview with visual diagrams](https://moneroecosystem.org/monero-java/monero-spec.pdf) * [monero-ts documentation](https://github.com/monero-ecosystem/monero-ts#documentation) provides additional documentation which translates to monero-cpp -## Using this library in your project +## Using monero-cpp in your project This project may be compiled as part of another application or built as a shared or static library. For example, [monero-java](https://github.com/monero-ecosystem/monero-java) compiles this project to a shared library to support Java JNI bindings, while [monero-ts](https://github.com/monero-ecosystem/monero-ts) compiles this project to WebAssembly binaries. -### Building monero-cpp on Mac & Linux +### Linux -1. If building this library standalone instead of as a submodule in another project, clone the project repository and update its submodules: - 1. `git clone --recurse-submodules https://github.com/monero-ecosystem/monero-cpp.git` - 2. `cd ./monero-cpp && ./bin/update_submodules.sh` -2. Install [monero-project dependencies](https://github.com/monero-project/monero#dependencies) for your system. For example, on Ubuntu:
- 1. `sudo apt update && sudo apt install build-essential cmake pkg-config libssl-dev libzmq3-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev python3 ccache` - 2. Install expat (dependency of unbound): - ``` - cd ~ - wget https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.bz2 - tar -xf expat-2.4.8.tar.bz2 - sudo rm expat-2.4.8.tar.bz2 - cd expat-2.4.8 - ./configure --enable-static --disable-shared - make - sudo make install - cd ../ - ``` - 3. Install unbound: +1. Clone the project repository if applicable: `git clone --recurse-submodules https://github.com/monero-ecosystem/monero-cpp.git` +2. Update submodules: `cd monero-cpp && ./bin/update_submodules.sh` +3. `sudo apt update && sudo apt install build-essential cmake pkg-config libssl-dev libzmq3-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev python3 ccache` +4. Follow instructions to install [unbound](https://unbound.docs.nlnetlabs.nl/en/latest/getting-started/installation.html) for Linux to your home directory (e.g. `~/unbound-1.19.0`). - ``` - cd ~ - wget https://www.nlnetlabs.nl/downloads/unbound/unbound-1.17.0.tar.gz - tar xzf unbound-1.17.0.tar.gz - sudo apt update - sudo apt install -y build-essential - sudo apt install -y libssl-dev - sudo apt install -y libexpat1-dev - sudo apt-get install -y bison - sudo apt-get install -y flex - cd unbound-1.17.0 - ./configure --with-libexpat=/usr --with-ssl=/usr - make - sudo make install - cd ../ - ``` -3. `export MONERO_CPP=path/to/monero-cpp` -4. `cd $MONERO_CPP/external/monero-project` -5. Build monero-project to create .a libraries, e.g.: `make release-static -j8` -6. Link to this library's source files in your application or build as a shared library in ./build/: `cd $MONERO_CPP && ./bin/build_libmonero_cpp.sh` + For example, install expat: + ``` + cd ~ + wget https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.bz2 + tar -xf expat-2.4.8.tar.bz2 + sudo rm expat-2.4.8.tar.bz2 + cd expat-2.4.8 + ./configure --enable-static --disable-shared + make + sudo make install + cd ../ + ``` -### Building libmonero-cpp.dll on Windows + For example, install unbound: + ``` + cd ~ + wget https://www.nlnetlabs.nl/downloads/unbound/unbound-1.17.0.tar.gz + tar xzf unbound-1.17.0.tar.gz + sudo apt update + sudo apt install -y build-essential + sudo apt install -y libssl-dev + sudo apt install -y libexpat1-dev + sudo apt-get install -y bison + sudo apt-get install -y flex + cd unbound-1.17.0 + ./configure --with-libexpat=/usr --with-ssl=/usr + make + sudo make install + cd ../ + ``` +5. Build monero-project, located as a submodule at ./external/monero-project. Install [dependencies](https://github.com/monero-project/monero#dependencies) as needed for your system, then build with: `make release-static -j8` +6. Link to this library's source files in your application, or build monero-cpp to a shared library in ./build: `./bin/build_libmonero_cpp.sh` + +### macOS + +1. Clone the project repository if applicable: `git clone --recurse-submodules https://github.com/monero-ecosystem/monero-cpp.git` +2. Update submodules: `cd monero-cpp && ./bin/update_submodules.sh` +3. Follow instructions to install [unbound](https://unbound.docs.nlnetlabs.nl/en/latest/getting-started/installation.html) for macOS to your home directory (e.g. `~/unbound-1.19.0`). +4. Build monero-project, located as a submodule at ./external/monero-project. Install [dependencies](https://github.com/monero-project/monero#dependencies) as needed for your system, then build with: `make release-static -j8` +5. Link to this library's source files in your application, or build monero-cpp to a shared library in ./build: `./bin/build_libmonero_cpp.sh` + +### Windows 1. Download and install [MSYS2](https://www.msys2.org/). 2. Press the Windows button and launch `MSYS2 MINGW64` for 64 bit systems or `MSYS2 MINGW32` for 32 bit. @@ -230,14 +236,13 @@ For example, [monero-java](https://github.com/monero-ecosystem/monero-java) comp pacman -S mingw-w64-i686-toolchain make mingw-w64-i686-cmake mingw-w64-i686-boost mingw-w64-i686-openssl mingw-w64-i686-zeromq mingw-w64-i686-libsodium mingw-w64-i686-hidapi mingw-w64-i686-unbound mingw-w64-i686-protobuf git mingw-w64-i686-libusb gettext base-devel ``` 5. Clone repo if installing standalone (skip if building as part of another repo like monero-java or monero-ts): `git clone --recursive https://github.com/monero-ecosystem/monero-cpp.git` -6. Update submodules: `cd && ./bin/update_submodules.sh` -7. `cd ./external/monero-project` -9. Build monero-project: +6. Update submodules: `cd monero-cpp && ./bin/update_submodules.sh` +7. Build monero-project, located as a submodule at ./external/monero-project. Install [dependencies](https://github.com/monero-project/monero#dependencies) as needed for your system, then build with: For 64 bit: `make release-static-win64` For 32 bit: `make release-static-win32` -10. Build as a shared library to ./build/: `cd ../../ && ./bin/build_libmonero_cpp.sh` +8. Link to this library's source files in your application, or build monero-cpp to a shared library (libmonero-cpp.dll) in ./build: `./bin/build_libmonero_cpp.sh` ## Running sample code and tests