From: "Jader H. Silva" <jader@2mi.com.br>
To: openembedded-devel@lists.openembedded.org
Subject: Re: libxml2-native build against host zlib.h
Date: Tue, 14 Apr 2009 17:48:03 -0300 [thread overview]
Message-ID: <49E4F683.6090706@2mi.com.br> (raw)
In-Reply-To: <20090407213020.GJ2195@smtp.west.cox.net>
[-- Attachment #1: Type: text/plain, Size: 3937 bytes --]
Tom Rini escreveu:
> On Tue, Apr 07, 2009 at 06:07:51PM -0300, Jader H. Silva wrote:
> [snip]
>
>> I'm using ubuntu 8.04, zlib1g-dev package is installed.
>> I can compile it without problems in a machine where zlib1g-dev is not
>> installed.
>>
>> Attached there's the log.do_compile and config.log.nok originated from a
>> failed compilation and config.log from a successful compilation after my
>> patch was applied.
>>
>
> On the failing machine can you either do CCACHE="" or ccache -C to dump
> the cache and try again?
>
>
Alright, nothing worked (setting --with-zlib=${STAGING_INCDIR} included)
so I decided to look deeper and found out that problem is caused by
BUILD_CPPFLAGS in GCC's preprocessing stage of xmlIO.c.
BUILD_CPPFLAGS use "-isystem" to include ${STAGING_INCDIR}.
openembedded/conf/bitbake.conf:429:export BUILD_CPPFLAGS =
"-isystem${STAGING_INCDIR_NATIVE}"
Both CFLAGS and CPPFLAGS use BUILD_CPPFLAGS:
CFLAGS=-isystem/home/jader/thinstation/build/tmp/staging/i686-linux/usr/include
-O2
CPPFLAGS=-isystem/home/jader/thinstation/build/tmp/staging/i686-linux/usr/include
-O2 -fpermissive
When building xmlIO.o, the preprocessor is called as follow:
/usr/lib/gcc/i486-linux-gnu/4.2.4/cc1 -E -quiet -v -I. -I./include
-I./include -MD xmlIO.d -MF .deps/xmlIO.Tpo -MP -MT xmlIO.lo -H -isystem
/usr/include -DHAVE_CONFIG_H -D_REENTRANT -DPIC
-isystem/home/jader/thinstation/build/tmp/staging/i686-linux/usr/include
-isystem/home/jader/thinstation/build/tmp/staging/i686-linux/usr/include
xmlIO.c -mtune=generic -pedantic -W -Wunused -Wimplicit -Wreturn-type
-Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts
-Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align
-Wwrite-strings -Waggregate-return -Wstrict-prototypes
-Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -fPIC -O2
As you can see, gcc includes the standard host include directory
"-isystem /usr/include" in the command line.
All "-isystem" directories are searched after "-I" directories but, as
stated in GCC's manual, if a directory is referenced both with "-I" and
"-isystem", gcc will use only "-isystem".
If I compile with --with-zlib=${STAGING_INCDIR}, there will be an
additional flag: "-I ${STAGING_INCDIR}" and the preprocessor will mark
this include dir as a duplicated of "-isystem ${STAGING_INCDIR}" and
ignore it. If I do not include it, it simply won't be ignored
ignoring duplicate directory
"/home/jader/thinstation/build/tmp/staging/i686-linux/usr/include" <--
this ${is STAGING_INCDIR}
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
ignoring duplicate directory "/usr/include"
ignoring duplicate directory "./include"
#include "..." search starts here:
#include <...> search starts here:
.
./include
/usr/include
/home/jader/thinstation/build/tmp/staging/i686-linux/usr/include
/usr/local/include
/usr/lib/gcc/i486-linux-gnu/4.2.4/include
As "-isystem /usr/include" is the first "-isystem" flag, it will be
looked up first and if you have zlib.h there, then your libxml2-native
will be compile against it. I don't know if this is a GCC's version
issue tough. Here I use: gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
Maybe 3.x won't insert "-isystem /usr/include" as first "-isystem" when
preprocessing.
It's possible this problem happens with many recipes that use
preprocessed files against headers in ${STAGING_INCDIR} and don't
override BUILD_CPPFLAGS properly.
Setting BUILD_CPPFLAGS inside
openembedded/recipes/libxml/libxml2-native.inc fixed it. There's a patch
attached.
Att.
Jader H. Silva
jader@2mi.com.br
Depto. de desenvolvimento
2MI Tecnologia
[-- Attachment #2: 0001-Fix-libxml2-native-compilation-against-host-zlib.h.patch --]
[-- Type: text/x-patch, Size: 777 bytes --]
From 9ac98f6ab76256a469bac67ae3a64dc8b7a53b65 Mon Sep 17 00:00:00 2001
From: Jader <jader@.2mi.com.br>
Date: Tue, 14 Apr 2009 17:36:18 -0300
Subject: [PATCH] Fix libxml2-native compilation against host zlib.h
---
recipes/libxml/libxml2-native.inc | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/recipes/libxml/libxml2-native.inc b/recipes/libxml/libxml2-native.inc
index 3f67152..74a3a78 100644
--- a/recipes/libxml/libxml2-native.inc
+++ b/recipes/libxml/libxml2-native.inc
@@ -7,6 +7,8 @@ S = "${WORKDIR}/libxml2-${PV}"
inherit autotools native pkgconfig distutils-native-base
+BUILD_CPPFLAGS = "-I${STAGING_INCDIR}"
+
do_configure_prepend () {
EXTRA_LIBXML2_OECONF="\
--with-python=${PYTHON_DIR} \
--
1.5.4.3
prev parent reply other threads:[~2009-04-14 20:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-23 19:10 libxml2-native build against host zlib.h Jader H. Silva
2009-03-23 21:00 ` Khem Raj
2009-04-07 16:56 ` Koen Kooi
2009-04-07 17:54 ` Jader H. Silva
2009-04-07 18:33 ` Tom Rini
2009-04-07 19:01 ` Jader H. Silva
2009-04-07 19:56 ` Tom Rini
2009-04-07 21:07 ` Jader H. Silva
2009-04-07 21:30 ` Tom Rini
2009-04-14 20:48 ` Jader H. Silva [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49E4F683.6090706@2mi.com.br \
--to=jader@2mi.com.br \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox