Building xorg-gtest fails with new pkg-config
Bug #1523508 reported by
Marco Trevisan (Treviño)
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pkg-config |
Fix Released
|
Medium
|
|||
pkg-config (Ubuntu) |
Fix Released
|
High
|
Unassigned |
Bug Description
As per the pkg-config change of unquoting variables, building xorg-gtest (in compiz for example) fails.
See more details in the linked upstream bug.
tags: | added: rls-x-incoming |
Changed in pkg-config: | |
importance: | Unknown → Medium |
status: | Unknown → Confirmed |
Changed in pkg-config: | |
status: | Confirmed → Fix Released |
To post a comment you must log in.
I'm Marco, from the Ubuntu desktop team; and we're facing an issue with
recent pkg-config when using it in cmake.
As per commit 50c2867f4a6981e 085c721d936c96f 174f11f415 in pkg-config,
variables are unquoted.
This is fine for most of scenarios, but when there are variables such as
CPPflags= -I${includedir} -I${includedir} /xorg -I${sourcedir} \ CONF_PATH= \"${datarootdir }/xorg/ gtest/dummy. conf\" \ DIR=\"/ tmp\"
-DDUMMY_
-DLOGFILE_
Then when using the new pkg-config "pkg-config --variable= CPPflags"
returns something like:
-I/usr/include -I/usr/include/xorg -I/usr/ src/xorg- gtest \ CONF_PATH= "/usr/share/ xorg/gtest/ dummy.conf" \ DIR="/tmp"
-DDUMMY_
-DLOGFILE_
Which is wrong since the quotes aren't escaped.
Changing the variable so that it uses something like DIR=\\\ "/tmp\\ \"
-DLOGFILE_
Makes it return the proper thing, but not in a subshell, but it doesn't
seem the case.
In fact pkg-config seems to return the proper thing when called in a
subshell, but not when used directly.
I.e.:
$ pkg-config --variable=CPPflags xorg-gtest src/xorg- gtest CONF_PATH= "/usr/share/ xorg/gtest/ dummy.conf" -DLOGFILE_ DIR="/tmp"
+ pkg-config --variable=CPPflags xorg-gtest
-I/usr/include -I/usr/include/xorg -I/usr/
-DDUMMY_
$ gcc-5 $(pkg-config --variable=CPPflags xorg-gtest) foo.c src/xorg- gtest CONF_PATH= "/usr/share/ xorg/gtest/ dummy.conf" ' DIR="/tmp" ' foo.c
++ pkg-config --variable=CPPflags xorg-gtest
+ gcc-5 -I/usr/include -I/usr/include/xorg -I/usr/
'-DDUMMY_
'-DLOGFILE_
As you can see when called in a subshell, the variables are properly
single-quoted, making the thing work. But when calling this directly
there are no single quotes.
So I'm wondering what's the best way to fix this case.