Is target toolchain supposed to be working?
Hi
Some of you may remember me from old times. Recently I got some work to do related with OpenEmbedded but I need working toolchain on target device.
I use openembedded-core and got few problems with "core-image-lsb-sdk" on qemux86 target (final image will be armv7 or even armv8 later).
First thing: binutils - "ld: this linker was not configured to use sysroots" even with simple hello.c source. Fix attached.
Second thing: gcc (or rather g++) which is unable to find STL headers (after installing libstdc++-dev package):
ignoring nonexistent directory "usr/include/c++/" ignoring nonexistent directory "usr/include/c++//i586-oe-linux" ignoring nonexistent directory "usr/include/c++//backward" ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/i586-oe-linux/4.7.1/../../../../i586-oe-linux/include" #include "..." search starts here:
.
#include <...> search starts here:
..
../lib
/usr/lib/gcc/i586-oe-linux/4.7.1/include /usr/lib/gcc/i586-oe-linux/4.7.1/include-fixed /usr/include
../lib/compat
End of search list.
So far I did not looked at fixing this part but will do as I want to be able to build anything on target.
So what status is of C/C++ toolchain in OE-Core?
Full log:
root@qemux86:~/dpkg-1.16.4.3/dselect# g++ -DHAVE_CONFIG_H -DLOCALEDIR=\"/usr/local/share/locale\" -DADMINDIR=\"/usr/local/var/lib/dpkg\" -DLIBDIR=\"/usr/local/lib/dpkg\" -DLOCALLIBDIR=\"/usr/local/lib/dpkg\" -idirafter ../lib/compat -iquote . -I.. -I../lib -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -Wmissing-format-attribute -Wformat-security -Wpointer-arith -Wvla -Winit-self -Wwrite-strings -Wcast-align -Wshadow -Wno-unused-value -g -O2 -MT basecmds.o -MD -MP -MF .deps/basecmds.Tpo -c -o basecmds.o basecmds.cc -v
Using built-in specs.
COLLECT_GCC=g++
Target: i586-oe-linux
Configured with:/home/hrw/HDD/devel/canonical/ci-linaro/oecore/build/tmp-oe-gcc-eglibc/work-shared/gcc-4.7.0+svnr186651-r2/gcc-4_7-branch/configure --build=x86_64-linux --host=i586-oe-linux --target=i586-oe-linux
--prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc
--sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib
--includedir=/usr/include --oldincludedir=/usr/include
--infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules
--disable-dependency-tracking --with-libtool-sysroot=/home/hrw/HDD/devel/canonical/ci-linaro/oecore/build/tmp-oe-gcc-eglibc/sysroots/qemux86 --with-gnu-ld --enable-shared --enable-languages=c,c++
--enable-threads=posix --disable-multilib --enable-c99
--enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch
--program-prefix=i586-oe-linux- --without-local-prefix
--enable-target-optspace --enable-lto --enable-libssp
--disable-bootstrap --disable-libgomp --disable-libmudflap
--with-system-zlib --with-linker-hash-style=gnu --with-ppl=no
--with-cloog=no --enable-checking=release --enable-cheaders=c_global
--with-sysroot=/ --with-build-sysroot=/home/hrw/HDD/devel/canonical/ci-linaro/oecore/build/tmp-oe-gcc-eglibc/sysroots/qemux86 --with-gxx-include-dir=/usr/include/c++/ --enable-nls --enable-__cxa_atexit
Thread model: posix
gcc version 4.7.1 20120421 (prerelease) (GCC)
COLLECT_GCC_OPTIONS='-D' 'HAVE_CONFIG_H' '-D'
'LOCALEDIR="/usr/local/share/locale"' '-D'
'ADMINDIR="/usr/local/var/lib/dpkg"' '-D' 'LIBDIR="/usr/local/lib/dpkg"'
'-D' 'LOCALLIBDIR="/usr/local/lib/dpkg"' '-idirafter' '../lib/compat'
'-iquote' '.' '-I' '..' '-I' '../lib' '-Wall' '-Wextra'
'-Wno-unused-parameter' '-Wno-missing-field-initializers'
'-Wmissing-declarations' '-Wmissing-format-attribute'
'-Wformat-security' '-Wpointer-arith' '-Wvla' '-Winit-self'
'-Wwrite-strings' '-Wcast-align' '-Wshadow' '-Wno-unused-value' '-g'
'-O2' '-MT' 'basecmds.o' '-MD' '-MP' '-MF' '.deps/basecmds.Tpo' '-c'
'-o' 'basecmds.o' '-v' '-shared-libgcc' '-mtune=pentium' '-march=pentium'
/usr/libexec/gcc/i586-oe-linux/4.7.1/cc1plus -quiet -v -I .. -I ../lib
-MD basecmds.d -MF .deps/basecmds.Tpo -MP -MT basecmds.o -D_GNU_SOURCE
-D HAVE_CONFIG_H -D LOCALEDIR="/usr/local/share/locale" -D
ADMINDIR="/usr/local/var/lib/dpkg" -D LIBDIR="/usr/local/lib/dpkg" -D
LOCALLIBDIR="/usr/local/lib/dpkg" -idirafter ../lib/compat -iquote .
basecmds.cc -quiet -dumpbase basecmds.cc -mtune=pentium -march=pentium
-auxbase-strip basecmds.o -g -O2 -Wall -Wextra -Wno-unused-parameter
-Wno-missing-field-initializers -Wmissing-declarations
-Wmissing-format-attribute -Wformat-security -Wpointer-arith -Wvla
-Winit-self -Wwrite-strings -Wcast-align -Wshadow -Wno-unused-value
-version -o /tmp/cc8JRMwR.s
GNU C++ (GCC) version 4.7.1 20120421 (prerelease) (i586-oe-linux)
compiled by GNU C version 4.7.1 20120421 (prerelease), GMP
version 5.0.4, MPFR version 3.1.0, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=37 --param ggc-min-heapsize=14944 ignoring nonexistent directory "usr/include/c++/"
ignoring nonexistent directory "usr/include/c++//i586-oe-linux" ignoring nonexistent directory "usr/include/c++//backward" ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/i586-oe-linux/4.7.1/../../../../i586-oe-linux/include" #include "..." search starts here:
.
#include <...> search starts here:
..
../lib
/usr/lib/gcc/i586-oe-linux/4.7.1/include /usr/lib/gcc/i586-oe-linux/4.7.1/include-fixed
/usr/include
../lib/compat
End of search list.
GNU C++ (GCC) version 4.7.1 20120421 (prerelease) (i586-oe-linux)
compiled by GNU C version 4.7.1 20120421 (prerelease), GMP
version 5.0.4, MPFR version 3.1.0, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=37 --param ggc-min-heapsize=14944 Compiler executable checksum: f2356c38dccf4363f0860c867fa500e7 In file included from basecmds.cc:32:0:
dselect.h:27:21: fatal error: algorithm: No such file or directory compilation terminated.
From 9a988989916b2093949696368cf96c6c4fb22c8d Mon Sep 17 00:00:00 2001
From: Marcin Juszkiewicz <[email protected]>
Date: Tue, 19 Jun 2012 13:16:53 +0200
Subject: [PATCH] binutils: set sysroot for target
"ld: this linker was not configured to use sysroots" was what I got on device instead of compiled binary.
--- meta/recipes-devtools/binutils/binutils_2.22.bb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-devtools/binutils/binutils_2.22.bb +3 -1
@@ -1,6 +1,6 @@ require binutils.inc -PR = "r9" +PR = "r10" LIC_FILES_CHKSUM="\ file://src-release;endline=17;md5=4830a9ef968f3b18dd5e9f2c00db2d35\
@@ -40,3 +40,5 @@ SRC_URI[sha256sum] = "6c7af8ed1c8cf9b4b9d6e6fe09a3e1d3d479fe63984ba8b9b26bf356b6 BBCLASSEXTEND = "native" + +EXTRA_OECONF += "--with-sysroot=/ "
Signature · 1 line
1.7.10.4
W dniu 19.06.2012 13:53, Marcin Juszkiewicz pisze:
Quoted 8 lines
ignoring nonexistent directory "
usr/include/c++/" ignoring nonexistent directory "usr/include/c++//i586-oe-linux" ignoring nonexistent directory "usr/include/c++//backward" ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/i586-oe-linux/4.7.1/../../../../i586-oe-linux/include" #include "..." search starts here:
.
Quoted 8 lines
#include <...> search starts here:
..
../lib
/usr/lib/gcc/i586-oe-linux/4.7.1/include
/usr/lib/gcc/i586-oe-linux/4.7.1/include-fixed
/usr/include
../lib/compat
End of search list.
Attached patch fixed problem for me.
From 56382cac2c337f9e620d538f8697737b2ca777cf Mon Sep 17 00:00:00 2001
From: Marcin Juszkiewicz <[email protected]>
Date: Tue, 19 Jun 2012 14:30:06 +0200
Subject: [PATCH] gcc: make sure that c++ includes will be found
Without this patch g++ was not able to find headers:
ignoring nonexistent directory "usr/include/c++/" ignoring nonexistent directory "usr/include/c++//i586-oe-linux" ignoring nonexistent directory "usr/include/c++//backward" ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/i586-oe-linux/4.7.1/../../../../i586-oe-linux/include"
.
..
../lib
/usr/lib/gcc/i586-oe-linux/4.7.1/include /usr/lib/gcc/i586-oe-linux/4.7.1/include-fixed /usr/include
../lib/compat
End of search list.
--- meta/recipes-devtools/gcc/gcc-4.7.inc | 2 +- meta/recipes-devtools/gcc/gcc-configure-target.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-devtools/gcc/gcc-4.7.inc +1 -1
@@ -1,6 +1,6 @@ require gcc-common.inc -PR = "r2" +PR = "r3" # Third digit in PV should be incremented after a minor release # happens from this branch on gcc e.g. currently its 4.7.0
meta/recipes-devtools/gcc/gcc-configure-target.inc +1 -1
@@ -3,4 +3,4 @@ require gcc-configure-common.inc EXTRA_OECONF_PATHS = " \ --with-sysroot=/ \ --with-build-sysroot=${STAGING_DIR_TARGET} \ - --with-gxx-include-dir=${includedir}/c++/" + --with-gxx-include-dir=/${includedir}/c++/"
Signature · 1 line
1.7.10.4
Quoted 18 lines · Marcin Juszkiewicz
W dniu 19.06.2012 13:53, Marcin Juszkiewicz pisze:
Quoted 8 lines
ignoring nonexistent directory "
usr/include/c++/" ignoring nonexistent directory "usr/include/c++//i586-oe-linux" ignoring nonexistent directory "usr/include/c++//backward" ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/i586-oe-linux/4.7.1/../../../../i586-oe-linux/include" #include "..." search starts here:
.Quoted 8 lines
#include <...> search starts here:
..
../lib
/usr/lib/gcc/i586-oe-linux/4.7.1/include
/usr/lib/gcc/i586-oe-linux/4.7.1/include-fixed
/usr/include
../lib/compat
End of search list.
Quoted 2 lines
Attached patch fixed problem for me.
includedir already has leading slash so I wonder if you changed includedir in your setup somehow ?
Quoted 5 lines
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
W dniu 19.06.2012 18:19, Khem Raj pisze:
Quoted 2 lines
includedir already has leading slash so I wonder if you changed includedir in your setup somehow ?
bitbake gcc -e|grep ^includedir shown "/usr/include" value. G++ started on target as "g++ -v" shown "--with-c++-includes=/usr/include/c++" so I was surprised when it was not working.
Added extra slash and it works. But please check in your configuration.
Quoted 11 lines · Marcin Juszkiewicz
W dniu 19.06.2012 18:19, Khem Raj pisze:
Quoted 2 lines
includedir already has leading slash so I wonder if you changed includedir in your setup somehow ?
bitbake gcc -e|grep ^includedir shown "
/usr/include" value. G++ started on target as "g++ -v" shown "--with-c++-includes=/usr/include/c++" so I was surprised when it was not working.Added extra slash and it works. But please check in your configuration.
can you try the fixes from my branch
http://git.openembedded.org/openembedded-core-contrib/log/?h=kraj/misc-updates
this should fix both gcc and binutils on target
Quoted 4 lines
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
W dniu 20.06.2012 09:55, Khem Raj pisze:
Quoted 16 lines
Quoted 5 lines · Marcin Juszkiewicz
W dniu 19.06.2012 18:19, Khem Raj pisze:
Quoted 2 lines
includedir already has leading slash so I wonder if you changed includedir in your setup somehow ?
Quoted 8 lines
bitbake gcc -e|grep ^includedir shown "
/usr/include" value. G++ started on target as "g++ -v" shown "--with-c++-includes=/usr/include/c++" so I was surprised when it was not working.Added extra slash and it works. But please check in your configuration.
Quoted 5 lines
can you try the fixes from my branch
http://git.openembedded.org/openembedded-core-contrib/log/?h=kraj/misc-updates
this should fix both gcc and binutils on target
I am still building one image from scratch but my build with gcc-linaro and your fix-g++-sysroot.patch applied works perfectly:
root@qemux86:~# g++ -v hello.cc -o hello
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i586-oe-linux/4.7.1/lto-wrapper
Target: i586-oe-linux
Configured with:
/home/hrw/HDD/devel/canonical/ci-linaro/oecore/build/tmp-eglibc/work-shared/gcc-linaro-4.7-r4/gcc-linaro-4.7-2012.06/configure
--build=x86_64-linux --host=i586-oe-linux --target=i586-oe-linux
--prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc
--sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib
--includedir=/usr/include --oldincludedir=/usr/include
--infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules
--disable-dependency-tracking
--with-libtool-sysroot=/home/hrw/HDD/devel/canonical/ci-linaro/oecore/build/tmp-eglibc/sysroots/qemux86
--with-gnu-ld --enable-shared --enable-languages=c,c++
--enable-threads=posix --disable-multilib --enable-c99
--enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch
--program-prefix=i586-oe-linux- --without-local-prefix
--enable-target-optspace --enable-lto --enable-libssp
--disable-bootstrap --disable-libgomp --disable-libmudflap
--with-system-zlib --with-linker-hash-style=gnu --with-ppl=no
--with-cloog=no --enable-checking=release --enable-cheaders=c_global
--with-sysroot=/
--with-build-sysroot=/home/hrw/HDD/devel/canonical/ci-linaro/oecore/build/tmp-eglibc/sysroots/qemux86
--with-gxx-include-dir=/usr/include/c++/ --enable-nls --enable-__cxa_atexit
Thread model: posix
gcc version 4.7.1 20120531 (prerelease) (Linaro GCC 4.7-2012.06)
COLLECT_GCC_OPTIONS='-v' '-o' 'hello' '-shared-libgcc' '-mtune=pentium'
'-march=pentium'
/usr/libexec/gcc/i586-oe-linux/4.7.1/cc1plus -quiet -v -D_GNU_SOURCE
hello.cc -quiet -dumpbase hello.cc -mtune=pentium -march=pentium
-auxbase hello -version -o /tmp/ccDHhaba.s
GNU C++ (Linaro GCC 4.7-2012.06) version 4.7.1 20120531 (prerelease)
(i586-oe-linux)
compiled by GNU C version 4.7.1 20120531 (prerelease), GMP
version 5.0.4, MPFR version 3.1.0, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=63 --param ggc-min-heapsize=63580
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/usr/lib/gcc/i586-oe-linux/4.7.1/../../../../i586-oe-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/
/usr/include/c++//i586-oe-linux
/usr/include/c++//backward
/usr/lib/gcc/i586-oe-linux/4.7.1/include
/usr/lib/gcc/i586-oe-linux/4.7.1/include-fixed
/usr/include
End of search list.
GNU C++ (Linaro GCC 4.7-2012.06) version 4.7.1 20120531 (prerelease)
(i586-oe-linux)
compiled by GNU C version 4.7.1 20120531 (prerelease), GMP
version 5.0.4, MPFR version 3.1.0, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=63 --param ggc-min-heapsize=63580
Compiler executable checksum: 585670605c6fcd60b0d620e1dbed0fa5
COLLECT_GCC_OPTIONS='-v' '-o' 'hello' '-shared-libgcc' '-mtune=pentium'
'-march=pentium'
/usr/lib/gcc/i586-oe-linux/4.7.1/../../../../i586-oe-linux/bin/as -v
--32 -o /tmp/ccqQP9HY.o /tmp/ccDHhaba.s
GNU assembler version 2.22 (i586-oe-linux) using BFD version (GNU
Binutils) 2.22
COMPILER_PATH=/usr/libexec/gcc/i586-oe-linux/4.7.1/:/usr/libexec/gcc/i586-oe-linux/4.7.1/:/usr/libexec/gcc/i586-oe-linux/:/usr/lib/gcc/i586-oe-linux/4.7.1/:/usr/lib/gcc/i586-oe-linux/:/usr/lib/gcc/i586-oe-linux/4.7.1/../../../../i586-oe-linux/bin/
LIBRARY_PATH=/usr/lib/gcc/i586-oe-linux/4.7.1/:/usr/lib/gcc/i586-oe-linux/4.7.1/../../../i586-oe-linux/4.7.1/:/usr/lib/gcc/i586-oe-linux/4.7.1/../../../:/lib/:/usr/lib/i586-oe-linux/4.7.1/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'hello' '-shared-libgcc' '-mtune=pentium'
'-march=pentium'
/usr/libexec/gcc/i586-oe-linux/4.7.1/collect2 --sysroot=/
--eh-frame-hdr --hash-style=gnu -m elf_i386 -dynamic-linker
/lib/ld-linux.so.2 -o hello
/usr/lib/gcc/i586-oe-linux/4.7.1/../../../crt1.o
/usr/lib/gcc/i586-oe-linux/4.7.1/../../../crti.o
/usr/lib/gcc/i586-oe-linux/4.7.1/../../../i586-oe-linux/4.7.1/crtbegin.o
-L/usr/lib/gcc/i586-oe-linux/4.7.1
-L/usr/lib/gcc/i586-oe-linux/4.7.1/../../../i586-oe-linux/4.7.1
-L/usr/lib/gcc/i586-oe-linux/4.7.1/../../..
-L/usr/lib/i586-oe-linux/4.7.1 /tmp/ccqQP9HY.o -lstdc++ -lm -lgcc_s
-lgcc -lc -lgcc_s -lgcc
/usr/lib/gcc/i586-oe-linux/4.7.1/../../../i586-oe-linux/4.7.1/crtend.o
/usr/lib/gcc/i586-oe-linux/4.7.1/../../../crtn.o
root@qemux86:~#Quoted 9 lines · Marcin Juszkiewicz
Quoted 6 lines
can you try the fixes from my branch
http://git.openembedded.org/openembedded-core-contrib/log/?h=kraj/misc-updates
this should fix both gcc and binutils on target
I am still building one image from scratch but my build with gcc-linaro and your fix-g++-sysroot.patch applied works perfectly:
thx