opus.pc variable substitution bug
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 3.3k
- Forks
- 808
- PR merge metrics
- No merged PRs in 30d
Description
There is a problem with variable substitution when generating the opus.pc pkg-config file using CMake.
CMakeLists.txt executes configure_file(opus.pc.in opus.pc), which according to the CMake docs will substitute occurrences of @VAR@ AND ${VAR} in opus.pc.in. See: https://cmake.org/cmake/help/v3.10/command/configure_file.html
However, since this is a .pc file which uses the ${VAR} syntax for its own substitution purposes, we really only want @VAR@ to be substituted. The problem is that ${libdir} and ${includedir} in the opus.pc.in file (shown below) are substituted when they shouldn't be. This results in absolute paths being embedded in -L and -l flags, breaking pkg-config's own substitution/relocation/prefix mechanism.
Libs: -L${libdir} -lopus
Cflags: -I${includedir}/opus
I fixed this locally by adding the @ONLY attribute: configure_file(opus.pc.in opus.pc @ONLY). The resulting opus.pc file is relocatable and works smoothly with the usual pkg-config --define-prefix mechanism.
Contributor guide
No contributing guide indexed for this repository
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
Inspect CMakeLists.txt and opus.pc.in, starting with the configure_file call and the ${libdir} and ${includedir} entries. Verify that only CMake-style substitutions occur and that the generated opus.pc preserves pkg-config variables for relocation; confirm the result with the existing build and generated file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cmake
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100