-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Related
Recap: /usr/local/include is inserted before /usr/local/include/openjpeg-2.1, which causes problems if two versions of openjpeg are installed.
Observations:
- It sometimes succeeds even without the fix in mentioned PR.
- The version specific directory is added twice.
- When it succeeds, openjpeg is the first package tried.
- As a result, converting the inline dict in the for loop in build_extensions to a
collections.OrderedDictalso resolves the issue.
Root cause
Ordering aside, the root cause is that packages are essentially configured twice in different ways. First pkg-config is used and then best guess directory searches are used to do the same thing.
Possible solutions
If this were to be fixed without the insert override from the PR, then fixing it relies on kits ordering. Not ideal.
A more generic approach is to use the following order of events:
- Based on the platform, add the needed "generic" directories, so top-level "lib" and "include" paths.
- Go through the pkg-config loop, but always prepend directories (in the reverse order as returned by pkg-config). Set state for found libraries.
- Add available libraries, but only those not already configured by pkg-config.
Analysis
Since this braindead OpenJPEG versioning is likely to be an exception, as is having two versions installed, the current fix from the PR looks "good enough" to me, but if maintainers want the approach from above, I'm happy to make a new PR as I'm in a good position to test it.
I do not actually understand, why packages found by pkg-config are revisited in the "feature" code, so that would have to be explained.
P.S.: I pretty much expect the choice will be made to not go for an elaborate fix and as such this issue logs the problem and causes.