Bug 12376

Summary: Native builds mix headers from
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Thomas Köller <thomas.koeller>
Component: coreAssignee: Thomas Köller <thomas.koeller>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Undecided CC: meta.mr.watcher, meta.watcher, randy.macleod, richard.purdie
Version: unspecified   
Target Milestone: ---   
Hardware: x86   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Log file of failed compile task none

Description Thomas Köller 2017-11-22 15:35:28 UTC
Created attachment 4129 [details]
Log file of failed compile task

I experienced build errors when building native tools on my  Fedora 27 x86_64 host, see attached log file. The reason turned out to be that part of the header files used were taken from the directories specified with '-isystem', while others were taken from the build system's standard include path '/usr/include'. This produced an inconsistent mix of header files. Obviously, dependencies were wrong. I then added the following line to my local.conf:

BUILD_CPPFLAGS += "-nostdinc"

and found that this produced even more errors, already in the 'configure' task of the m4-native recipe.

I think that no build step should reference headers from the build system outside oe, and using '-nostdinc' everywhere may be an easy way to detect violations of this rule.

Although I did not check, I suspect there may be similar problems for libraries used in the build.
Comment 1 Juro Bystricky 2017-11-30 16:36:03 UTC
Thomas, can you please provide exact steps to reproduce the problem?
Thanks
Comment 2 Thomas Köller 2017-12-01 10:02:18 UTC
(In reply to comment #1)
> Thomas, can you please provide exact steps to reproduce the problem?
> Thanks

Ok. As I said, I am building on a Fedora 27/x86_64 host (a VM running in VirtualBox under Widows 10, actually):

[tkoeller@fedora-vb-tkoeller build-rpb]$ uname -a
Linux fedora-vb-tkoeller 4.13.15-300.fc27.x86_64 #1 SMP Tue Nov 21 21:10:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[tkoeller@fedora-vb-tkoeller build-rpb]$ gcc --version
gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I am following the build instructions given in https://github.com/96boards/documentation/wiki/DragonBoard-820c-Getting-Started-With-Linux#installing-an-open-embedded-based-image

and

https://github.com/Linaro/documentation/blob/master/Reference-Platform/CECommon/OE.md

I create a new directory named linaro-build, cd into it and do 'repo init' / 'repo sync':

repo init -u https://github.com/96boards/oe-rpb-manifest.git -b morty
repo sync

Next step:

[tkoeller@fedora-vb-tkoeller linaro-build]$ MACHINE=dragonboard-820c DISTRO=rpb source setup-environment

Welcome to OpenEmbedded Reference Platform Build (OE RPB)

For more information about OpenEmbedded see their website:
    http://www.openembedded.org/

Your build environemnt has been configured with:

    MACHINE = dragonboard-820c
    SDKMACHINE = x86_64
    DISTRO = rpb

You can now run 'bitbake <target>'

Some of common targets are:
    rpb-console-image
    rpb-desktop-image
    rpb-weston-image
    core-image-base
    core-image-minimal

Then, I add a couple of lines to the autogenerated 'conf/auto.conf' file, to
control bitbake and make parallel execution, and to enable use of an existing shared download cache. The result looks as follows:

[tkoeller@fedora-vb-tkoeller build-rpb]$ cat conf/auto.conf
DISTRO ?= "rpb"
MACHINE ?= "dragonboard-820c"
SDKMACHINE ?= "x86_64"

# Extra options that can be changed by the user
INHERIT += "rm_work"

# +++ enable yocto shared download cache +++
SOURCE_MIRROR_URL ?= "file:///media/sf_ModBizISP/yocto_download_cache"
INHERIT += "own-mirrors"
BB_GENERATE_MIRROR_TARBALLS = "1"

BB_NUMBER_THREADS = "16"
PARALLEL_MAKE = "-j8"


Finally, I invoke bitbake:

[tkoeller@fedora-vb-tkoeller build-rpb]$ bitbake rpb-console-image

which then results in the error reported.
Comment 3 Richard Purdie 2017-12-07 15:39:39 UTC
Thanks for the extra info, that helped a lot. We ran into this issue with morty on Ubuntu1710 as well. This has been fixed with:

http://git.yoctoproject.org/cgit.cgi/poky/commit/?h=morty&id=8c84d07063ea0ebe8f335fafc2e619555bdab812