diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc8ff193320..6a300f50c3c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,8 +14,8 @@ on: env: REMOVE_BUNDLED_PACKAGES : sudo rm -rf /usr/local BUILD_DEFAULT_LINUX: | - cmake -S . -B build -D ARCH="default" -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Release && cmake --build build --parallel 3 - APT_INSTALL_LINUX: 'apt -y install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev libprotobuf-dev protobuf-compiler ccache git' + cmake -S . -B build -D ARCH="default" -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Release && cmake --build build --parallel 4 + APT_INSTALL_LINUX: 'apt -y install build-essential cmake libboost-all-dev miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev libzmq3-dev libsodium-dev libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler ccache git' APT_SET_CONF: | tee -a /etc/apt/apt.conf.d/80-custom << EOF Acquire::Retries "3"; @@ -43,7 +43,7 @@ jobs: restore-keys: ccache-${{ runner.os }}-build- - name: install dependencies run: | - HOMEBREW_NO_AUTO_UPDATE=1 brew install boost hidapi openssl zmq libpgm miniupnpc expat libunwind-headers protobuf@21 ccache + HOMEBREW_NO_AUTO_UPDATE=1 brew install boost hidapi openssl zmq miniupnpc expat libunwind-headers protobuf@21 ccache brew link protobuf@21 - name: build run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 56223ebcf8b..7f19b3b6099 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1198,46 +1198,8 @@ if(STATIC) endif() find_package(Sodium REQUIRED) -find_path(ZMQ_INCLUDE_PATH zmq.h) -find_library(ZMQ_LIB zmq) -find_library(PGM_LIBRARY pgm) -find_library(NORM_LIBRARY norm) -find_library(GSSAPI_LIBRARY gssapi_krb5) -find_library(PROTOLIB_LIBRARY protolib) -find_library(BSD_LIBRARY bsd) -find_library(MD_LIBRARY md) -find_library(PROTOKIT_LIBRARY protokit) - -if(NOT ZMQ_INCLUDE_PATH) - message(FATAL_ERROR "Could not find required header zmq.h") -endif() -if(NOT ZMQ_LIB) - message(FATAL_ERROR "Could not find required libzmq") -endif() -if(PGM_LIBRARY) - set(ZMQ_LIB "${ZMQ_LIB};${PGM_LIBRARY}") -endif() -if(NORM_LIBRARY) - set(ZMQ_LIB "${ZMQ_LIB};${NORM_LIBRARY}") -endif() -if(GSSAPI_LIBRARY) - set(ZMQ_LIB "${ZMQ_LIB};${GSSAPI_LIBRARY}") -endif() -if(PROTOLIB_LIBRARY) - set(ZMQ_LIB "${ZMQ_LIB};${PROTOLIB_LIBRARY}") -endif() -if(Sodium_FOUND) - set(ZMQ_LIB "${ZMQ_LIB};${sodium_LIBRARIES}") -endif() -if(BSD_LIBRARY) - set(ZMQ_LIB "${ZMQ_LIB};${BSD_LIBRARY}") -endif() -if(MD_LIBRARY) - set(ZMQ_LIB "${ZMQ_LIB};${MD_LIBRARY}") -endif() -if(PROTOKIT_LIBRARY) - set(ZMQ_LIB "${ZMQ_LIB};${PROTOKIT_LIBRARY}") -endif() +find_package(PkgConfig REQUIRED) +pkg_check_modules(libzmq REQUIRED IMPORTED_TARGET libzmq) include(external/supercop/functions.cmake) # place after setting flags and before src directory inclusion add_subdirectory(contrib) diff --git a/README.md b/README.md index 1e0aef15fc0..0c5fefaac2a 100644 --- a/README.md +++ b/README.md @@ -170,8 +170,6 @@ library archives (`.a`). | Boost | 1.62 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries | | OpenSSL | basically any | NO | `libssl-dev` | `openssl` | `openssl-devel` | `openssl-devel` | NO | sha256 sum | | libzmq | 4.2.0 | NO | `libzmq3-dev` | `zeromq` | `zeromq-devel` | `zeromq-devel` | NO | ZeroMQ library | -| OpenPGM | ? | NO | `libpgm-dev` | `libpgm` | | `openpgm-devel` | NO | For ZeroMQ | -| libnorm[1] | ? | NO | `libnorm-dev` | | | | YES | For ZeroMQ | | libunbound | 1.4.16 | NO | `libunbound-dev` | `unbound` | `unbound-devel` | `unbound-devel` | NO | DNS resolver | | libsodium | ? | NO | `libsodium-dev` | `libsodium` | `libsodium-devel` | `libsodium-devel` | NO | cryptography | | libunwind | any | NO | `libunwind8-dev` | `libunwind` | `libunwind-devel` | `libunwind-devel` | YES | Stack traces | @@ -189,22 +187,20 @@ library archives (`.a`). | protoc | ? | NO | `protobuf-compiler` | `protobuf` | `protobuf` | `protobuf-compiler` | YES | Hardware wallet | | libudev | ? | NO | `libudev-dev` | `systemd` | `eudev-libudev-devel` | `systemd-devel` | YES | Hardware wallet | -[1] libnorm-dev is needed if your zmq library was built with libnorm, and not needed otherwise - Install all dependencies at once on Debian/Ubuntu: ``` -sudo apt update && sudo apt install build-essential cmake pkg-config libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libexpat1-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 doxygen graphviz git curl autoconf libtool gperf +sudo apt update && sudo apt install build-essential cmake pkg-config libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libexpat1-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 doxygen graphviz git curl autoconf libtool gperf ``` Install all dependencies at once on Arch: ``` -sudo pacman -Syu --needed base-devel cmake boost openssl zeromq libpgm unbound libsodium libunwind xz readline expat gtest python3 ccache doxygen graphviz qt5-tools hidapi libusb protobuf systemd +sudo pacman -Syu --needed base-devel cmake boost openssl zeromq unbound libsodium libunwind xz readline expat gtest python3 ccache doxygen graphviz qt5-tools hidapi libusb protobuf systemd ``` Install all dependencies at once on Fedora: ``` -sudo dnf install gcc gcc-c++ cmake pkgconf boost-devel openssl-devel zeromq-devel openpgm-devel unbound-devel libsodium-devel libunwind-devel xz-devel readline-devel expat-devel gtest-devel ccache doxygen graphviz qt5-linguist hidapi-devel libusbx-devel protobuf-devel protobuf-compiler systemd-devel +sudo dnf install gcc gcc-c++ cmake pkgconf boost-devel openssl-devel zeromq-devel unbound-devel libsodium-devel libunwind-devel xz-devel readline-devel expat-devel gtest-devel ccache doxygen graphviz qt5-linguist hidapi-devel libusbx-devel protobuf-devel protobuf-compiler systemd-devel ``` Install all dependencies at once on openSUSE: diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in index 9b850be0029..eb0da1877d9 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in @@ -32,9 +32,6 @@ SET(Protobuf_INCLUDE_DIR @prefix@/include CACHE PATH "Protobuf include dir") SET(Protobuf_INCLUDE_DIRS @prefix@/include CACHE PATH "Protobuf include dir") SET(Protobuf_LIBRARY @prefix@/lib/libprotobuf.a CACHE FILEPATH "Protobuf library") -SET(ZMQ_INCLUDE_PATH @prefix@/include) -SET(ZMQ_LIB @prefix@/lib/libzmq.a) - SET(Boost_IGNORE_SYSTEM_PATH ON) SET(BOOST_ROOT @prefix@) SET(BOOST_INCLUDEDIR @prefix@/include) diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt index 51e811392cc..06230aecf90 100644 --- a/src/daemon/CMakeLists.txt +++ b/src/daemon/CMakeLists.txt @@ -65,7 +65,7 @@ target_link_libraries(daemon ${Boost_REGEX_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} - ${ZMQ_LIB} + PkgConfig::libzmq ${GNU_READLINE_LIBRARY} ${EXTRA_LIBRARIES} $) diff --git a/src/net/CMakeLists.txt b/src/net/CMakeLists.txt index 9483bdc11cc..7b95a065047 100644 --- a/src/net/CMakeLists.txt +++ b/src/net/CMakeLists.txt @@ -32,5 +32,5 @@ set(net_sources dandelionpp.cpp error.cpp http.cpp i2p_address.cpp parse.cpp res monero_find_all_headers(net_headers "${CMAKE_CURRENT_SOURCE_DIR}") monero_add_library(net ${net_sources} ${net_headers}) -target_link_libraries(net common epee ${ZMQ_LIB} ${Boost_ASIO_LIBRARY}) +target_link_libraries(net common epee PkgConfig::libzmq ${Boost_ASIO_LIBRARY}) diff --git a/src/rpc/CMakeLists.txt b/src/rpc/CMakeLists.txt index d01a4c44a56..f7caed6d84c 100644 --- a/src/rpc/CMakeLists.txt +++ b/src/rpc/CMakeLists.txt @@ -26,8 +26,6 @@ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -include_directories(SYSTEM ${ZMQ_INCLUDE_PATH}) - set(rpc_base_sources rpc_args.cpp rpc_payment_signature.cpp @@ -171,7 +169,5 @@ target_link_libraries(daemon_rpc_server ${Boost_REGEX_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} - ${ZMQ_LIB} + PkgConfig::libzmq ${EXTRA_LIBRARIES}) -target_include_directories(daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_PATH}) -target_include_directories(obj_daemon_rpc_server PUBLIC ${ZMQ_INCLUDE_PATH}) diff --git a/tests/trezor/CMakeLists.txt b/tests/trezor/CMakeLists.txt index 70b1df19a43..15def47cbac 100644 --- a/tests/trezor/CMakeLists.txt +++ b/tests/trezor/CMakeLists.txt @@ -62,7 +62,7 @@ target_link_libraries(trezor_tests ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_SYSTEM_LIBRARY} - ${ZMQ_LIB} + PkgConfig::libzmq ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_LIBRARIES}) diff --git a/tests/unit_tests/CMakeLists.txt b/tests/unit_tests/CMakeLists.txt index 8659b0ed07a..e329b7506fa 100644 --- a/tests/unit_tests/CMakeLists.txt +++ b/tests/unit_tests/CMakeLists.txt @@ -131,7 +131,7 @@ target_link_libraries(unit_tests ${GTEST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${EXTRA_LIBRARIES} - ${ZMQ_LIB}) + PkgConfig::libzmq) set_property(TARGET unit_tests PROPERTY FOLDER "tests")