Include paths specified with -isystem are not mangled #94

Closed
opened 2016-08-18 22:30:20 +00:00 by yann-morin-1998 · 7 comments
yann-morin-1998 commented 2016-08-18 22:30:20 +00:00 (Migrated from github.com)

When a .pc file specifies include paths using -isystem, those paths
are not prefixed with PKG_CONFIG_SYSROOT_DIR.

For example, the libbsd-overlay.pc (from libbsd) contains:

Cflags: -isystem ${includedir}/bsd -DLIBBSD_OVERLAY

Which when in cross-compilation causes build failures because the path
isn't prefixed with PKG_CONFIG_SYSROOT_DIR and thus points to the
build system headers (if they are present).

When a .pc file specifies include paths using `-isystem`, those paths are not prefixed with `PKG_CONFIG_SYSROOT_DIR`. For example, the [libbsd-overlay.pc](https://cgit.freedesktop.org/libbsd/tree/src/libbsd-overlay.pc.in) (from [libbsd](https://libbsd.freedesktop.org/wiki/)) contains: ``` Cflags: -isystem ${includedir}/bsd -DLIBBSD_OVERLAY ``` Which when in cross-compilation causes build failures because the path isn't prefixed with `PKG_CONFIG_SYSROOT_DIR` and thus points to the build system headers (if they are present).

What does ${includedir} look like in that .pc file? It may need to be fixed.

What does ${includedir} look like in that .pc file? It may need to be fixed.
yann-morin-1998 commented 2016-08-19 17:24:37 +00:00 (Migrated from github.com)

Hello,

Here is the libbsd-overlay.pc as installed:

prefix=/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libbsd
Description: Utility functions from BSD systems (overlay)
Version: 0.8.3
URL: https://libbsd.freedesktop.org/
Libs: -L${libdir} -lbsd
Cflags: -isystem ${includedir}/bsd -DLIBBSD_OVERLAY

Regards,
Yann E. MORIN.

Hello, Here is the `libbsd-overlay.pc` as installed: ``` prefix=/usr exec_prefix=/usr libdir=${exec_prefix}/lib includedir=${prefix}/include Name: libbsd Description: Utility functions from BSD systems (overlay) Version: 0.8.3 URL: https://libbsd.freedesktop.org/ Libs: -L${libdir} -lbsd Cflags: -isystem ${includedir}/bsd -DLIBBSD_OVERLAY ``` Regards, Yann E. MORIN.

Interesting. I'll see what I can do.

Interesting. I'll see what I can do.
yann-morin-1998 commented 2016-08-19 20:56:56 +00:00 (Migrated from github.com)

Great, thanks!

If you need testing, do not hesitate to ask!

Regards,
Yann E. MORIN.

Great, thanks! If you need testing, do not hesitate to ask! Regards, Yann E. MORIN.
yann-morin-1998 commented 2016-08-24 11:12:17 +00:00 (Migrated from github.com)

Hello again,

I was looking back at this issue, and did some experiment. I just noticed that, when
replacing -isystem with just -I, the path was not mangled either:

Cflags: -I ${includedir}/bsd -DLIBBSD_OVERLAY

$ PKG_CONFIG_SYSROOT_DIR=/some/path pkgconf --cflags libbsd-overlay
-I /usr/include/bsd -DLIBBSD_OVERLAY

But now, if I remove the space between -I and the path, it works:

Cflags: -I${includedir}/bsd -DLIBBSD_OVERLAY

$ PKG_CONFIG_SYSROOT_DIR=/some/path pkgconf --cflags libbsd-overlay
-I/some/path/usr/include/bsd -DLIBBSD_OVERLAY

It is perfectly valid for -I to be followed by a space.

The issue also happens for -L if it is followed by a space, which is also perfectly valid.

Should I open a different issue for those?

Regards,
Yann E. MORIN.

Hello again, I was looking back at this issue, and did some experiment. I just noticed that, when replacing `-isystem` with just `-I`, the path was not mangled either: ``` Cflags: -I ${includedir}/bsd -DLIBBSD_OVERLAY $ PKG_CONFIG_SYSROOT_DIR=/some/path pkgconf --cflags libbsd-overlay -I /usr/include/bsd -DLIBBSD_OVERLAY ``` But now, if I remove the space between `-I` and the path, it works: ``` Cflags: -I${includedir}/bsd -DLIBBSD_OVERLAY $ PKG_CONFIG_SYSROOT_DIR=/some/path pkgconf --cflags libbsd-overlay -I/some/path/usr/include/bsd -DLIBBSD_OVERLAY ``` It is perfectly valid for `-I` to be followed by a space. The issue also happens for `-L` if it is followed by a space, which is also perfectly valid. Should I open a different issue for those? Regards, Yann E. MORIN.

We are still examining the situation!

We are still examining the situation!
yann-morin-1998 commented 2016-08-27 13:54:21 +00:00 (Migrated from github.com)

Thanks! :-)

I'll be testing that soon!

Regards,
Yann E. MORIN.

Thanks! :-) I'll be testing that soon! Regards, Yann E. MORIN.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ariadne/pkgconf#94
There is no content yet.