CMake 3.5's pkg-config support broken

Bug #1563548 reported by Michał Sawicz
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cmake (Ubuntu)
Fix Released
High
Gianfranco Costamagna

Bug Description

With the new cmake 3.5 version in xenial, pkg-config variables seem broken.

Given the following CMakeLists.txt:

cmake_minimum_required(VERSION 3.2)
include(FindPkgConfig)
pkg_check_modules(GLIB2 glib-2.0)

Comparing output from:

$ cmake .; grep ^GLIB2 CMakeCache.txt

Yields the _INCLUDEDIR, _LIBDIR and _PREFIX variables empty: http://pastebin.ubuntu.com/15555106/

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: cmake 3.5.0-1ubuntu1
ProcVersionSignature: Ubuntu 4.4.0-15.31-generic 4.4.6
Uname: Linux 4.4.0-15-generic x86_64
ApportVersion: 2.20-0ubuntu3
Architecture: amd64
CurrentDesktop: Unity
Date: Tue Mar 29 22:47:54 2016
SourcePackage: cmake
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Michał Sawicz (saviq) wrote :
description: updated
Changed in cmake (Ubuntu):
assignee: nobody → LocutusOfBorg (costamagnagianfranco)
importance: Undecided → High
Revision history for this message
Steve Langasek (vorlon) wrote :

This is fallout from a post-beta merge of a new upstream version of cmake.

A feature freeze exception of a core build tool is altogether unreasonable. When it introduces regressions, it is unacceptable.

I have communicated to Michał and Gianfranco on IRC that if this issue is not resolved by my end of day, I intend to revert the merge, which clearly did not receive adequate testing.

Revision history for this message
Michał Sawicz (saviq) wrote :

Just confirming that the 3.5.0-1ubuntu2 upload doesn't help unfortunately.

Note cmake-extras needs to be rebuilt again (no-change) if cmake will get reverted (yes, we need to come up with some better packaging there - at least appropriately versioned dependencies on cmake).

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

hotfix for the bug.

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

the package is building on my ppa https://launchpad.net/~costamagnagianfranco/+archive/ubuntu/costamagnagianfranco-ppa

BTW I honestly think this was a typo in the set variable.
Probably a change like
+- _pkgconfig_set("${_pkg_check_modules_pkg}_${variable}" "${${_pkg_check_modules_pkg}_${variable}}")
++ _pkgconfig_set("${_pkg_check_prefix}_${variable}" "${${_pkg_check_prefix}_${variable}}")

is already enough.
Having them both results in something like:

GLIB2_INCLUDEDIR:INTERNAL=/usr/include
GLIB2_LIBDIR:INTERNAL=/usr/lib/x86_64-linux-gnu
GLIB2_PREFIX:INTERNAL=/usr

and

glib-2.0_INCLUDEDIR:INTERNAL=/usr/include
glib-2.0_LIBDIR:INTERNAL=/usr/lib/x86_64-linux-gnu
glib-2.0_PREFIX:INTERNAL=/usr

I think we could have just the former version.

Revision history for this message
Dirk Thomas (dthomas-b) wrote :

Only variables started with the passed prefix (in this case `GLIB2`) should be set. I don't think the variables starting with `glib-2.0_` should be set.

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :
Revision history for this message
Dirk Thomas (dthomas-b) wrote :

The upstream code in the tarball for version 3.5.1 (https://cmake.org/files/v3.5/cmake-3.5.1.tar.gz) looks as follows:

foreach (variable IN ITEMS PREFIX INCLUDEDIR LIBDIR)
  _pkgconfig_set("${_pkg_check_prefix}_${variable}" "${${_pkg_check_prefix}_${variable}}")
endforeach ()

The fix was introduced upstream in https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f4f9054 and is mentioned in the last comment in this ticket: https://public.kitware.com/Bug/view.php?id=15903

Maybe this should be updated to use 3.5.1 which seems to have fixed that problem already?

Michał Sawicz (saviq)
Changed in cmake (Ubuntu):
status: New → In Progress
Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :
Steve Langasek (vorlon)
Changed in cmake (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cmake - 3.5.0-1ubuntu3

---------------
cmake (3.5.0-1ubuntu3) xenial; urgency=medium

  * Fix FindPkgModules.cmake (LP: #1563548)
    seems that a typo was preventing the correct internal variables from being set.

 -- Gianfranco Costamagna <email address hidden> Wed, 30 Mar 2016 00:19:04 +0200

Changed in cmake (Ubuntu):
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.