tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

cmake find_library() vs depends



CMake's find_library() function is apparently not fit for purpose in a pkgsrc environment. It is not buildlink-aware, and will simply go looking around the file system for arbitrary libraries.

This causes a problem with e.g. execinfo:

  https://us-central.manta.mnx.io/pkgsrc/public/reports/Darwin/12.3/x86_64/20240510.1437/protobuf-c-1.5.0nb4/build.log

as cmake depends on a bunch of packages, which are pulled into the file system for any package that uses cmake as a build-time dependency.

It looks like there are a number of hacks trying to work around this, for example:

  $ git grep -C2 rm:-lexecinfo
  devel/abseil/Makefile-.if ${OPSYS} == "Darwin"
  devel/abseil/Makefile-.  if exists(${OSX_SDK_PATH}/usr/include/execinfo.h)
  devel/abseil/Makefile:BUILDLINK_TRANSFORM+=     rm:-lexecinfo
  devel/abseil/Makefile-.  endif
  devel/abseil/Makefile-.endif
  --
  x11/qt5-qtbase/Makefile-# -lexecinfo is bundled in libc
  x11/qt5-qtbase/Makefile-.  if exists(${OSX_SDK_PATH}/usr/include/execinfo.h)
  x11/qt5-qtbase/Makefile:BUILDLINK_TRANSFORM+=           rm:-lexecinfo
  x11/qt5-qtbase/Makefile-.  endif
  x11/qt5-qtbase/Makefile-.elif ${OPSYS} == "Linux"
  --
  x11/qt6-qtbase/Makefile-# -lexecinfo is bundled in libc
  x11/qt6-qtbase/Makefile-.  if exists(${OSX_SDK_PATH}/usr/include/execinfo.h)
  x11/qt6-qtbase/Makefile:BUILDLINK_TRANSFORM+=           rm:-lexecinfo
  x11/qt6-qtbase/Makefile-.  endif
  x11/qt6-qtbase/Makefile-.elif ${OPSYS} == "Linux"

and no doubt this is biting us in other places for the other dependencies that cmake pulls in.

In the specific case of libexecinfo, why does cmake depend on it? I've built it fine without the include on both macOS and SmartOS. Given this problem, I'd prefer it if cmake was built with as few dependencies as possible.

I'd go further and argue we should have two cmake packages. One that is as small as possible that is only used for building packages (let's call it cmake-build or something), and then the main cmake package that is full-featured with e.g. curl support (that we would never want enabled for building anyway) for end users to use outside of pkgsrc.

--
Jonathan Perkin   -   mnx.io   -   pkgsrc.smartos.org
Open Source Complete Cloud   www.tritondatacenter.com


Home | Main Index | Thread Index | Old Index