Skip to contentSkip to conversation

sysroot vs. finding header files

DISCUSSION Michael 'Mickey' Lauer 4 participants 7 messages Mar 5, 2008 – Mar 11, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

with the new sysroot stuff in, we have a problem when autotoolized packages like xorg-lib/libx11_*.bb abuse pkgconfig like that:

PKG_CHECK_MODULES(XPROTO, [xproto >= 7.0.6])
AC_SUBST(XPROTO_CFLAGS)

...

# Find keysymdef.h
#
KEYSYMDEF=""
AC_MSG_CHECKING([keysymdef.h])
for flag in $XPROTO_CFLAGS -I/usr/include; do

        case "$KEYSYMDEF" in
        "")
                case "$flag" in
                *-I*)
                        dir=`echo "$flag" | sed 's/ *-I//'`
                        file="$dir/X11/keysymdef.h"
                        if test -f "$file"; then
                                KEYSYMDEF="$file"
                        fi
                        ;;
                esac
                ;;
        esac

done

With pkgconfig now pointing to /usr (and friends), this no longer finds a keysymdef.h until you have X on your buildhost.

Any ideas how to fix that in the best way? (I hope there are not more of these things hidden)

Cheers,

:M:

Signature · 1 line
Dr. Michael 'Mickey' Lauer | IT-Freelancer | http://www.vanille-media.de
#1 lore raw

Hi Mickey,

On Wed, 2008-03-05 at 19:42 +0100, Michael 'Mickey' Lauer wrote:
[...]

Quoted 5 lines

With pkgconfig now pointing to /usr (and friends), this no longer finds a keysymdef.h until you have X on your buildhost.

Any ideas how to fix that in the best way? (I hope there are not more of these things hidden)

You will be pleased to know that:

a) Poky has a patch to "fix" that
b) I've not seen any other package do anything that insane

The bad news is upstream refused the patch on the grounds that "sysroot is a hack". Once the pkgconfig sysroot stuff becomes more common place, maybe they'll change their mind...

Cheers,

Richard

#2 lore raw

Hi Richard,

Quoted 3 lines

You will be pleased to know that:

a) Poky has a patch to "fix" that

Excellent. *stealing*

Quoted 1 line

b) I've not seen any other package do anything that insane

Ok, *knock on wood*

Quoted 3 lines

The bad news is upstream refused the patch on the grounds that "sysroot is a hack". Once the pkgconfig sysroot stuff becomes more common place, maybe they'll change their mind...

Right.

Thanks!

:M:

#3 lore raw
In reply to Richard Purdie
Quoted 10 lines · On Wednesday 05 March 2008 21:15:32 Richard Purdie wrote:

Hi Mickey,

On Wed, 2008-03-05 at 19:42 +0100, Michael 'Mickey' Lauer wrote:
[...]

Quoted 3 lines

With pkgconfig now pointing to /usr (and friends), this no longer finds a keysymdef.h until you have X on your buildhost.

b) I've not seen any other package do anything that insane

aeh? finding a certain header file is quite common.. let us see how things work here. also I'm just slowly groking sysroot. It would be nice to know when and where certain path's get mapped away from /usr/include to something else...

#4 lore raw
Quoted 10 lines · Holger Freyther
Quoted 8 lines · On Wednesday 05 March 2008 21:15:32 Richard Purdie wrote:

Hi Mickey,

On Wed, 2008-03-05 at 19:42 +0100, Michael 'Mickey' Lauer wrote:
[...]

Quoted 3 lines

With pkgconfig now pointing to /usr (and friends), this no longer finds a keysymdef.h until you have X on your buildhost.

Quoted 6 lines
Quoted 1 line

b) I've not seen any other package do anything that insane

aeh? finding a certain header file is quite common.. let us see how things work here. also I'm just slowly groking sysroot. It would be nice to know when and where certain path's get mapped away from /usr/include to something else...

Here is a small difference:
Most configure.in authors are happy with AC_CHECK_HEADER and AC_CHECK_HEADERS. These works with sysroot out of the box, as the check uses compiler flags.

But here it is searching for the exact location of keysymdef.h, not supported by AC_CHECK*. It actually needs to process it by a different tool than C compiler to generate custom header. So they need own check.

I see few clean fixes:

1) Do some cpp magic and preprocess the output. Such approach will not need any notice about sysroot, but looks like an overkill.

2) Tell them that sysroot is a good feature and they should support it in this check.

3) Introduce official support of sysroot in autotools. For example for AC_CHECK_FILE it is the only solution. Ideally, all configure files should have --sysroot option automatically and should be aware of SYSROOT (or similar) variable in exactly the same way it is now aware of CFLAGS et co.

Signature · 2 lines
Stanislav Brabec
http://www.penguin.cz/~utx/zaurus
#5 lore raw
In reply to Holger Freyther
Quoted 10 lines · Holger Freyther
Quoted 8 lines · On Wednesday 05 March 2008 21:15:32 Richard Purdie wrote:

Hi Mickey,

On Wed, 2008-03-05 at 19:42 +0100, Michael 'Mickey' Lauer wrote:
[...]

Quoted 3 lines

With pkgconfig now pointing to /usr (and friends), this no longer finds a keysymdef.h until you have X on your buildhost.

Quoted 6 lines
Quoted 1 line

b) I've not seen any other package do anything that insane

aeh? finding a certain header file is quite common.. let us see how things work here. also I'm just slowly groking sysroot. It would be nice to know when and where certain path's get mapped away from /usr/include to something else...

That X code wants to know what the actual path to the header is. This isn't the usual autofoo requirement of checking a header exists or knowing what -I flags to use.

Needing to know the absolute path to the header is not as common a requirement as you'd expect. There are ways and means but pulling it from pkg-config the way that package did isn't a good one.

Cheers,

Richard

#6 lore raw
Quoted 3 lines · On Tuesday 11 March 2008 12:08:27 Richard Purdie wrote:

Needing to know the absolute path to the header is not as common a requirement as you'd expect. There are ways and means but pulling it from pkg-config the way that package did isn't a good one.

Hehe, John just stumbled across another case in python-gtk. And cmake loves absolute paths for certain things but it has sysroot support. Anyway we will fix this one by one and there is no easy way to find out who is doing such things. Nothing that could have been differently. :)

z.