Subject: bug#78029: libssh-0.11.1 fails to cross compile

From: [email-masked]
Date: Thu, 24 Apr 2025 09:21:17 +0200 (CEST)

Hello,

Since commit b12d44dd5e35ac236bf3fbb5619b9c8c2f42c902 turned on tests and switchted to gexps the package no longer cross compiles, which is a dependency of guile-ssh (and guix).

When cross compiling to a 32bit target (tested with i586-pc-gnu) something goes wrong ungexp-splicing the extra CFLAGS and the literal list procedure is inserted for the cflags:

starting phase `configure'
source directory: "/tmp/guix-build-libssh-0.11.1.drv-0/libssh-0.11.1" (relative from build: "../libssh-0.11.1")
build directory: "/tmp/guix-build-libssh-0.11.1.drv-0/build"
running 'cmake' with arguments ("../libssh-0.11.1" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" "-DCMAKE_INSTALL_PREFIX=/gnu/store/q1zi25van8xrzmi7gmj28rw8q9cwx7s1-libssh-0.11.1" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE" "-DCMAKE_INSTALL_RPATH=/gnu/store/q1zi25van8xrzmi7gmj28rw8q9cwx7s1-libssh-0.11.1/lib" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DCMAKE_C_COMPILER=i586-pc-gnu-gcc" "-DCMAKE_CXX_COMPILER=i586-pc-gnu-g++" "-DCMAKE_SYSTEM_NAME=GNU" "-DWITH_GCRYPT=ON" "-DUNIT_TESTING=ON" #<procedure list _> "-DCMAKE_C_FLAGS=-g -O2 -Wno-incompatible-pointer-types")
error: in phase 'configure': uncaught exception:
wrong-type-arg #f "Wrong type (expecting ~A): ~S" ("string" #<procedure list _>) (#<procedure list _>) 

Even a 64bit target (tested with aarch64-linux-gnu) fails because it cant find cmocka but i assume the tests can not be run when cross compiling anyway?
CMake Error at /gnu/store/mnmn1rcllrimsyr9k8r9i00jqfmcrflk-cmake-minimal-cross-3.24.2/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find CMocka (missing: CMOCKA_LIBRARIES CMOCKA_INCLUDE_DIR)
Call Stack (most recent call first):
  /gnu/store/mnmn1rcllrimsyr9k8r9i00jqfmcrflk-cmake-minimal-cross-3.24.2/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/Modules/FindCMocka.cmake:63 (find_package_handle_standard_args)
  CMakeLists.txt:59 (find_package)

There is also a deperecation warning for the gcrypt backend

-- Found GCrypt: /gnu/store/r02yh1bm9gbm2klmmvqy483v50rmnsw8-libgcrypt-1.11.0/include (found suitable version "1.11.0", minimum required is "1.5.0") 
CMake Warning at CMakeLists.txt:51 (message):
  libgcrypt cryptographic backend is deprecated and will be removed in future
  releases.

Thanks.