[oe] [vdr] TARGET_CXXFLAGS do not include CXX_FLAGS from Makefile (was: vdr: questions regarding cplusplus.patch)

Paul Menzel paulepanter at users.sourceforge.net
Tue Jan 12 11:36:00 UTC 2010


Dear OE hackers,


Am Montag, den 11.01.2010, 23:42 +0100 schrieb Paul Menzel:

[…]

> Putting
> 
>         PREFERRED_VERSION_binutils               = "2.20"
>         PREFERRED_VERSION_binutils-cross         = "2.20"
>         PREFERRED_VERSION_binutils-cross-sdk     = "2.20"
>         
>         PREFERRED_VERSION_gcc                    = "4.4.2"
>         PREFERRED_VERSION_gcc-cross              = "4.4.2"
>         PREFERRED_VERSION_gcc-cross-sdk          = "4.4.2"
>         PREFERRED_VERSION_gcc-cross-initial      = "4.4.2"
>         PREFERRED_VERSION_gcc-cross-intermediate = "4.4.2"
> 
> in my `local.conf` and running `bitbake vdr` gave me an error in
> `do_compile` for `libcap_1.10.bb`.
> 
>         arm-angstrom-linux-gnueabi-ld -soname libcap.so.1 -x -shared -o libcap.so.1.10 cap_alloc.o cap_proc.o cap_extint.o cap_flag.o cap_text.o cap_sys.o
>         arm-angstrom-linux-gnueabi-ld: cap_text.o: relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC

I opened a new thread for this [2].

Anyways compiling the plugins for VDR in `do_install` [3]

        do_install () {
              oe_runmake 'DESTDIR=${D}' \
                         'PREFIX=${prefix}' \
                         'CONFDIR=${sysconfdir}/vdr' \
                         'VIDEODIR=/var/lib/vdr/video' \
                         'PLUGINLIBDIR=${PLUGINDIR}' \
                         'LOCDIR=${datadir}/locale' \
                         install
        }

I also get the same error which I did not get before with GCC 4.1.1.

        $ more log.do_install.28829
        NOTE: make -e MAKEFLAGS= DESTDIR=/oe/tangstrom-dev/work/armv7a-angstrom-linux-gnueabi/vdr-1.7.10-r3/image PREFIX=/usr CONFDIR=/etc/vdr VIDEODIR=/var/lib/vdr/video PLUGINLIBDIR=/usr/lib/vdr/plugins LOCDIR=/usr/share/locale install
        Plugin hello:
        make[1]: Entering directory `/oe/tangstrom-dev/work/armv7a-angstrom-linux-gnueabi/vdr-1.7.10-r3/vdr-1.7.10/PLUGINS/src/hello'
        make[1]: Leaving directory `/oe/tangstrom-dev/work/armv7a-angstrom-linux-gnueabi/vdr-1.7.10-r3/vdr-1.7.10/PLUGINS/src/hello'
        make[1]: Entering directory `/oe/tangstrom-dev/work/armv7a-angstrom-linux-gnueabi/vdr-1.7.10-r3/vdr-1.7.10/PLUGINS/src/hello'
        arm-angstrom-linux-gnueabi-g++ -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -isystem/oe/tangstrom-dev/staging/armv7a-angstrom-linux-gnueabi/usr/include -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3 -fpermissive -fvisibility-inlines-hidden -c -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"hello"' -I../../../include hello.c
        arm-angstrom-linux-gnueabi-g++ -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -isystem/oe/tangstrom-dev/staging/armv7a-angstrom-linux-gnueabi/usr/include -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3 -fpermissive -fvisibility-inlines-hidden -shared hello.o -o libvdr-hello.so -L/oe/tangstrom-dev/staging/armv7a-angstrom-linux-gnueabi/usr/lib -Wl,-rpath-link,/oe/tangstrom-dev/staging/armv7a-angstrom-linux-gnueabi/usr/lib -Wl,-O1 -Wl,--hash-style=gnu
        /oe/tangstrom-dev/cross/armv7a/lib/gcc/arm-angstrom-linux-gnueabi/4.4.2/../../../../arm-angstrom-linux-gnueabi/bin/ld: hello.o: relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
        hello.o: could not read symbols: Bad value
        collect2: ld returned 1 exit status
        make[1]: *** [libvdr-hello.so] Error 1
        make[1]: Leaving directory `/oe/tangstrom-dev/work/armv7a-angstrom-linux-gnueabi/vdr-1.7.10-r3/vdr-1.7.10/PLUGINS/src/hello'
        
        [… same for all other plugins]

The thing that puzzles me is, that in the plugin’s Makefile [4] `-fPIC`
is specified

        CXX      ?= g++
        CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
        LIBS     ?= ${LDFLAGS}

but in the above command it is not included.

        arm-angstrom-linux-gnueabi-g++ -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -isystem/oe/tangstrom-dev/staging/armv7a-angstrom-linux-gnueabi/usr/include -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3 -fpermissive -fvisibility-inlines-hidden -c -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"hello"' -I../../../include hello.c

Looking at `run.do_install.28829` I cannot see find the `-fPIC` in
there. So my question is, why is it not included. Is it because of »?=«?
How do I get it included?

        $ grep -i cxxflags run.do_install.28829
        export TARGET_CXXFLAGS="-isystem/oe/tangstrom-dev/staging/armv7a-angstrom-linux-gnueabi/usr/include -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3 -fpermissive"
        export CXXFLAGS="-isystem/oe/tangstrom-dev/staging/armv7a-angstrom-linux-gnueabi/usr/include -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3 -fpermissive -fvisibility-inlines-hidden"
        export SDK_CXXFLAGS="-isystem/oe/tangstrom-dev/staging/i686-linux/usr/include -isystem/oe/tangstrom-dev/staging/armv7a-angstrom-linux-gnueabi/usr/include -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3 -fpermissive"
        export BUILD_CXXFLAGS="-isystem/oe/tangstrom-dev/staging/i686-linux/usr/include -O2 -g -fpermissive"

`conf/bitbake.conf` [5] seems to be the place where those environment
variables are set.

        $ grep -i cxxflags conf/bitbake.conf 
        export BUILD_CXXFLAGS = "${BUILD_CFLAGS} -fpermissive"
        export CXXFLAGS = "${TARGET_CXXFLAGS}"
        export TARGET_CXXFLAGS = "${TARGET_CFLAGS} -fpermissive"
        export SDK_CXXFLAGS = "${SDK_CFLAGS} -fpermissive"

So to summarize it looks like `CXXFLAGS` gets set to `TARGET_CXXFLAGS` –
which just gets exported afterward? – by BitBake. Because in
`oe_runmake` `make` is run with `-e` these variables take precedence
over the one in the Makefile of the program which are additionally just
declared with »?=«. Is this correct?

How do I get this fixed? Do I need to use `TARGET_CXXFLAGS_append +=` or
`--extra-cxxflags` as found by `git grep "target_cxxflags"`?


Thanks a lot,

Paul


[1] http://www.angstrom-distribution.org/building-angstrom
[2] http://lists.linuxtogo.org/pipermail/openembedded-devel/2010-January/016153.html
[3] http://cgit.openembedded.org/cgit.cgi/openembedded/tree/recipes/vdr/vdr_1.7.10.bb
[4] http://git.gekrumbel.de/vdr.git?p=vdr.git;a=blob;f=PLUGINS/src/hello/Makefile;h=ea5b8063be9768b5097eedfc0bf210128e5d4043;hb=HEAD
[5] http://cgit.openembedded.org/cgit.cgi/openembedded/tree/conf/bitbake.conf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://lists.openembedded.org/pipermail/openembedded-devel/attachments/20100112/d2cd45d1/attachment-0002.sig>


More information about the Openembedded-devel mailing list