[Bug]: Is pkg-config file relocatable?
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 6
- Forks
- 11
- Avg merge
- 18h 7m
- Merged PRs (30d)
- 1
Description
### What happened?
The package config file generated by Vernier includes absolute paths that point to the install locations. These are set when CMake is first run and will either point to the default `GNUInstallVars` path or the value of the `--install-prefix` command line argument, e.g.
```
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Libs: -L${libdir} -lvernier -lvernier_c -lvernier_f
Cflags: -I${includedir}
```
This means that setting `--prefix` with `cmake --install` will result in mismatched paths. It also means that the install cannot be easily relocated because the paths are absolute. One solution to this would be to change the variables to use `${pcfiledir}` which expands to the directory containing the `.pc` file and which can be used with relative paths to make the installation relocatable, e.g.
```
libdir=${pcfiledir}/../
includedir=${pcfiledir}/../../@CMAKE_INSTALL_INCLUDEDIR@
```
This doesn't appear to be a problem if Vernier is installed with spack - presumably because spack edits the hardwired paths as one of its install actions.
### Version
main
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the CMake template or generation entry point for Vernier’s pkg-config file, then compare configuration-time install paths with paths during `cmake --install`. Verify the chosen `${pcfiledir}`-based behavior by installing with a custom prefix and checking that the generated `.pc` file resolves its library and include paths correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100