zeromq / libzmq

ZeroMQ core engine in C++, implements ZMTP/3.1
https://www.zeromq.org
Mozilla Public License 2.0
9.44k stars 2.34k forks source link

tools: curve_keygen not built when building with cmake, ninja #4675

Open spchamp opened 2 months ago

spchamp commented 2 months ago

Issue description

When building with cmake using the ninja builder, the curve_keygen tool is not compiled or installed.

This tool is built when using the autoconf toolchain and GNU Make.

Environment

Minimal test code / Steps to reproduce the issue

spec file for an RPM build using cmake and ninja, tentatively to be contributed as a patch for a user branch of the current zeromq RPM source package in OpenSUSE LEAP 15.5.

This would provide something of an update to the latest ZeroMQ release, for OpenSUSE LEAP 15.5. This uses cmake for the build, while the official RPM uses the traditional autoconf and GNU make toolchain.

Supplemental to the 'pgm' option in the OpenSUSE base RPM, this also adds a 'drafts' option for the RPM build with openSUSE build tools. It might be similar to the spec file in the libzmq source tree?

#
# spec file for package zeromq
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%define lib_name libzmq5
%define __builder ninja
%ifarch %{ix86} x86_64
%bcond_without pgm
%else
%bcond_with pgm
%endif
%bcond_with drafts
Name:           zeromq
Version:        4.3.5
Release:        0
Summary:        Lightweight messaging kernel
License:        LGPL-3.0-or-later
Group:          Productivity/Networking/Web/Servers
URL:            http://www.zeromq.org/
Source:         https://github.com/zeromq/libzmq/releases/download/v%{version}/zeromq-%{version}.tar.gz
Source99:       baselibs.conf
BuildRequires:  cmake
BuildRequires:  ninja
BuildRequires:  asciidoc
BuildRequires:  gcc12-c++
BuildRequires:  libbsd-devel
BuildRequires:  libgnutls-devel
BuildRequires:  libunwind-devel
BuildRequires:  pkgconfig
BuildRequires:  xmlto
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
BuildRequires:  libsodium-devel
BuildRequires:  libuuid-devel
%else
BuildRequires:  pkgconfig(libsodium)
BuildRequires:  pkgconfig(uuid)
%endif
%if %{with pgm}
BuildRequires:  openpgm-devel >= 5.1
BuildRequires:  python
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
BuildRequires:  glib2-devel >= 2.8
%else
BuildRequires:  pkgconfig(glib-2.0) >= 2.8
%endif
%endif  # with pgm

%description
The ZeroMQ messaging kernel is a library extending the standard
socket interfaces with an abstraction of asynchronous message queues,
multiple messaging patterns, message filtering (subscriptions) and
seamless access to multiple transport protocols.

%package -n %{lib_name}
Summary:        Shared Library for ZeroMQ
Group:          Productivity/Networking/Web/Servers
Recommends:     %{name}-tools = %{version}

%description -n %{lib_name}
The ZeroMQ messaging kernel is a library extending the standard
socket interfaces with an abstraction of asynchronous message queues,
multiple messaging patterns, message filtering (subscriptions) and
seamless access to multiple transport protocols.

This package holds the shared library part of the ZeroMQ package.

%package tools
Summary:        Tools to work with ZeroMQ
# Conflict old libraries as we collide with them
Group:          Productivity/Networking/Web/Servers
Conflicts:      libzmq1
Conflicts:      libzmq2
Conflicts:      libzmq3

%description tools
The ZeroMQ messaging kernel is a library extending the standard
socket interfaces with an abstraction of asynchronous message queues,
multiple messaging patterns, message filtering (subscriptions) and
seamless access to multiple transport protocols.

This package contains the utilities to work with ZeroMQ library.

%package devel
Summary:        Development files for ZeroMQ
Group:          Development/Languages/C and C++
Requires:       %{lib_name} = %{version}
Provides:       libzmq-devel = %{version}

%description devel
The ZeroMQ messaging kernel is a library extending the standard
socket interfaces with an abstraction of asynchronous message queues,
multiple messaging patterns, message filtering (subscriptions) and
seamless access to multiple transport protocols.

This package holds the development files for ZeroMQ.

%prep
%autosetup -p1

%build
%cmake \
%if %{with drafts}
  -DENABLE_DRAFTS=ON \
%endif
%if %{with pgm}
  -DWITH_OPENPGM=ON \
%endif
  -DWITH_LIBSODIUM=ON \
  -DENABLE_CURVE=ON \
  -DCMAKE_CXX_COMPILER=g++-12 \
  -DCMAKE_C_COMPILER=gcc-12 

%install
%cmake_install
find %{buildroot} -type f -name "*.la" -delete -print

%check
%ctest -j %{jobs} --test-dir tests

%post -n %{lib_name} -p /sbin/ldconfig
%postun -n %{lib_name} -p /sbin/ldconfig

%files -n %{lib_name}
%license LICENSE
%{_libdir}/libzmq.so.*

%files tools
%license LICENSE
%{_bindir}/curve_keygen
%{_bindir}/inproc_lat
%{_bindir}/inproc_thr
%{_bindir}/local_lat
%{_bindir}/local_thr
%{_bindir}/proxy_thr
%{_bindir}/remote_lat
%{_bindir}/remote_thr 

%files devel
%doc AUTHORS ChangeLog NEWS
%license LICENSE
%{_includedir}/zmq*
%{_libdir}/libzmq.so
%{_libdir}/cmake/ZeroMQ/*
%{_libdir}/pkgconfig/libzmq.pc
%{_mandir}/man3/zmq*.3%{?ext_man}
%{_mandir}/man7/zmq*.7%{?ext_man}

%changelog

What's the actual result? (include assertion message & call stack if applicable)

The %{_bindir}/curve_keygen tool is not built or installed, when using the cmake build defs and ninja.

Of course, it would be possible to build this manually with a post-cmake compiler in the RPM spec file.

Otherwise:

What's the expected result?

Ideally, the %{_bindir}/curve_keygen runtime tool would be built and installed with the cmake build, similar to the build with GNU Make

I'll try to build this with the GNU Make builder in cmake. I'm not certain if that would use autoconf toolchain however.

spchamp commented 2 months ago

Could one add a couple of separate questions, towards clarification about the outcomes of the cmake build? I'm not an official maintainer for the openSUSE RPM or anything similar of course, just curious:

spchamp commented 2 months ago

Update: The following is not an issue. I'd not in fact taken a look at the list of files from the source archive, where the manual pages are already available.

With the rpm build using cmake under openSUSE build tools, the manual pages as denoted in the original spec file are (were) missing (at the installation pathnames from the Makefile build. The files are already available without further processing, however)

[...]
[   17s] RPM build errors:                                                                                                                                             
[   17s]     File not found: /home/abuild/rpmbuild/BUILDROOT/zeromq-4.3.5-0.x86_64/usr/share/man/man3/zmq*.3.gz                                                        
[   17s]     File not found: /home/abuild/rpmbuild/BUILDROOT/zeromq-4.3.5-0.x86_64/usr/share/man/man7/zmq*.7.gz
[...]

$ find /var/tmp/build-root/pool-x86_64/home/abuild/rpmbuild/BUILDROOT/zeromq-4.3.5-0.x86_64/usr/share/man
find: ‘/var/tmp/build-root/pool-x86_64/home/abuild/rpmbuild/BUILDROOT/zeromq-4.3.5-0.x86_64/usr/share/man’: No such file or directory

$ find /var/tmp/build-root/pool-x86_64/home/abuild/rpmbuild/BUILDROOT/zeromq-4.3.5-0.x86_64/usr/include/
/var/tmp/build-root/pool-x86_64/home/abuild/rpmbuild/BUILDROOT/zeromq-4.3.5-0.x86_64/usr/include/
/var/tmp/build-root/pool-x86_64/home/abuild/rpmbuild/BUILDROOT/zeromq-4.3.5-0.x86_64/usr/include/zmq.h
/var/tmp/build-root/pool-x86_64/home/abuild/rpmbuild/BUILDROOT/zeromq-4.3.5-0.x86_64/usr/include/zmq_utils.h

The autoconf/GNU make tooclhain might be preferred at present?