[SRU] cmake: FindPkgConfig: imported target missing libraries

Bug #1922417 reported by Matwey V. Kornilov
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cmake (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
Fix Released
Undecided
Gianfranco Costamagna

Bug Description

[Impact]
* People using pkgconfig and standard library location (but -L pointing to different place)
[Test Plan]
* pkg-config --libs libmutter-2

cat ../CMakeLists.txt
project(1922417)
cmake_minimum_required(VERSION 3.10)
include(FindPkgConfig QUIET)
pkg_check_modules(mutter-2 REQUIRED)

[ Other info ]
Hello,

Description: Ubuntu 18.04.5 LTS
Release: 18.04

cmake:
  Installed: 3.10.2-1ubuntu2.18.04.1
  Candidate: 3.10.2-1ubuntu2.18.04.1
  Version table:
 *** 3.10.2-1ubuntu2.18.04.1 500
        500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     3.10.2-1ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages

I am running 3.10.2 at Bionic Beaver 18.04.5 and suffering from the following known issue: https://gitlab.kitware.com/cmake/cmake/-/issues/17954
Unfortunately, the issue was fixed only in 3.12 and 3.10.2 is still affected.

Can we please have the following patch back-ported for 18.04.5 updates
https://gitlab.kitware.com/cmake/cmake/-/commit/ac5731a7e380349f19dc319e6c31e189b5faba93

I've checked that the patch can be applied clearly on top of the 3.10.2, it is simple and self-consistent, so I don't expect that it will break something else.

I've also verified that the patch indeed fixes the issue for me. Since the patch affects only CMake module and don't requires cmake rebuild it was simple enough.

Attached here is a copy of ac5731a7e380349f19dc319e6c31e189b5faba93

Revision history for this message
Matwey V. Kornilov (matwey-kornilov) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "0001-FindPkgConfig-correct-library-search-path-for-import.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Changed in cmake (Ubuntu):
status: New → Fix Released
Changed in cmake (Ubuntu Bionic):
status: New → In Progress
assignee: nobody → Gianfranco Costamagna (costamagnagianfranco)
description: updated
summary: - cmake: FindPkgConfig: imported target missing libraries
+ [SRU] cmake: FindPkgConfig: imported target missing libraries
Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

@Matwey please provide a simple test case to check if the bug is fixed!

thanks

Gianfranco

Revision history for this message
Robie Basak (racb) wrote :

Sorry, I don't understand the bug or the test plan. What's the use case that is broken? What's the expected result, and what happens instead?

I also see no regression analysis as required by https://wiki.ubuntu.com/StableReleaseUpdates#Procedure. Please consider what might go wrong with this. Will reverse dependencies in Bionic rebuild differently, for example?

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

Hello Robie, the cmake if I understand correctly checks the list of libraries returned from pkg-config call, and adds them only if found on the system.
The problem is that if the pkgconfig call has a -L *but* libraries listed somewhere else (e.g. in standard ld.so.conf path), the call strips them from the list.

So, in this case you get a subset of libraries returned to cmake, and with this patch, the list of libraries will increase (not decrease). With a default as-needed flag turned on, the side effect will be to have them ignored in such cases, nothing to worry about.

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

(I suspect people were manually adding them with some hacks in cmake files, now they can remove such hacks)

Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Matwey, or anyone else affected,

Accepted cmake into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/cmake/3.10.2-1ubuntu2.18.04.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in cmake (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic
Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

@Matwey please test the proposed package. thanks

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

The package looks good to me!

tags: added: verification-done verification-done-bionic
removed: verification-needed verification-needed-bionic
Revision history for this message
Chris Halse Rogers (raof) wrote : Update Released

The verification of the Stable Release Update for cmake has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cmake - 3.10.2-1ubuntu2.18.04.2

---------------
cmake (3.10.2-1ubuntu2.18.04.2) bionic; urgency=medium

  [ Matwey V. Kornilov ]
  * debian/patches/0001-FindPkgConfig-correct-library-search-path-for-
    import.patch: Cherry-pick upstream fix for pkg-config failure to find
    the library if -L was provided (and library not in that path)
    LP: #1922417

 -- Gianfranco Costamagna <email address hidden> Sun, 04 Apr 2021 16:10:12 +0200

Changed in cmake (Ubuntu Bionic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.