Skip to contentSkip to conversation

binconfig.bbclass breaks packages QA

DISCUSSION Stanislav Brabec 5 participants 12 messages Mar 28, 2008 – Apr 14, 2008

lore
Share & tools
lore
#0 lore raw

Hallo.

I just debugged libgnomecups failing with QA in oe.dev. It seems, that mangling magic in the binconfig.bblass is now obsolete and should be removed, as it makes things worse:
Package a installs a-config.
Bitbake mangles it for staging.
Package b creates b.pc and includes mangled values from a-config. QA of b fails.

After the fix, maybe binconfig files could be moved to the standard staging directory (it must be in build path then).

Could anybody with deeper insight confirm it or do this change?

Thanks.

Signature · 2 lines
Stanislav Brabec
http://www.penguin.cz/~utx/zaurus
#1 lore raw
Quoted 8 lines · Stanislav Brabec

I just debugged libgnomecups failing with QA in oe.dev. It seems, that mangling magic in the binconfig.bblass is now obsolete and should be removed, as it makes things worse:
Package a installs a-config.
Bitbake mangles it for staging.
Package b creates b.pc and includes mangled values from a-config. QA of b fails.

Quoted 4 lines

After the fix, maybe binconfig files could be moved to the standard staging directory (it must be in build path then).

Could anybody with deeper insight confirm it or do this change?

We still need that mangling unfortunately. The problem is that package b should not be injecting the results from binconfig directly into a .pc file, it should be using things like -L${libdir}/foo, not -L/some/hardcoded/path.

I'll have a look at that package and see if I can fix it.

Cheers,

Richard

#2 lore raw
Quoted 8 lines · Richard Purdie
Quoted 4 lines · Stanislav Brabec

After the fix, maybe binconfig files could be moved to the standard staging directory (it must be in build path then).

Could anybody with deeper insight confirm it or do this change?

We still need that mangling unfortunately.

Grr.

| CROSS COMPILE Badness: /usr/include in INCLUDEPATH: /usr/include/freetype2 | cc1: internal compiler error: in add_path, at c-incpath.c:371

We may want -isysroot instead of -isystem (and report bug above to gcc developers, as the report advices), but only for cross builds.

Exactly, we may want to set CFLAGS to -isysroot= (to root to target system) and HOST_CFLAGS to -isystem= (to make visible our native staging system) for cross builds and CFLAGS to -isystem= for native builds. Maybe even more.

Automake based programs should be smart enough to discriminate between build of native compile-time helper and target binary. (But I guess, that some of them may fail.)

-isystem dir
Search dir for header files, after all directories specified by -I but before the standard system directories. Mark it as a system directory, so that it gets the same special treatment as is applied to the standard system directories. If dir begins with "=", then the "=" will be replaced by the sysroot prefix; see --sysroot and -isysroot.
-isysroot dir
This option is like the --sysroot option, but applies only to header files. See the --sysroot option for more information.
--sysroot=dir
Use dir as the logical root directory for headers and libraries. For example, if the compiler would normally search for headers in /usr/include and libraries in /usr/lib, it will instead search dir/usr/include and dir/usr/lib.

Quoted 4 lines

The problem is that package b
should not be injecting the results from binconfig directly into a .pc file, it should be using things like -L${libdir}/foo, not -L/some/hardcoded/path.

No, in this case it is correct (at least from upstream aspect of view). Application may never know, that ${prefix} of the foo-config is equal to ${prefix} of me. So it has to trust, that foo-config application provided correct cflags.

Quoted 1 line

I'll have a look at that package and see if I can fix it.

I just tried to disable mangling and rebuilt from scratch.

I got QA error:
ERROR: Task 2095 (/OE/org.openembedded.dev/packages/fontconfig/fontconfig_2.4.1.bb, do_qa_configure) failed 
So I disabled the QA check, and I got above mentioned internal compiler error.

Well, I tried to replace -isystem by -isysroot, but native builds don't like it:

shasum-native-1.0-r1:
main.c:1:19: error: stdio.h: No such file or directory

Hmmm. And I don't know, how to set CFLAGS differently for native and cross builds.

Signature · 2 lines
Stanislav Brabec
http://www.penguin.cz/~utx/zaurus
#3 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stanislav Brabec schreef:

| Richard Purdie wrote:
|> On Fri, 2008-03-28 at 01:12 +0100, Stanislav Brabec wrote:
|
|>> After the fix, maybe binconfig files could be moved to the
|>> standard staging directory (it must be in build path then).
|>>
|>> Could anybody with deeper insight confirm it or do this change?
|> We still need that mangling unfortunately.
|
| Grr.
|
| | CROSS COMPILE Badness: /usr/include in INCLUDEPATH:
/usr/include/freetype2
| | cc1: internal compiler error: in add_path, at c-incpath.c:371
|
| We may want -isysroot instead of -isystem (and report bug above to gcc
| developers, as the report advices), but only for cross builds.

We patch gcc to ICE on including /usr/include, /opt/include, etc, so we shouldn't report them to the gcc people, but spank the application authors where appropriate.

regards,

Koen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFH7MoVMkyGM64RGpERAonaAJ9f8dqydelLPQc93nD0n1Qh+856cwCfeNNu 0BoSRuHZyQA4zwMnDGf6R44=
=UJik
-----END PGP SIGNATURE-----

#4 lore raw
Quoted 23 lines · Koen Kooi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stanislav Brabec schreef:

| Richard Purdie wrote:

 |> On Fri, 2008-03-28 at 01:12 +0100, Stanislav Brabec wrote:
 |
 |>> After the fix, maybe binconfig files could be moved to the
 |>> standard staging directory (it must be in build path then).
 |>>
 |>> Could anybody with deeper insight confirm it or do this change?
 |> We still need that mangling unfortunately.
 |
 | Grr.
 |
 | | CROSS COMPILE Badness: /usr/include in INCLUDEPATH:
 /usr/include/freetype2
 | | cc1: internal compiler error: in add_path, at c-incpath.c:371
 |
 | We may want -isysroot instead of -isystem (and report bug above to gcc
 | developers, as the report advices), but only for cross builds.
Quoted 3 lines

We patch gcc to ICE on including /usr/include, /opt/include, etc, so we shouldn't report them to the gcc people, but spank the application authors where appropriate.

Actually there is a patch which will issue warning on such poisoning when using cross gcc. but sometimes it becomes annoyance for build systems like scratchbox which pretend to be native.

google for poison-system-directories. I can post a patch if thats desired.

Quoted 20 lines

regards,

Koen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFH7MoVMkyGM64RGpERAonaAJ9f8dqydelLPQc93nD0n1Qh+856cwCfeNNu 0BoSRuHZyQA4zwMnDGf6R44=
=UJik
-----END PGP SIGNATURE-----

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

#5 lore raw

still some unused Acer n30 devices available

Hi all,
I just would like to let you know that we still have a very limited number original and unused Acer n30 PDAs and want to clear our stock. Since the n30 is defined well as a MACHINE in OE, you might be interested to get a different device to experiment with. It is quite similar in operation to the Openmoko device (except display resolution and GSM...).

Acer n30 support is described here:

http://handhelds.org/moin/moin.cgi/AcerN30

And, if you want to order one:

	http://www.handheld-linux.com/wiki.php?page=Acer%20n30

Best regards,
Nikolaus

--------------------------------------------------------------------
Golden Delicious Computers GmbH&Co. KG
Buchenstr. 3
D-82041 Oberhaching
+49-89-54290367
http://www.goldelico.com

AG München, HRA 89571
VAT DE253626266
Komplementär:
Golden Delicious Computers Verwaltungs GmbH
Oberhaching, AG München, HRB 16602
Geschäftsführer: Dr. Nikolaus Schaller

Digital Tools for Independent People
--------------------------------------------------------------------

#6 lore raw
In reply to Stanislav Brabec
Quoted 5 lines · Stanislav Brabec

| CROSS COMPILE Badness: /usr/include in INCLUDEPATH: /usr/include/freetype2 | cc1: internal compiler error: in add_path, at c-incpath.c:371

We may want -isysroot instead of -isystem (and report bug above to gcc developers, as the report advices), but only for cross builds.

This error is from a patch we add into gcc. It causes it to error if it ever sees -I/usr/include. This is good since that breaks things badly.

Quoted 4 lines

Exactly, we may want to set CFLAGS to -isysroot= (to root to target system) and HOST_CFLAGS to -isystem= (to make visible our native staging system) for cross builds and CFLAGS to -isystem= for native builds. Maybe even more.

I don't think you understand the way sysroot works properly. It changes the way gcc works internally, it looks in the sysroot instead of /usr/include. It does not mangle paths passed in externally though.

Quoted 9 lines
Quoted 4 lines

The problem is that package b
should not be injecting the results from binconfig directly into a .pc file, it should be using things like -L${libdir}/foo, not -L/some/hardcoded/path.

No, in this case it is correct (at least from upstream aspect of view). Application may never know, that ${prefix} of the foo-config is equal to ${prefix} of me. So it has to trust, that foo-config application provided correct cflags.

The key point is "from upstream aspect of view" which doesn't consider cross compiling. The flags are correct for passing to gcc. The flags are not correct for the way we're using pkgconfig unfortunately.

I've had a quick look and the problem is from cups which doesn't have a .pc file. The two solutions that spring to mind are:

1. Add a .pc file to cups and have libgnomecups use it
2. Add some sed to the libgnomecups recipe to fix the bad paths after the compile completes.

Quoted 4 lines

I just tried to disable mangling and rebuilt from scratch.

I got QA error:
ERROR: Task 2095 (/OE/org.openembedded.dev/packages/fontconfig/fontconfig_2.4.1.bb, do_qa_configure) failed

That doesn't surprise me as we need that mangling. The problem is when it leaks into the .pc space which we've cleaned up. I think everyone would agree the .pc situation is much nicer than it used to be, we just need to fix the relatively small number of corner cases where "bad" data is leaking in and this is one of them.


Quoted 1 line

So I disabled the QA check, and I got above mentioned internal compiler error.

Again, totally expected. We should never be calling the cross compiler with -I/usr/include and since you removed the mangling it would start doing that.

Cheers,

Richard

#7 lore raw
Quoted 3 lines · Richard Purdie

I don't think you understand the way sysroot works properly. It changes the way gcc works internally, it looks in the sysroot instead of /usr/include. It does not mangle paths passed in externally though.

Sorry. You are true. It's sad non-feature.

Quoted 6 lines

I've had a quick look and the problem is from cups which doesn't have a .pc file. The two solutions that spring to mind are:

1. Add a .pc file to cups and have libgnomecups use it
2. Add some sed to the libgnomecups recipe to fix the bad paths after the compile completes.

We have many foo-config files embedded to other fooo-config or .pc. System wide solution would be nicer.

3. Wrap gcc.

Never call cross-gcc directly, but use small wrapper, which will replace any -I dir by -I sysroot/dir (if sysroot is not already a part of dir) etc.

I am ready to write such wrapper, either in bash, or in shell+sed, or possibly in C. I already sent one in bash to the list last year.

4. Move to -isysroot for cross builds and change the mangling style:
Replace -Idir by -I=dir and -I dir by -I =dir.

 -I dir
... If dir begins
with "=", then the "=" will be replaced by the sysroot prefix; see --sysroot and -isysroot.

5. Patch gcc to implement 3 on gcc level.

Signature · 2 lines
Stanislav Brabec
http://www.penguin.cz/~utx/zaurus
#8 lore raw
Quoted 10 lines · Stanislav Brabec
Quoted 6 lines · Richard Purdie

I've had a quick look and the problem is from cups which doesn't have a .pc file. The two solutions that spring to mind are:

1. Add a .pc file to cups and have libgnomecups use it
2. Add some sed to the libgnomecups recipe to fix the bad paths after the compile completes.

We have many foo-config files embedded to other fooo-config or .pc. System wide solution would be nicer.

Before we start discussing invasive system wide solutions, can you define "many"? How big is this problem?

A quick glance at my local build shows 217 .pc files and 14 binconfig ones. Of the 14 binconfigs I can spot several that also have .pc files. binconfig is being replaced by pkgconfig so this number will only shrink with time.

Secondly if we wrap gcc that doesn't solve the underlying problem of bad .pc files. The neat thing now is that we can move the .pc files in/out of a sysroot, onto the target system or into different staging directories since there are no hardcoded path problems in them anymore. yes we have hardcoded paths in .la files and in the binconfig ones but that issue is more manageable than having to hack .pc files as well.

Cheers,

Richard

#9 lore raw
Quoted 4 lines · Richard Purdie

A quick glance at my local build shows 217 .pc files and 14 binconfig ones. Of the 14 binconfigs I can spot several that also have .pc files. binconfig is being replaced by pkgconfig so this number will only shrink with time.

It happens most often with gpg-error-config. It is often embedded to .pc files, but it has no .pc file. Adding .pc file will not fix the problem, as configure.in checks for gpg-error-config, not for gpg-error.pc. The second most problematic is cups-config. Other packages are less often used, or they have its own .pc file, which is preferred in new projects. Failed projects are for example libgnomecups, gnumeric.

Quoted 6 lines

Secondly if we wrap gcc that doesn't solve the underlying problem of bad .pc files. The neat thing now is that we can move the .pc files in/out of a sysroot, onto the target system or into different staging directories since there are no hardcoded path problems in them anymore. yes we have hardcoded paths in .la files and in the binconfig ones but that issue is more manageable than having to hack .pc files as well.

Imagine situation, where all mangling is removed from all tools and only gcc will do the mangling internally. foo-config will return -I/usr/include/foo, pkg-config will embed -I/usr/include/foo, make will call gcc $CFLAGS -I/usr/include/foo. gcc will search in sysroot/usr/include/foo and everything should work then.

Looking at gcc Bugzilla, this problem affects all toolchains authors.

Actually, changing OE specific gcc patch to prepend search path with system path instead of ICE would work-around it as well.

I can imagine small patch doing the same more cleanly:
implement new switches, e. g. --sysroot-all-I --sysroot-all-L.

Then change add_sysroot_to_chain() to mangle all -I paths, not only those in form -I =.

Signature · 2 lines
Stanislav Brabec
http://www.penguin.cz/~utx/zaurus
#10 lore raw
Quoted 6 lines · Stanislav Brabec

It happens most often with gpg-error-config. It is often embedded to .pc files, but it has no .pc file. Adding .pc file will not fix the problem, as configure.in checks for gpg-error-config, not for gpg-error.pc. The second most problematic is cups-config. Other packages are less often used, or they have its own .pc file, which is preferred in new projects. Failed projects are for example libgnomecups, gnumeric.

The projects using these will need updates too, this is usually just a case of adding a line to the Requires field in the .pc (if the lib is optional there is slightly more work than that). Hopefully we'll be able to convince the upstream sources to change to pkg-config so the patches will disappear over time.

Quoted 5 lines

Imagine situation, where all mangling is removed from all tools and only gcc will do the mangling internally. foo-config will return -I/usr/include/foo, pkg-config will embed -I/usr/include/foo, make will call gcc $CFLAGS -I/usr/include/foo. gcc will search in sysroot/usr/include/foo and everything should work then.

I can envisage this, its just a *massive* change from the current behaviour and nobody else is doing this. Applications and autoconf don't work with this in mind.

Quoted 10 lines

Looking at gcc Bugzilla, this problem affects all toolchains authors.

Actually, changing OE specific gcc patch to prepend search path with system path instead of ICE would work-around it as well.

I can imagine small patch doing the same more cleanly:
implement new switches, e. g. --sysroot-all-I --sysroot-all-L.

Then change add_sysroot_to_chain() to mangle all -I paths, not only those in form -I =.

Its a nice idea but doing something like this is outside the scope of OE. By all means experiment if you want, OE's metadata provides an ideal testing ground for that but I don't think its something OE will be switching to any time soon.

Regards,

Richard

#11 lore raw
In reply to Richard Purdie
Quoted 11 lines · Richard Purdie
Quoted 4 lines

After the fix, maybe binconfig files could be moved to the standard staging directory (it must be in build path then).

Could anybody with deeper insight confirm it or do this change?

We still need that mangling unfortunately. The problem is that package b should not be injecting the results from binconfig directly into a .pc file, it should be using things like -L${libdir}/foo, not -L/some/hardcoded/path.

I'll have a look at that package and see if I can fix it.

OK. I did a per-package patch for libgnomecups and wv.

libgnomecups was confused by binconfig mangling.

wv was confused by a non-standard use of .pc files (use of @FOO_CFLAGS@ instead of Requires: foo).

Signature · 2 lines
Stanislav Brabec
http://www.penguin.cz/~utx/zaurus