id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
11760 "'sage-location' shouldn't ""initialize"" .pc (pkg-config) files more than once" leif "The logic of ""initializing"" `.pc` files exactly once is currently broken, which at the moment ""only"" causes trouble with libpng if `pkg-config` is installed.
The main reason is that `sage-location` doesn't really check whether a `.pc` file already contains a definition of `SAGE_ROOT`, and unconditionally replaces any occurrences of `$SAGE_ROOT` (i.e., its current value) by `${SAGE_ROOT}`, then adding a (in the case of `update_pkgconfig_files()`, ''replacing'' the first) line defining `SAGE_ROOT` to have the current value.
The specific problem with libpng (see e.g. #11686, which was originally intended to just again fix a ''completely unrelated'' issue with the matplotlib spkg) arises since it installs ''both'' a `libpng12.pc` file ''and a symbolic link'' `libpng.pc`, the latter pointing to the former. `sage-location` now ""initializes"" all of Sage's `.pc` files, not checking whether a `.pc` file is just a symbolic link to another one, nor checking whether a file already got modified as mentioned above.
Note that the ""initialization"" doesn't take place ''during'' a build, but when Sage is started for the first time, also when e.g. running tests, such that problems with modified `.pc` files occur later, when one tries to (re)install some package(s), which includes ''upgrading'' Sage.
In the long run, `sage-location` shouldn't (have to) deal with `.pc` files at all, but we IMHO need a '''quick fix''' until we have a better, more general solution to ''all'' issues with `pkg-config`. (There are a couple of other issues; cf. for example #10202, #9668, #11687, #11681.) Therefore ''this'' ticket isn't intended to fix any of the other issues.
----
Apply
1. [attachment:trac_11760-avoid_multiple_defs_of_SAGE_ROOT.scripts.patch]
1. [attachment:trac_11760-additional_improvements_to_pkgconfig_funs.optional.scripts.patch]
to the Sage '''scripts repository'''.
" defect closed blocker sage-4.7.2 scripts fixed pkgconfig libpng Duplicate definition SAGE_ROOT sage-4.7.2.alpha4 Leif Leonhardy John Palmieri N/A