[Debian-science-sagemath] highs package package bug in *.pc file
Dima Pasechnik
dimpase at gmail.com
Sat Mar 7 18:43:31 GMT 2026
Highs is considered for inclusion in Sage. The latest Debian version
has a bug in highs.pc, see
https://github.com/sagemath/sage/pull/41105#issuecomment-4016949796
(I didn't test the fix proposed, but it's up to you)
cxzhong left a comment (sagemath/sage#41105)
> > delete the debian.txt, since its pkgconfig file is broken
>
> Well, they will fix it. What exactly is broken in there? One can test ...
Package: highs
Version: 1.12.0+ds1-3
Severity: important
Tags: patch
The installed highs.pc pkg-config file contains incorrect libdir and
includedir paths with a duplicated "usr" prefix, causing compilation and
linking failures for any project using pkg-config to locate HiGHS.
Current (broken) highs.pc:
prefix=/usr
libdir=/usr/usr/lib/x86_64-linux-gnu
includedir=/usr/usr/include/highs
The correct paths should be:
libdir=/usr/lib/x86_64-linux-gnu
includedir=/usr/include/highs
Impact: Any software using "pkg-config --cflags highs" or
"pkg-config --libs highs" gets non-existent paths and fails to
compile or link.
Root cause:
In debian/rules, CMAKE_INSTALL_PREFIX is set to the relative path "usr",
while CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR are also set to
paths starting with "usr/":
TARGET_PREFIX = usr
TARGET_LIBDIR = $(TARGET_PREFIX)/lib/$(DEB_HOST_MULTIARCH)
SKBUILD_ARGS = \
-C skbuild.cmake.args=-DCMAKE_INSTALL_PREFIX=$(TARGET_PREFIX) \
-C skbuild.cmake.args=-DCMAKE_INSTALL_LIBDIR=$(TARGET_LIBDIR) \
-C skbuild.cmake.args=-DCMAKE_INSTALL_INCLUDEDIR=$(TARGET_PREFIX)/include
The upstream highs.pc.in template uses CMAKE_INSTALL_FULL_LIBDIR and
CMAKE_INSTALL_FULL_INCLUDEDIR:
prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@/highs
CMake's GNUInstallDirs computes the FULL_ variants by prepending the
prefix to relative paths. Since both the prefix ("usr") and the dir
variables ("usr/lib/...") are relative, CMake concatenates them:
CMAKE_INSTALL_FULL_LIBDIR = usr/usr/lib/x86_64-linux-gnu
CMAKE_INSTALL_FULL_INCLUDEDIR = usr/usr/include
The post-build sed command only strips $(CURDIR) but does not fix the
double "usr" issue:
sed -i "s|$(CURDIR)||g" $(TARGET_LIBDIR)/pkgconfig/highs.pc
---
Best,
Dima
More information about the Debian-science-sagemath
mailing list