Bug 5046 - Document that CPPFLAGS override behavior and possible workaround
Summary: Document that CPPFLAGS override behavior and possible workaround
Status: RESOLVED FIXED
Alias: None
Product: Reference
Classification: Documentation
Component: handbook (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Low enhancement
Target Milestone: 2.1
Assignee: Paul Eggleton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-08-23 17:43 UTC by Laszlo Papp
Modified: 2016-03-05 19:40 UTC (History)
7 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laszlo Papp 2013-08-23 17:43:29 UTC
I am having a simple recipe that can be seen below. The software underneath is using Makefiles for the buildsystem. The problem is that the buildsystem is trying to use a statement like "CPPFLAGS = -I./", but this seems to be dropped.

The problem is that the software will not build without having this include path in there. It is seems to be set inside the bitbake.conf file (i.e. 'env'). When '-e' is used, that CPPFLAGS in the software's Makefile will be ignored.

First of all, I think this should be documented. Secondly, perhaps even a workaround, or rather: the solution should be suggested how to respect such things intentionally.

Perhaps EXTRA_OEMAKE is the right way with CPPFLAGS=${CPPFLAGS}, but it is just a gut feeling as a complete newcomer anyhow. ;-)

DESCRIPTION = "Foo"
SECTION = "base"
LICENSE = "Proprietary"
LIC_FILES_CHKSUM = "file://${WORKDIR}/COPYRIGHT;md5=3c56ae9da467f3061406b9a5af9b277b"

SRC_URI = "file://foo.tar.xz \
               file://COPYRIGHT"

do_compile() {
        oe_runmake -C foo
}
Comment 1 Laszlo Papp 2013-08-23 17:52:46 UTC
Hmm, no, EXTRA_OEMAKE = "'CFLAGS=${CFLAGS}' 'CPPFLAGS=${CPPFLAGS}'" did not help, unfortunately.

How to get this buildsystem accept and respect the upstream software's build settings? I think there should be a documented way of doing so.
Comment 2 Scott Rifenbark 2013-08-26 06:23:07 UTC
Adding some people to the CC list so I can get more information.

Scott
Comment 3 Laszlo Papp 2013-08-27 09:49:06 UTC
Scott, this seems to work below. Should it go to meta-skeleton rather than the documentation?

============== testcase_0.1.bb ==================

DESCRIPTION = "Test case for a simple GNU Makefile"
SECTION = "base"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://${WORKDIR}/COPYRIGHT;md5=349c872e0066155e1818b786938876a4"

S = "${WORKDIR}"

SRC_URI = "file://main.cpp \
           file://Makefile \
           file://COPYRIGHT \
          "

do_compile() {
        unset CPPFLAGS
        oe_runmake
}

============== main.cpp ==================

int main() { return 0; }

============== Makefile ==================

CC=gcc
CPPFLAGS=-I.

main: main.cpp
        $(CC) -o main main.cpp $(CPPFLAGS)

.PHONY: clean

clean:
        rm -f main *.o *~
Comment 4 Laszlo Papp 2013-08-28 14:28:40 UTC
Quick update:

...
unset CPPFLAGS LDFLAGS
...

LDFLAGS is the same topic because if the software tries to build against symbols found in another libraries, like pthread_join in libpthread, -lpthread must be respected by the openembedded buildsystem.

Otherwise, the software build ends up in "Undefined reference ..." scenario for those symbols.
Comment 5 Jessica 2013-08-29 14:45:25 UTC
Scott,

This may be included in the content that Paul will help with you for creating receipes for 1.6

Thanks,
Jessica
Comment 6 Scott Rifenbark 2013-09-10 22:29:57 UTC
Hi,

Okay - I am changing the status to "ACCEPTED" and will get to this post 1.5.  I will work with Paul to create a good section on creating recipes that will include helpful information such as this.

Thanks, 
Scott
Comment 7 Scott Rifenbark 2013-10-31 18:34:39 UTC
I am changing this to NEEDINFO.  Waiting for information from Paul via email.
Comment 8 Scott Rifenbark 2014-04-01 22:54:34 UTC
Enhancement - moving to 1.7
Comment 9 Laszlo Papp 2014-04-10 09:31:45 UTC
Paul, feedback?
Comment 10 Scott Rifenbark 2014-06-03 09:17:48 UTC
Setting to M3 as the 1.7 target.  I will try to get Paul to help.

Scott
Comment 11 Scott Rifenbark 2014-06-04 15:54:29 UTC
Hi, 

Need some information from Paul on this.  Assigning to Paul.

Scott
Comment 12 Scott Rifenbark 2014-06-16 09:17:57 UTC
Apparently I did not assign this correctly.  Now it is assigned to Paul.
Comment 13 Scott Rifenbark 2014-07-08 12:51:17 UTC
Not sure why the M3 milestone is not showing up.  I am setting it (again).  Still need to consult with Paul.

Scott
Comment 14 Paul Eggleton 2014-08-07 15:05:01 UTC
So, I'm marking this as ACCEPTED rather than NEEDINFO since it is now assigned to me rather than Scott.
Comment 15 Paul Eggleton 2016-03-04 02:41:01 UTC
So as of the following commit, we no longer pass -e on the make command line, so this should no longer be a problem:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=f8520142c8a33fa9414314511fb01fbe79a2bf01 

Marking as resolved accordingly.
Comment 16 Scott Rifenbark 2016-03-05 19:40:15 UTC
Setting the Doc flag to "No".

Soctt