Public bug reported:
# Bug Report: `libhighs-dev` — doubled prefix in `highs.pc` pkg-config
file
**Package:** `libhighs-dev`
**Version:** `1.12.0+ds1-2ubuntu1` (Ubuntu Resolute)
**Severity:** important
---
## Summary
The installed `highs.pc` pkg-config file contains doubled `/usr` prefixes in its
`libdir` and `includedir` variables, causing `pkg-config --cflags highs` and
`pkg-config --libs highs` to return non-existent paths.
## Observed behaviour
```
$ pkg-config --cflags highs
-I/usr/usr/include/highs
$ pkg-config --libs highs
-L/usr/usr/lib/x86_64-linux-gnu -lhighs
```
Contents of `/usr/lib/x86_64-linux-gnu/pkgconfig/highs.pc`:
```ini
prefix=/usr
libdir=/usr/usr/lib/x86_64-linux-gnu
includedir=/usr/usr/include/highs
...
```
The paths `/usr/usr/lib/...` and `/usr/usr/include/...` do not exist, so any
project that tries to build against `libhighs-dev` via pkg-config will fail to
compile or link.
## Expected behaviour
```
$ pkg-config --cflags highs
-I/usr/include/highs
$ pkg-config --libs highs
-L/usr/lib/x86_64-linux-gnu -lhighs
```
## Root cause
In `debian/rules`, `TARGET_LIBDIR` is defined as an already-prefixed
relative path:
```makefile
TARGET_PREFIX = usr
TARGET_LIBDIR = $(TARGET_PREFIX)/lib/$(DEB_HOST_MULTIARCH) # =
usr/lib/x86_64-linux-gnu
```
Then both are passed to CMake:
```makefile
-C skbuild.cmake.args=-DCMAKE_INSTALL_PREFIX=$(TARGET_PREFIX) \ # = usr
-C skbuild.cmake.args=-DCMAKE_INSTALL_LIBDIR=$(TARGET_LIBDIR) \ # =
usr/lib/x86_64-linux-gnu ← BUG
-C skbuild.cmake.args=-DCMAKE_INSTALL_INCLUDEDIR=$(TARGET_PREFIX)/include # =
usr/include ← BUG
```
CMake computes the full paths as:
```
CMAKE_INSTALL_FULL_LIBDIR = CMAKE_INSTALL_PREFIX / CMAKE_INSTALL_LIBDIR
= usr / usr/lib/x86_64-linux-gnu
= usr/usr/lib/x86_64-linux-gnu
```
which, after installation under `/`, becomes `/usr/usr/lib/x86_64-linux-
gnu`.
`CMAKE_INSTALL_LIBDIR` and `CMAKE_INSTALL_INCLUDEDIR` must be relative to the
prefix (without containing the prefix), but they were mistakenly set to paths
that already included `usr/`.
## Fix
In `debian/rules`, change the two CMake arguments to prefix-relative
paths:
```diff
- -C skbuild.cmake.args=-DCMAKE_INSTALL_LIBDIR=$(TARGET_LIBDIR) \
- -C
skbuild.cmake.args=-DCMAKE_INSTALL_INCLUDEDIR=$(TARGET_PREFIX)/include
+ -C skbuild.cmake.args=-DCMAKE_INSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \
+ -C skbuild.cmake.args=-DCMAKE_INSTALL_INCLUDEDIR=include
```
This makes CMake correctly compute:
```
CMAKE_INSTALL_FULL_LIBDIR = usr / lib/x86_64-linux-gnu →
/usr/lib/x86_64-linux-gnu ✓
CMAKE_INSTALL_FULL_INCLUDEDIR = usr / include/highs → /usr/include/highs
✓
```
Note: `TARGET_LIBDIR` is still needed for other purposes in the rules file
(e.g. `BUILD_LIBDIR`, `dh_link` calls) and should not be removed.
** Affects: highs (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2142670
Title:
highs pc file is not correct
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/highs/+bug/2142670/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs