roehling / postsrsd

Postfix Sender Rewriting Scheme daemon
324 stars 39 forks source link

cmake hangs #131

Closed jengelh closed 1 year ago

jengelh commented 1 year ago

postsrsd 2.x fails to consider an already existing libconfuse present in the system (at its usual location, e.g. /usr/lib*/pkgconfig/libconfuse.pc), causing the configure stage to needlessy hang for some time until dying off in a network-locked buildroot.

[    2s] + /usr/bin/cmake /home/abuild/rpmbuild/BUILD/postsrsd-2.0.1/. '-GUnix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_INSTALL_LIBDIR:PATH=lib64 -DCMAKE_INSTALL_LIBEXECDIR=/usr/libexec -DCMAKE_BUILD_TYPE=RelWithDebInfo '-DCMAKE_C_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g' '-DCMAKE_CXX_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g' '-DCMAKE_Fortran_FLAGS=-O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g' '-DCMAKE_EXE_LINKER_FLAGS=-flto=auto -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' '-DCMAKE_MODULE_LINKER_FLAGS=-flto=auto -Wl,--as-needed' '-DCMAKE_SHARED_LINKER_FLAGS=-flto=auto -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' -DLIB_SUFFIX=64 -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF -DCMAKE_COLOR_MAKEFILE:BOOL=OFF -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF -DCMAKE_MODULES_INSTALL_DIR=/usr/lib64/cmake/postsrsd -DGENERATE_SRS_SECRET=0 -DCHROOT_DIR=/var/lib/empty -DUSE_APPARMOR=1 -DINIT_FLAVOR=systemd -DWITH_SQLITE=BOOL:ON
[    2s] -- The C compiler identification is GNU 12.2.1
[    2s] -- Detecting C compiler ABI info
[    2s] -- Detecting C compiler ABI info - done
[    2s] -- Check for working C compiler: /usr/bin/cc - skipped
[    2s] -- Detecting C compile features
[    2s] -- Detecting C compile features - done
[    2s] -- Looking for alloca.h
[    2s] -- Looking for alloca.h - found
[    2s] -- Looking for errno.h
[    2s] -- Looking for errno.h - found
[    2s] -- Looking for fcntl.h
[    2s] -- Looking for fcntl.h - found
[    2s] -- Looking for netdb.h
[    2s] -- Looking for netdb.h - found
[    2s] -- Looking for poll.h
[    2s] -- Looking for poll.h - found
[    2s] -- Looking for pwd.h
[    2s] -- Looking for pwd.h - found
[    2s] -- Looking for signal.h
[    2s] -- Looking for signal.h - found
[    2s] -- Looking for sys/file.h
[    2s] -- Looking for sys/file.h - found
[    2s] -- Looking for sys/inotify.h
[    2s] -- Looking for sys/inotify.h - found
[    2s] -- Looking for sys/socket.h
[    2s] -- Looking for sys/socket.h - found
[    2s] -- Looking for sys/stat.h
[    2s] -- Looking for sys/stat.h - found
[    2s] -- Looking for sys/time.h
[    2s] -- Looking for sys/time.h - found
[    2s] -- Looking for sys/types.h
[    2s] -- Looking for sys/types.h - found
[    2s] -- Looking for sys/un.h
[    2s] -- Looking for sys/un.h - found
[    2s] -- Looking for sys/wait.h
[    3s] -- Looking for sys/wait.h - found
[    3s] -- Looking for syslog.h
[    3s] -- Looking for syslog.h - found
[    3s] -- Looking for time.h
[    3s] -- Looking for time.h - found
[    3s] -- Looking for unistd.h
[    3s] -- Looking for unistd.h - found
[    3s] -- Looking for wait.h
[    3s] -- Looking for wait.h - found
[    3s] -- Looking for close_range
[    3s] -- Looking for close_range - found
[    3s] -- Looking for strcasecmp
[    3s] -- Looking for strcasecmp - found
[    3s] -- Looking for _stricmp
[    3s] -- Looking for _stricmp - not found
[    3s] -- Looking for strncasecmp
[    3s] -- Looking for strncasecmp - found
[    3s] -- Looking for _strnicmp
[    3s] -- Looking for _strnicmp - not found
[    3s] -- Looking for stdint.h
[    3s] -- Looking for stdint.h - found
[    3s] -- Looking for stddef.h
[    3s] -- Looking for stddef.h - found
[    3s] -- Check size of unsigned long
[    3s] -- Check size of unsigned long - done
[   88s] [ 11%] Creating directories for 'confuse-populate'
[   88s] [ 22%] Performing download step (download, verify and extract) for 'confuse-populate'
[   88s] -- Downloading...
[   88s]    dst='/home/abuild/rpmbuild/BUILD/postsrsd-2.0.1/build/_deps/confuse-subbuild/confuse-populate-prefix/src/confuse-3.3.tar.gz'
[   88s]    timeout='none'
[   88s]    inactivity timeout='none'
[   88s] -- Using src='https://github.com/libconfuse/libconfuse/releases/download/v3.3/confuse-3.3.tar.gz'
[   88s] -- Retrying...
[   88s] -- Using src='https://github.com/libconfuse/libconfuse/releases/download/v3.3/confuse-3.3.tar.gz'
[   88s] -- Retry after 5 seconds (attempt #2) ...
[   88s] -- Using src='https://github.com/libconfuse/libconfuse/releases/download/v3.3/confuse-3.3.tar.gz'
[   88s] -- Retry after 5 seconds (attempt #3) ...
[   88s] -- Using src='https://github.com/libconfuse/libconfuse/releases/download/v3.3/confuse-3.3.tar.gz'
[   88s] -- Retry after 15 seconds (attempt #4) ...
[   88s] -- Using src='https://github.com/libconfuse/libconfuse/releases/download/v3.3/confuse-3.3.tar.gz'
[   88s] -- Retry after 60 seconds (attempt #5) ...
[   88s] -- Using src='https://github.com/libconfuse/libconfuse/releases/download/v3.3/confuse-3.3.tar.gz'
[   88s] CMake Error at confuse-subbuild/confuse-populate-prefix/src/confuse-populate-stamp/download-confuse-populate.cmake:170 (message):
[   88s]   Each download failed!
[   88s]
[   88s]     error: downloading 'https://github.com/libconfuse/libconfuse/releases/download/v3.3/confuse-3.3.tar.gz' failed
[   88s]           status_code: 6
[   88s]           status_string: "Couldn't resolve host name"
[   88s]           log:
[   88s]           --- LOG BEGIN ---
[   88s]           getaddrinfo(3) failed for github.com:443
roehling commented 1 year ago

Have you tried setting -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS as described here?

jengelh commented 1 year ago

I suppose I read it once years ago since some defines were in our .spec, but not read recently for 2.0. Oh well. :^)

jengelh commented 1 year ago

For the record, this requires FETCHCONTENT_TRY_FIND_PACKAGE_MODE requires cmake 3.24.

cryptomilk commented 1 year ago

This should be fixed by setting FIND_PACKAGE_ARGS argument in FetchContent_Declare() so that it tries to find it locally first. Then it will also work with cmake 3.14.

FetchContent_Declare(
...
FIND_PACKAGE_ARGS Confuse 3.3)

Then it should fist check if it is available on the system an fall back to download it otherwise.

See https://cmake.org/cmake/help/latest/module/FetchContent.html#integrating-with-find-package

roehling commented 1 year ago

This should be fixed by setting FIND_PACKAGE_ARGS argument in FetchContent_Declare() so that it tries to find it locally first. Then it will also work with cmake 3.14.

No, FIND_PACKAGE_ARGS has been introduced with CMake 3.24, because that is the CMake version where the find_package() integration was added.

cryptomilk commented 1 year ago

Have you tried the following?

find_package(Confuse 3.3)
if (NOT Confuse_FOUND)
  FetchContent_Declare(...)
endif()
roehling commented 1 year ago

I considered this early on, but decided against it. If someone gives me a compelling reason why they absolutely need to link against system libraries but cannot upgrade to a recent CMake, I might reconsider.

cryptomilk commented 1 year ago

It is fairly simple. If you package software for Linux distributions, you have to use the system libraries! The build systems used by Fedora or openSUSE do not have an internet connection for security reasons.

If you want to package postsrsd current versions (like openSUSE 15.4, CentOS Stream 9) you don't have cmake 3.24 available, but you have cmake 3.14 which is also the minimum version set in the CMakeLists.txt.