Is this a bug of binutils
Hi,all
I got a big problem when using the cross-toolchain to compile a simple C program. This problem since 3ae71c74c71f13a390b21b4c3ead04e51aaa82b8
which is to upgrade the binutils from 2.22 to 2.23.1
what I do is as follows, any help or ideas ?
I) Build my cross-toolchain
# git clone http://git.yoctoproject.org/git/poky/.git # cd poky # git checkout 3ae71c74c71f13a390b21b4c3ead04e51aaa82b8 -b tcmode-default ...skip some steps... # bitbake meta-toolchain Loading cache: 100% |############################################################################################| ETA: 00:00:00 Loaded 1122 entries from dependency cache.
Build Configuration:BB_VERSION = "1.17.0"BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "CentOS-6.3"TARGET_SYS = "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"DISTRO_VERSION = "1.3+snapshot-20130912"TUNE_FEATURES = "m64"TARGET_FPU = ""
meta
meta-yocto
meta-yocto-bsp = "tcmode-default:3ae71c74c71f13a390b21b4c3ead04e51aaa82b8"
..cost a long time..
all of the build work successfully
II) Install my cross-toolchain
# ./poky-eglibc-x86_64-x86_64-toolchain-1.3+snapshot-20130912.sh
Enter target directory for SDK (default: /opt/poky/1.3+snapshot): toolchain-1.3-tcmode-default
III) compile a simple C program
# cat test.c
int main ()
{
printf("hello world\n");
return 0;
}
# source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux
# $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lm
test.c: In function 'main':
test.c:3:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6
/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find /lib/libc.so.6
/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible /usr/lib/libc_nonshared.a when searching for /usr/lib/libc_nonshared.a
/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find /usr/lib/libc_nonshared.a
collect2: error: ld returned 1 exit status#cat toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux
export PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin:/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux:$PATH export PKG_CONFIG_SYSROOT_DIR=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux
export PKG_CONFIG_PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/pkgconfig
export CONFIG_SITE=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/site-config-x86_64-poky-linux
export CC="x86_64-poky-linux-gcc -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CXX="x86_64-poky-linux-g++ -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CPP="x86_64-poky-linux-gcc -E -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export AS="x86_64-poky-linux-as "
export LD="x86_64-poky-linux-ld --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export GDB=x86_64-poky-linux-gdb
export STRIP=x86_64-poky-linux-strip
export RANLIB=x86_64-poky-linux-ranlib
export OBJCOPY=x86_64-poky-linux-objcopy
export OBJDUMP=x86_64-poky-linux-objdump
export AR=x86_64-poky-linux-ar
export NM=x86_64-poky-linux-nm
export M4=m4
export TARGET_PREFIX=x86_64-poky-linux-
export CONFIGURE_FLAGS="--target=x86_64-poky-linux --host=x86_64-poky-linux --build=x86_64-linux --with-libtool-sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux" export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types"
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fpermissive"
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
export CPPFLAGS=""
export OECORE_NATIVE_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux"
export OECORE_TARGET_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export OECORE_ACLOCAL_OPTS="-I /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/share/aclocal"
export OECORE_DISTRO_VERSION="1.3+snapshot-20130912"
export OECORE_SDK_VERSION="1.3+snapshot"
Signature · 2 lines
Best regards. Li Zhijian (8555)
Hi,
Quoted 39 lines · Li Zhijian
Hi,all
I got a big problem when using the cross-toolchain to compile a simple C program. This problem since
3ae71c74c71f13a390b21b4c3ead04e51aaa82b8
which is to upgrade the binutils from 2.22 to 2.23.1what I do is as follows, any help or ideas ?
I) Build my cross-toolchain
# git clone http://git.yoctoproject.org/git/poky/.git # cd poky # git checkout 3ae71c74c71f13a390b21b4c3ead04e51aaa82b8 -b tcmode-default ...skip some steps... # bitbake meta-toolchain Loading cache: 100% |############################################################################################| ETA: 00:00:00 Loaded 1122 entries from dependency cache.Build Configuration:
BB_VERSION= "1.17.0"BUILD_SYS= "x86_64-linux"
NATIVELSBSTRING = "CentOS-6.3"TARGET_SYS= "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"DISTRO_VERSION= "1.3+snapshot-20130912"TUNE_FEATURES= "m64"TARGET_FPU= ""
meta
meta-yocto
meta-yocto-bsp = "tcmode-default:3ae71c74c71f13a390b21b4c3ead04e51aaa82b8"..cost a long time..
all of the build work successfullyII) Install my cross-toolchain
# ./poky-eglibc-x86_64-x86_64-toolchain-1.3+snapshot-20130912.sh
Enter target directory for SDK (default:/opt/poky/1.3+snapshot): toolchain-1.3-tcmode-defaultIII) compile a simple C program
Quoted 8 lines
# cat test.c
int main ()
{
printf("hello world\n");
return 0;
}
# source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux
# $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lmTechnically, for this simple program, it's enough to do:
$CC -o test test.c
The $CC contains the sysroot option and the linker will automatically prefix /lib and /usr/lib with the target sysroot. So, it should be able to compile just fine.
The -L option just adds another search path for libraries which will be searched before the default ones. So, it shouldn't be a problem.
Somehow, it looks like it tries to link against the host's libraries.
Before compiling, do a 'echo $CC' and make sure the --sysroot points to the correct directory.
Laurentiu
Quoted 48 lines
test.c: In function 'main':
test.c:3:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default] /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/lib/libc.so.6when searching for/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/usr/lib/libc_nonshared.awhen searching for/usr/lib/libc_nonshared.a/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/usr/lib/libc_nonshared.a
collect2: error: ld returned 1 exit status#cat toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux
export PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin:/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux:$PATH export PKG_CONFIG_SYSROOT_DIR=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux
export PKG_CONFIG_PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/pkgconfig
exportCONFIG_SITE=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/site-config-x86_64-poky-linux
export CC="x86_64-poky-linux-gcc -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CXX="x86_64-poky-linux-g++ -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CPP="x86_64-poky-linux-gcc -E -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export AS="x86_64-poky-linux-as "
export LD="x86_64-poky-linux-ld --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export GDB=x86_64-poky-linux-gdb
export STRIP=x86_64-poky-linux-strip
export RANLIB=x86_64-poky-linux-ranlib
export OBJCOPY=x86_64-poky-linux-objcopy
export OBJDUMP=x86_64-poky-linux-objdump
export AR=x86_64-poky-linux-ar
export NM=x86_64-poky-linux-nm
export M4=m4
export TARGET_PREFIX=x86_64-poky-linux-
export CONFIGURE_FLAGS="--target=x86_64-poky-linux --host=x86_64-poky-linux --build=x86_64-linux --with-libtool-sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux" export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types"
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fpermissive"
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
export CPPFLAGS=""
export OECORE_NATIVE_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux"
export OECORE_TARGET_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export OECORE_ACLOCAL_OPTS="-I /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/share/aclocal"
export OECORE_DISTRO_VERSION="1.3+snapshot-20130912"
export OECORE_SDK_VERSION="1.3+snapshot"Signature · 8 lines
Best regards. Li Zhijian (8555) _______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto
Quoted 8 lines · Laurentiu Palcu
Hi,
Quoted 5 lines · Li Zhijian
Hi,all
I got a big problem when using the cross-toolchain to compile a simple C program. This problem since
3ae71c74c71f13a390b21b4c3ead04e51aaa82b8
which is to upgrade the binutils from 2.22 to 2.23.1
Apparently I missed this... Make sure you checkout 0333796a6b167dd754806700d7f771dd4a74e4ab (binutils_2.23.1.bb: Correct typo in enable-targets configure option). This might be your problem.
Laurentiu
Quoted 112 lines
Quoted 34 lines
what I do is as follows, any help or ideas ?
I) Build my cross-toolchain
# git clone http://git.yoctoproject.org/git/poky/.git # cd poky # git checkout 3ae71c74c71f13a390b21b4c3ead04e51aaa82b8 -b tcmode-default ...skip some steps... # bitbake meta-toolchain Loading cache: 100% |############################################################################################| ETA: 00:00:00 Loaded 1122 entries from dependency cache.Build Configuration:
BB_VERSION= "1.17.0"BUILD_SYS= "x86_64-linux"
NATIVELSBSTRING = "CentOS-6.3"TARGET_SYS= "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"DISTRO_VERSION= "1.3+snapshot-20130912"TUNE_FEATURES= "m64"TARGET_FPU= ""
meta
meta-yocto
meta-yocto-bsp = "tcmode-default:3ae71c74c71f13a390b21b4c3ead04e51aaa82b8"..cost a long time..
all of the build work successfullyII) Install my cross-toolchain
# ./poky-eglibc-x86_64-x86_64-toolchain-1.3+snapshot-20130912.sh
Enter target directory for SDK (default:/opt/poky/1.3+snapshot): toolchain-1.3-tcmode-defaultIII) compile a simple C program
Quoted 8 lines
# cat test.c int main () { printf("hello world\n"); return 0; } # source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux # $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lmTechnically, for this simple program, it's enough to do:
$CC -o test
test.cThe $CC contains the sysroot option and the linker will automatically prefix /lib and
/usr/libwith the target sysroot. So, it should be able to compile just fine.The -L option just adds another search path for libraries which will be searched before the default ones. So, it shouldn't be a problem.
Somehow, it looks like it tries to link against the host's libraries.
Before compiling, do a 'echo $CC' and make sure the --sysroot points to the correct directory.
Laurentiu
Quoted 30 lines
test.c: In function 'main':
test.c:3:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default] /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/lib/libc.so.6when searching for/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/usr/lib/libc_nonshared.awhen searching for/usr/lib/libc_nonshared.a/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/usr/lib/libc_nonshared.a
collect2: error: ld returned 1 exit status#cat toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux
export PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin:/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux:$PATH export PKG_CONFIG_SYSROOT_DIR=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux
export PKG_CONFIG_PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/pkgconfig
exportCONFIG_SITE=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/site-config-x86_64-poky-linux
export CC="x86_64-poky-linux-gcc -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CXX="x86_64-poky-linux-g++ -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CPP="x86_64-poky-linux-gcc -E -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export AS="x86_64-poky-linux-as "
export LD="x86_64-poky-linux-ld --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export GDB=x86_64-poky-linux-gdb
export STRIP=x86_64-poky-linux-strip
export RANLIB=x86_64-poky-linux-ranlib
export OBJCOPY=x86_64-poky-linux-objcopy
export OBJDUMP=x86_64-poky-linux-objdump
export AR=x86_64-poky-linux-ar
export NM=x86_64-poky-linux-nm
export M4=m4
export TARGET_PREFIX=x86_64-poky-linux-
export CONFIGURE_FLAGS="--target=x86_64-poky-linux --host=x86_64-poky-linux --build=x86_64-linux --with-libtool-sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux" export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types"Quoted 18 lines
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fpermissive"
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
export CPPFLAGS=""
export OECORE_NATIVE_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux" export OECORE_TARGET_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux" export OECORE_ACLOCAL_OPTS="-I /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/share/aclocal" export OECORE_DISTRO_VERSION="1.3+snapshot-20130912"
export OECORE_SDK_VERSION="1.3+snapshot"Signature · 8 lines
Best regards. Li Zhijian (8555) _______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky
Quoted 50 lines · Laurentiu Palcu
Hi,
Quoted 39 lines · Li Zhijian
Hi,all
I got a big problem when using the cross-toolchain to compile a simple C program. This problem since
3ae71c74c71f13a390b21b4c3ead04e51aaa82b8
which is to upgrade the binutils from 2.22 to 2.23.1what I do is as follows, any help or ideas ?
I) Build my cross-toolchain
# git clone http://git.yoctoproject.org/git/poky/.git # cd poky # git checkout 3ae71c74c71f13a390b21b4c3ead04e51aaa82b8 -b tcmode-default ...skip some steps... # bitbake meta-toolchain Loading cache: 100% |############################################################################################| ETA: 00:00:00 Loaded 1122 entries from dependency cache.Build Configuration:
BB_VERSION= "1.17.0"BUILD_SYS= "x86_64-linux"
NATIVELSBSTRING = "CentOS-6.3"TARGET_SYS= "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"DISTRO_VERSION= "1.3+snapshot-20130912"TUNE_FEATURES= "m64"TARGET_FPU= ""
meta
meta-yocto
meta-yocto-bsp = "tcmode-default:3ae71c74c71f13a390b21b4c3ead04e51aaa82b8"..cost a long time..
all of the build work successfullyII) Install my cross-toolchain
# ./poky-eglibc-x86_64-x86_64-toolchain-1.3+snapshot-20130912.sh
Enter target directory for SDK (default:/opt/poky/1.3+snapshot): toolchain-1.3-tcmode-defaultIII) compile a simple C program
Quoted 8 lines
# cat test.c int main () { printf("hello world\n"); return 0; } # source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux # $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lm
Quoted 3 lines
Technically, for this simple program, it's enough to do:
$CC -o test
test.c
i know that is enough and it is compiled OK
but in the case with -L option ,it is failed
Quoted 3 lines
The $CC contains the sysroot option and the linker will automatically prefix /lib and
/usr/libwith the target sysroot. So, it should be able to compile just fine.
I haved source the toolchian environment which is installed by ./poky-eglibc-x86_64-x86_64-toolchain-1.3+snapshot-20130912.sh and i think that would include all the correct environment value
# source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux this file's detail is at the last of this thread
# echo $CC x86_64-poky-linux-gcc -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux
the sysroot points to directory which is install by ./poky-eglibc-x86_64-x86_64-toolchain-1.3+snapshot-20130912.sh this directory includes a basic target sysroot
Quoted 5 lines
The -L option just adds another search path for libraries which will be searched before the default ones. So, it shouldn't be a problem.
Somehow, it looks like it tries to link against the host's libraries.
yes, it seems that ld try to link to host's libraries but i am not sure that if i had do some wrong steps
Quoted 2 lines
Before compiling, do a 'echo $CC' and make sure the --sysroot points to the correct directory.
you means that i must make --sysroot points to the sysroot build by myself instead of the sysroot provided by poky-eglibc-x86_64-x86_64-toolchain-1.3+snapshot-20130912.sh ??
Signature · 2 lines
Best regards. Li Zhijian
Quoted 52 lines
Laurentiu
Quoted 48 lines
test.c: In function 'main':
test.c:3:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default] /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/lib/libc.so.6when searching for/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/usr/lib/libc_nonshared.awhen searching for/usr/lib/libc_nonshared.a/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/usr/lib/libc_nonshared.a
collect2: error: ld returned 1 exit status#cat toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux
export PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin:/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux:$PATH export PKG_CONFIG_SYSROOT_DIR=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux
export PKG_CONFIG_PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/pkgconfig
exportCONFIG_SITE=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/site-config-x86_64-poky-linux
export CC="x86_64-poky-linux-gcc -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CXX="x86_64-poky-linux-g++ -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CPP="x86_64-poky-linux-gcc -E -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export AS="x86_64-poky-linux-as "
export LD="x86_64-poky-linux-ld --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export GDB=x86_64-poky-linux-gdb
export STRIP=x86_64-poky-linux-strip
export RANLIB=x86_64-poky-linux-ranlib
export OBJCOPY=x86_64-poky-linux-objcopy
export OBJDUMP=x86_64-poky-linux-objdump
export AR=x86_64-poky-linux-ar
export NM=x86_64-poky-linux-nm
export M4=m4
export TARGET_PREFIX=x86_64-poky-linux-
export CONFIGURE_FLAGS="--target=x86_64-poky-linux --host=x86_64-poky-linux --build=x86_64-linux --with-libtool-sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux" export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types"
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fpermissive"
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
export CPPFLAGS=""
export OECORE_NATIVE_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux"
export OECORE_TARGET_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export OECORE_ACLOCAL_OPTS="-I /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/share/aclocal"
export OECORE_DISTRO_VERSION="1.3+snapshot-20130912"
export OECORE_SDK_VERSION="1.3+snapshot"Signature · 8 lines
Best regards. Li Zhijian (8555) _______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto
Quoted 6 lines · Laurentiu Palcu
Quoted 5 lines · Laurentiu Palcu
Hi,
Quoted 2 lines · Li Zhijian
Hi,all
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
I got a big problem when using the cross-toolchain to compile a simple C program. This problem since
3ae71c74c71f13a390b21b4c3ead04e51aaa82b8
which is to upgrade the binutils from 2.22 to 2.23.1Apparently I missed this... Make sure you checkout
0333796a6b167dd754806700d7f771dd4a74e4ab(binutils_2.23.1.bb: Correct typo in enable-targets configure option). This might be your problem.Laurentiu
i am sorry,i don't understand what do you mean
in poky git tree,
3ae71c74c71f13a390b21b4c3ead04e51aaa82b8 is newer than 0333796a6b167dd754806700d7f771dd4a74e4ab
this checkout 0333796a6b167dd754806700d7f771dd4a74e4ab , toolchain work fine
# git log commit 3ae71c74c71f13a390b21b4c3ead04e51aaa82b8 Author: Khem Raj <[email protected]> Date: Wed Aug 8 10:33:41 2012 -0700
tcmode-default.inc: Use binutils 2.23.1
...skip...
commit 0333796a6b167dd754806700d7f771dd4a74e4ab
Author: Khem Raj <[email protected]> Date: Wed Aug 8 07:57:46 2012 -0700
oprofile: Include config.h before bfd.h
oprofile uses bfd.h from binutils which now in 2.23+ expects config.h so lets include it
...skip...
Signature · 2 lines
Best regards. Li Zhijian
Quoted 112 lines
Quoted 111 lines
Quoted 33 lines
what I do is as follows, any help or ideas ?
I) Build my cross-toolchain
# git clone http://git.yoctoproject.org/git/poky/.git # cd poky # git checkout 3ae71c74c71f13a390b21b4c3ead04e51aaa82b8 -b tcmode-default ...skip some steps... # bitbake meta-toolchain Loading cache: 100% |############################################################################################| ETA: 00:00:00 Loaded 1122 entries from dependency cache.Build Configuration:
BB_VERSION= "1.17.0"BUILD_SYS= "x86_64-linux"
NATIVELSBSTRING = "CentOS-6.3"TARGET_SYS= "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"DISTRO_VERSION= "1.3+snapshot-20130912"TUNE_FEATURES= "m64"TARGET_FPU= ""
meta
meta-yocto
meta-yocto-bsp = "tcmode-default:3ae71c74c71f13a390b21b4c3ead04e51aaa82b8"..cost a long time..
all of the build work successfullyII) Install my cross-toolchain
# ./poky-eglibc-x86_64-x86_64-toolchain-1.3+snapshot-20130912.sh
Enter target directory for SDK (default:/opt/poky/1.3+snapshot): toolchain-1.3-tcmode-defaultIII) compile a simple C program
Quoted 8 lines
# cat test.c int main () { printf("hello world\n"); return 0; } # source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux # $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lmTechnically, for this simple program, it's enough to do:
$CC -o test
test.cThe $CC contains the sysroot option and the linker will automatically prefix /lib and
/usr/libwith the target sysroot. So, it should be able to compile just fine.The -L option just adds another search path for libraries which will be searched before the default ones. So, it shouldn't be a problem.
Somehow, it looks like it tries to link against the host's libraries.
Before compiling, do a 'echo $CC' and make sure the --sysroot points to the correct directory.
Laurentiu
Quoted 30 lines
test.c: In function 'main':
test.c:3:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default] /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/lib/libc.so.6when searching for/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/usr/lib/libc_nonshared.awhen searching for/usr/lib/libc_nonshared.a/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/usr/lib/libc_nonshared.a
collect2: error: ld returned 1 exit status#cat toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux
export PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin:/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux:$PATH export PKG_CONFIG_SYSROOT_DIR=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux
export PKG_CONFIG_PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/pkgconfig
exportCONFIG_SITE=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/site-config-x86_64-poky-linux
export CC="x86_64-poky-linux-gcc -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CXX="x86_64-poky-linux-g++ -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CPP="x86_64-poky-linux-gcc -E -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export AS="x86_64-poky-linux-as "
export LD="x86_64-poky-linux-ld --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export GDB=x86_64-poky-linux-gdb
export STRIP=x86_64-poky-linux-strip
export RANLIB=x86_64-poky-linux-ranlib
export OBJCOPY=x86_64-poky-linux-objcopy
export OBJDUMP=x86_64-poky-linux-objdump
export AR=x86_64-poky-linux-ar
export NM=x86_64-poky-linux-nm
export M4=m4
export TARGET_PREFIX=x86_64-poky-linux-
export CONFIGURE_FLAGS="--target=x86_64-poky-linux --host=x86_64-poky-linux --build=x86_64-linux --with-libtool-sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux" export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types"Quoted 18 lines
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fpermissive"
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
export CPPFLAGS=""
export OECORE_NATIVE_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux" export OECORE_TARGET_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux" export OECORE_ACLOCAL_OPTS="-I /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/share/aclocal" export OECORE_DISTRO_VERSION="1.3+snapshot-20130912"
export OECORE_SDK_VERSION="1.3+snapshot"Signature · 8 lines
Best regards. Li Zhijian (8555) _______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky
Quoted 10 lines · Li Zhijian
Quoted 9 lines · Laurentiu Palcu
Quoted 8 lines · Laurentiu Palcu
Hi,
Quoted 5 lines · Li Zhijian
Hi,all
I got a big problem when using the cross-toolchain to compile a simple C program. This problem since
3ae71c74c71f13a390b21b4c3ead04e51aaa82b8
which is to upgrade the binutils from 2.22 to 2.23.1
Quoted 6 lines
Quoted 5 lines
Apparently I missed this... Make sure you checkout
0333796a6b167dd754806700d7f771dd4a74e4ab(binutils_2.23.1.bb: Correct typo in enable-targets configure option). This might be your problem.Laurentiu
i am sorry,i don't understand what do you mean
My bad, I copy-pasted the wrong sha1 (the summary was good though). Here's the correct sha1: a8fa49fbc21d460479ecadeb1996a800cc4e3e07
Laurentiu
Quoted 146 lines
in poky git tree,
3ae71c74c71f13a390b21b4c3ead04e51aaa82b8is newer than0333796a6b167dd754806700d7f771dd4a74e4abthis checkout
0333796a6b167dd754806700d7f771dd4a74e4ab, toolchain work fine# git log commit 3ae71c74c71f13a390b21b4c3ead04e51aaa82b8 Author: Khem Raj <[email protected]> Date: Wed Aug 8 10:33:41 2012 -0700tcmode-default.inc: Use binutils 2.23.1
...skip...commit
0333796a6b167dd754806700d7f771dd4a74e4abAuthor: Khem Raj <[email protected]> Date: Wed Aug 8 07:57:46 2012 -0700oprofile: Include
config.hbeforebfd.hoprofile uses
bfd.hfrom binutils which now in 2.23+ expectsconfig.hso lets include it
...skip...Signature · 2 lines
Best regards. Li ZhijianQuoted 112 lines
Quoted 111 lines
Quoted 33 lines
what I do is as follows, any help or ideas ?
I) Build my cross-toolchain
# git clone http://git.yoctoproject.org/git/poky/.git # cd poky # git checkout 3ae71c74c71f13a390b21b4c3ead04e51aaa82b8 -b tcmode-default ...skip some steps... # bitbake meta-toolchain Loading cache: 100% |############################################################################################| ETA: 00:00:00 Loaded 1122 entries from dependency cache.Build Configuration:
BB_VERSION= "1.17.0"BUILD_SYS= "x86_64-linux"
NATIVELSBSTRING = "CentOS-6.3"TARGET_SYS= "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"DISTRO_VERSION= "1.3+snapshot-20130912"TUNE_FEATURES= "m64"TARGET_FPU= ""
meta
meta-yocto
meta-yocto-bsp = "tcmode-default:3ae71c74c71f13a390b21b4c3ead04e51aaa82b8"..cost a long time..
all of the build work successfullyII) Install my cross-toolchain
# ./poky-eglibc-x86_64-x86_64-toolchain-1.3+snapshot-20130912.sh
Enter target directory for SDK (default:/opt/poky/1.3+snapshot): toolchain-1.3-tcmode-defaultIII) compile a simple C program
Quoted 8 lines
# cat test.c int main () { printf("hello world\n"); return 0; } # source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux # $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lmTechnically, for this simple program, it's enough to do:
$CC -o test
test.cThe $CC contains the sysroot option and the linker will automatically prefix /lib and
/usr/libwith the target sysroot. So, it should be able to compile just fine.The -L option just adds another search path for libraries which will be searched before the default ones. So, it shouldn't be a problem.
Somehow, it looks like it tries to link against the host's libraries.
Before compiling, do a 'echo $CC' and make sure the --sysroot points to the correct directory.
Laurentiu
Quoted 30 lines
test.c: In function 'main':
test.c:3:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default] /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/lib/libc.so.6when searching for/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/usr/lib/libc_nonshared.awhen searching for/usr/lib/libc_nonshared.a/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/usr/lib/libc_nonshared.a
collect2: error: ld returned 1 exit status#cat toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux
export PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin:/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux:$PATH export PKG_CONFIG_SYSROOT_DIR=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux
export PKG_CONFIG_PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/pkgconfig
exportCONFIG_SITE=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/site-config-x86_64-poky-linux
export CC="x86_64-poky-linux-gcc -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CXX="x86_64-poky-linux-g++ -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CPP="x86_64-poky-linux-gcc -E -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export AS="x86_64-poky-linux-as "
export LD="x86_64-poky-linux-ld --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export GDB=x86_64-poky-linux-gdb
export STRIP=x86_64-poky-linux-strip
export RANLIB=x86_64-poky-linux-ranlib
export OBJCOPY=x86_64-poky-linux-objcopy
export OBJDUMP=x86_64-poky-linux-objdump
export AR=x86_64-poky-linux-ar
export NM=x86_64-poky-linux-nm
export M4=m4
export TARGET_PREFIX=x86_64-poky-linux-
export CONFIGURE_FLAGS="--target=x86_64-poky-linux --host=x86_64-poky-linux --build=x86_64-linux --with-libtool-sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux" export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types"Quoted 18 lines
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fpermissive"
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
export CPPFLAGS=""
export OECORE_NATIVE_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux" export OECORE_TARGET_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux" export OECORE_ACLOCAL_OPTS="-I /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/share/aclocal" export OECORE_DISTRO_VERSION="1.3+snapshot-20130912"
export OECORE_SDK_VERSION="1.3+snapshot"Signature · 8 lines
Best regards. Li Zhijian (8555) _______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky
Quoted 11 lines · Laurentiu Palcu
Quoted 10 lines · Li Zhijian
Quoted 9 lines · Laurentiu Palcu
Quoted 8 lines · Laurentiu Palcu
Hi,
Quoted 5 lines · Li Zhijian
Hi,all
I got a big problem when using the cross-toolchain to compile a simple C program. This problem since
3ae71c74c71f13a390b21b4c3ead04e51aaa82b8
which is to upgrade the binutils from 2.22 to 2.23.1
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Apparently I missed this... Make sure you checkout
0333796a6b167dd754806700d7f771dd4a74e4ab(binutils_2.23.1.bb: Correct typo in enable-targets configure option). This might be your problem.Laurentiu
i am sorry,i don't understand what do you mean
My bad, I copy-pasted the wrong sha1 (the summary was good though). Here's the correct sha1:
a8fa49fbc21d460479ecadeb1996a800cc4e3e07
not really this fix,i build meta-toolchain on yocto-1.4.1(73f103bf9b2cdf985464dc53bf4f1cfd71d4531f) and got the same problem
even at the latest poky, got the same problem
Signature · 2 lines
Best regards. Li Zhijian
Quoted 145 lines
Laurentiu
Quoted 143 lines
in poky git tree,
3ae71c74c71f13a390b21b4c3ead04e51aaa82b8is newer than0333796a6b167dd754806700d7f771dd4a74e4abthis checkout
0333796a6b167dd754806700d7f771dd4a74e4ab, toolchain work fine# git log commit 3ae71c74c71f13a390b21b4c3ead04e51aaa82b8 Author: Khem Raj <[email protected]> Date: Wed Aug 8 10:33:41 2012 -0700tcmode-default.inc: Use binutils 2.23.1
...skip...commit
0333796a6b167dd754806700d7f771dd4a74e4abAuthor: Khem Raj <[email protected]> Date: Wed Aug 8 07:57:46 2012 -0700oprofile: Include
config.hbeforebfd.hoprofile uses
bfd.hfrom binutils which now in 2.23+ expectsconfig.hso lets include it
...skip...Signature · 2 lines
Best regards. Li ZhijianQuoted 111 lines
Quoted 111 lines
Quoted 33 lines
what I do is as follows, any help or ideas ?
I) Build my cross-toolchain
# git clone http://git.yoctoproject.org/git/poky/.git # cd poky # git checkout 3ae71c74c71f13a390b21b4c3ead04e51aaa82b8 -b tcmode-default ...skip some steps... # bitbake meta-toolchain Loading cache: 100% |############################################################################################| ETA: 00:00:00 Loaded 1122 entries from dependency cache.Build Configuration:
BB_VERSION= "1.17.0"BUILD_SYS= "x86_64-linux"
NATIVELSBSTRING = "CentOS-6.3"TARGET_SYS= "x86_64-poky-linux"
MACHINE = "qemux86-64"
DISTRO = "poky"DISTRO_VERSION= "1.3+snapshot-20130912"TUNE_FEATURES= "m64"TARGET_FPU= ""
meta
meta-yocto
meta-yocto-bsp = "tcmode-default:3ae71c74c71f13a390b21b4c3ead04e51aaa82b8"..cost a long time..
all of the build work successfullyII) Install my cross-toolchain
# ./poky-eglibc-x86_64-x86_64-toolchain-1.3+snapshot-20130912.sh
Enter target directory for SDK (default:/opt/poky/1.3+snapshot): toolchain-1.3-tcmode-defaultIII) compile a simple C program
Quoted 8 lines
# cat test.c int main () { printf("hello world\n"); return 0; } # source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux # $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lmTechnically, for this simple program, it's enough to do:
$CC -o test
test.cThe $CC contains the sysroot option and the linker will automatically prefix /lib and
/usr/libwith the target sysroot. So, it should be able to compile just fine.The -L option just adds another search path for libraries which will be searched before the default ones. So, it shouldn't be a problem.
Somehow, it looks like it tries to link against the host's libraries.
Before compiling, do a 'echo $CC' and make sure the --sysroot points to the correct directory.
Laurentiu
Quoted 30 lines
test.c: In function 'main':
test.c:3:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default] /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/lib/libc.so.6when searching for/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/usr/lib/libc_nonshared.awhen searching for/usr/lib/libc_nonshared.a/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/usr/lib/libc_nonshared.a
collect2: error: ld returned 1 exit status#cat toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux
export PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin:/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux:$PATH export PKG_CONFIG_SYSROOT_DIR=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux
export PKG_CONFIG_PATH=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/pkgconfig
exportCONFIG_SITE=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/site-config-x86_64-poky-linux
export CC="x86_64-poky-linux-gcc -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CXX="x86_64-poky-linux-g++ -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export CPP="x86_64-poky-linux-gcc -E -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export AS="x86_64-poky-linux-as "
export LD="x86_64-poky-linux-ld --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux"
export GDB=x86_64-poky-linux-gdb
export STRIP=x86_64-poky-linux-strip
export RANLIB=x86_64-poky-linux-ranlib
export OBJCOPY=x86_64-poky-linux-objcopy
export OBJDUMP=x86_64-poky-linux-objdump
export AR=x86_64-poky-linux-ar
export NM=x86_64-poky-linux-nm
export M4=m4
export TARGET_PREFIX=x86_64-poky-linux-
export CONFIGURE_FLAGS="--target=x86_64-poky-linux --host=x86_64-poky-linux --build=x86_64-linux --with-libtool-sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux" export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types"Quoted 18 lines
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -fpermissive"
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
export CPPFLAGS=""
export OECORE_NATIVE_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux" export OECORE_TARGET_SYSROOT="/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux" export OECORE_ACLOCAL_OPTS="-I /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/share/aclocal" export OECORE_DISTRO_VERSION="1.3+snapshot-20130912"
export OECORE_SDK_VERSION="1.3+snapshot"Signature · 8 lines
Best regards. Li Zhijian (8555) _______________________________________________ yocto mailing list [email protected] https://lists.yoctoproject.org/listinfo/yocto_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky
Hi,
Quoted 10 lines · Li Zhijian
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
III) compile a simple C program
# cat test.c int main () { printf("hello world\n"); return 0; } # source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux # $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lm
OK, it looks like something strange happens in your setup.
To debug it, let's add '-Wl,--verbose' at the end of your command and you should be able to see where the linker is looking for libraries. Also, the linker script will be printed.
You should see it try your directory first tmp/sysroots/qemux86-64/usr/lib/, and then fall through the default ones with the sysroot prefix added and, at the end, the system ones:
/lib:/usr/lib.
Thanks,
Laurentiu
Quoted 18 lines · Laurentiu Palcu
Hi,
Quoted 9 lines · Li Zhijian
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
III) compile a simple C program
# cat test.c int main () { printf("hello world\n"); return 0; } # source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux # $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lmOK, it looks like something strange happens in your setup.
To debug it, let's add '-Wl,--verbose' at the end of your command and you should be able to see where the linker is looking for libraries. Also, the linker script will be printed.
Quoted 7 lines
You should see it try your directory first tmp/sysroots/qemux86-64/usr/lib/, and then fall through the default ones with the sysroot prefix added and, at the end, the system ones:
/lib:/usr/lib.Thanks,
Laurentiu
First,in this case
[lizj@suika x86-64-yocto-1.3]$ source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux
[lizj@suika x86-64-yocto-1.3]$ echo $CC
x86_64-poky-linux-gcc -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux [lizj@suika x86-64-yocto-1.3]$ $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lm -Wl,--verbosetest.c: In function 'main':
test.c:3:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
GNU ld (GNU Binutils) 2.23.1.20121113
Supported emulations:
elf_x86_64
elf32_x86_64
elf_i386
i386linux
elf_l1om
elf_k1om
using internal linker script:
==================================================
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
"elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)ENTRY(_start)SEARCH_DIR("/opt/poky/1.3+snapshot/sysroots/x86_64-pokysdk-linux/usr/x86_64-poky-linux/lib64"); SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR("=/usr/lib64"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); SECTIONS
{
/* Read-only sections, merged into text segment: */
PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS;
.interp : { *(.interp) }
.note.gnu.build-id : { *(.note.gnu.build-id) }
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rela.dyn :
{
*(.rela.init)
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
*(.rela.fini)
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
*(.rela.ctors)
*(.rela.dtors)
*(.rela.got)
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
*(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*)
*(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*)
*(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*)
*(.rela.ifunc)
}
.rela.plt :
{
*(.rela.plt)
PROVIDE_HIDDEN (__rela_iplt_start = .);
*(.rela.iplt)
PROVIDE_HIDDEN (__rela_iplt_end = .);
}
.init :
{
KEEP (*(SORT_NONE(.init)))
}
.plt : { *(.plt) *(.iplt) }
.text :
{
*(.text.unlikely .text.*_unlikely)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
*(.text.hot .text.hot.*)
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
}
.fini :
{
KEEP (*(SORT_NONE(.fini)))
}
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
.gcc_except_table.*) }
/* These sections are generated by the Sun/Oracle C++ compiler. */
.exception_ranges : ONLY_IF_RO { *(.exception_ranges
.exception_ranges*) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
/* Exception handling */
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
.exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
/* Thread Local Storage sections */
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
}
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
}
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array))
PROVIDE_HIDDEN (__fini_array_end = .);
}
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin?.o(.ctors))
/* We don't want to include the .ctor section from
the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
.jcr : { KEEP (*(.jcr)) }
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
.dynamic : { *(.dynamic) }
.got : { *(.got) *(.igot) }
. = DATA_SEGMENT_RELRO_END (SIZEOF (.got.plt) >= 24 ? 24 : 0, .);
.got.plt : { *(.got.plt) *(.igot.plt) }
.data :
{
*(.data .data.* .gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
_edata = .; PROVIDE (edata = .);
. = .;
__bss_start = .;
.bss :
{
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections.
FIXME: Why do we need it? When there is no .bss section, we don't
pad the .data section. */
. = ALIGN(. != 0 ? 64 / 8 : 1);
}
.lbss :
{
*(.dynlbss)
*(.lbss .lbss.* .gnu.linkonce.lb.*)
*(LARGE_COMMON)
}
. = ALIGN(64 / 8);
.lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
{
*(.lrodata .lrodata.* .gnu.linkonce.lr.*)
}
.ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
{
*(.ldata .ldata.* .gnu.linkonce.l.*)
. = ALIGN(. != 0 ? 64 / 8 : 1);
}
. = ALIGN(64 / 8);
_end = .; PROVIDE (end = .);
. = DATA_SEGMENT_END (.);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) } /* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) } .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) }
/* DWARF 3 */
.debug_pubtypes 0 : { *(.debug_pubtypes) }
.debug_ranges 0 : { *(.debug_ranges) }
/* DWARF Extension. */
.debug_macro 0 : { *(.debug_macro) }
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
}
==================================================
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/../lib/crt1.o succeeded /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/../lib/crt1.o
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/../lib/crti.o succeeded /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/../lib/crti.o
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/x86_64-poky-linux/4.7.2/crtbegin.o succeeded /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/x86_64-poky-linux/4.7.2/crtbegin.o
attempt to open /tmp/ccyeJPMB.o succeeded/tmp/ccyeJPMB.o
attempt to open tmp/sysroots/qemux86-64/usr/lib//libm.so succeeded
-lm (tmp/sysroots/qemux86-64/usr/lib//libm.so)
attempt to open tmp/sysroots/qemux86-64/usr/lib//libgcc.so failed
attempt to open tmp/sysroots/qemux86-64/usr/lib//libgcc.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/libgcc.so failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/libgcc.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/libgcc.so failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/libgcc.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/lib/../lib/libgcc.so failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/lib/../lib/libgcc.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/x86_64-poky-linux/4.7.2/libgcc.so failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/x86_64-poky-linux/4.7.2/libgcc.a succeeded
attempt to open tmp/sysroots/qemux86-64/usr/lib//libgcc_s.so failed
attempt to open tmp/sysroots/qemux86-64/usr/lib//libgcc_s.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/libgcc_s.so failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/libgcc_s.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/libgcc_s.so failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/libgcc_s.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/lib/../lib/libgcc_s.so succeeded
-lgcc_s (/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/lib/../lib/libgcc_s.so)
attempt to open tmp/sysroots/qemux86-64/usr/lib//libc.so succeeded
opened script file tmp/sysroots/qemux86-64/usr/lib//libc.so
opened script file tmp/sysroots/qemux86-64/usr/lib//libc.so
attempt to open /lib/libc.so.6 succeeded
attempt to open /usr/lib/libc_nonshared.a succeeded
attempt to open /lib/ld-linux-x86-64.so.2 succeeded/lib/ld-linux-x86-64.so.2
/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6 /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find /lib/libc.so.6 /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible /usr/lib/libc_nonshared.a when searching for /usr/lib/libc_nonshared.a /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find /usr/lib/libc_nonshared.a
collect2: error: ld returned 1 exit status
Signature · 2 lines
Best regards. Li Zhijian
Quoted 24 lines · Li Zhijian
Quoted 23 lines · Laurentiu Palcu
Hi,
Quoted 9 lines · Li Zhijian
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
III) compile a simple C program
# cat test.c int main () { printf("hello world\n"); return 0; } # source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux # $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lmOK, it looks like something strange happens in your setup.
To debug it, let's add '-Wl,--verbose' at the end of your command and you should be able to see where the linker is looking for libraries. Also, the linker script will be printed.
You should see it try your directory first tmp/sysroots/qemux86-64/usr/lib/, and then fall through the default ones with the sysroot prefix added and, at the end, the system ones:
/lib:/usr/lib.
Quoted 4 lines
Quoted 2 lines
Thanks,
LaurentiuFirst,in this case
Secondly,
clear all the environment setuped with environment-setup-x86_64-poky-linux previously and then set --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64
In this case ,toolchain work fine
[lizj@suika x86-64-yocto-1.3]$ bash
[lizj@suika x86-64-yocto-1.3]$ /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64 -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lm x86-64 -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lm -Wl,--verbosetest.c: In function 'main':
test.c:3:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
GNU ld (GNU Binutils) 2.23.1.20121113
Supported emulations:
elf_x86_64
elf32_x86_64
elf_i386
i386linux
elf_l1om
elf_k1om
using internal linker script:
==================================================
/* Script for -z combreloc: combine and sort reloc sections */
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
"elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)ENTRY(_start)SEARCH_DIR("/opt/poky/1.3+snapshot/sysroots/x86_64-pokysdk-linux/usr/x86_64-poky-linux/lib64"); SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR("=/usr/lib64"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib"); SECTIONS
{
/* Read-only sections, merged into text segment: */
PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS;
.interp : { *(.interp) }
.note.gnu.build-id : { *(.note.gnu.build-id) }
.hash : { *(.hash) }
.gnu.hash : { *(.gnu.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rela.dyn :
{
*(.rela.init)
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
*(.rela.fini)
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
*(.rela.ctors)
*(.rela.dtors)
*(.rela.got)
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
*(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*)
*(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*)
*(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*)
*(.rela.ifunc)
}
.rela.plt :
{
*(.rela.plt)
PROVIDE_HIDDEN (__rela_iplt_start = .);
*(.rela.iplt)
PROVIDE_HIDDEN (__rela_iplt_end = .);
}
.init :
{
KEEP (*(SORT_NONE(.init)))
}
.plt : { *(.plt) *(.iplt) }
.text :
{
*(.text.unlikely .text.*_unlikely)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
*(.text.hot .text.hot.*)
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
}
.fini :
{
KEEP (*(SORT_NONE(.fini)))
}
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table
.gcc_except_table.*) }
/* These sections are generated by the Sun/Oracle C++ compiler. */
.exception_ranges : ONLY_IF_RO { *(.exception_ranges
.exception_ranges*) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
/* Exception handling */
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
.exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }
/* Thread Local Storage sections */
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
}
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
}
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array))
PROVIDE_HIDDEN (__fini_array_end = .);
}
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin?.o(.ctors))
/* We don't want to include the .ctor section from
the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
.jcr : { KEEP (*(.jcr)) }
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }
.dynamic : { *(.dynamic) }
.got : { *(.got) *(.igot) }
. = DATA_SEGMENT_RELRO_END (SIZEOF (.got.plt) >= 24 ? 24 : 0, .);
.got.plt : { *(.got.plt) *(.igot.plt) }
.data :
{
*(.data .data.* .gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
_edata = .; PROVIDE (edata = .);
. = .;
__bss_start = .;
.bss :
{
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections.
FIXME: Why do we need it? When there is no .bss section, we don't
pad the .data section. */
. = ALIGN(. != 0 ? 64 / 8 : 1);
}
.lbss :
{
*(.dynlbss)
*(.lbss .lbss.* .gnu.linkonce.lb.*)
*(LARGE_COMMON)
}
. = ALIGN(64 / 8);
.lrodata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
{
*(.lrodata .lrodata.* .gnu.linkonce.lr.*)
}
.ldata ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1)) :
{
*(.ldata .ldata.* .gnu.linkonce.l.*)
. = ALIGN(. != 0 ? 64 / 8 : 1);
}
. = ALIGN(64 / 8);
_end = .; PROVIDE (end = .);
. = DATA_SEGMENT_END (.);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) } /* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) } .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) }
/* DWARF 3 */
.debug_pubtypes 0 : { *(.debug_pubtypes) }
.debug_ranges 0 : { *(.debug_ranges) }
/* DWARF Extension. */
.debug_macro 0 : { *(.debug_macro) }
.gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
}
==================================================
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/../lib/crt1.o succeeded /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/../lib/crt1.o
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/../lib/crti.o succeeded /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/../lib/crti.o
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/x86_64-poky-linux/4.7.2/crtbegin.o succeeded /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/x86_64-poky-linux/4.7.2/crtbegin.o
attempt to open /tmp/ccqSR6oO.o succeeded/tmp/ccqSR6oO.o
attempt to open tmp/sysroots/qemux86-64/usr/lib//libm.so succeeded
-lm (tmp/sysroots/qemux86-64/usr/lib//libm.so)
attempt to open tmp/sysroots/qemux86-64/usr/lib//libgcc.so failed
attempt to open tmp/sysroots/qemux86-64/usr/lib//libgcc.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/libgcc.so failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/libgcc.a failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/libgcc.so failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/libgcc.a failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/../lib/libgcc.so failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/../lib/libgcc.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/x86_64-poky-linux/4.7.2/libgcc.so failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/x86_64-poky-linux/4.7.2/libgcc.a succeeded
attempt to open tmp/sysroots/qemux86-64/usr/lib//libgcc_s.so failed
attempt to open tmp/sysroots/qemux86-64/usr/lib//libgcc_s.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/libgcc_s.so failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/libgcc_s.a failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/libgcc_s.so failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/libgcc_s.a failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/../lib/libgcc_s.so succeeded
-lgcc_s (/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/../lib/libgcc_s.so)
attempt to open tmp/sysroots/qemux86-64/usr/lib//libc.so succeeded
opened script file tmp/sysroots/qemux86-64/usr/lib//libc.so
opened script file tmp/sysroots/qemux86-64/usr/lib//libc.so
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/libc.so.6 succeeded/lib/libc.so.6 (/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/libc.so.6)
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/libc_nonshared.a succeeded (/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/libc_nonshared.a)elf-init.oS
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/ld-linux-x86-64.so.2 succeeded/lib/ld-linux-x86-64.so.2 (/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/ld-linux-x86-64.so.2)
attempt to open tmp/sysroots/qemux86-64/usr/lib//libgcc.so failed
attempt to open tmp/sysroots/qemux86-64/usr/lib//libgcc.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/libgcc.so failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/libgcc.a failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/libgcc.so failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/libgcc.a failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/../lib/libgcc.so failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/../lib/libgcc.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/x86_64-poky-linux/4.7.2/libgcc.so failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/x86_64-poky-linux/4.7.2/libgcc.a succeeded
attempt to open tmp/sysroots/qemux86-64/usr/lib//libgcc_s.so failed
attempt to open tmp/sysroots/qemux86-64/usr/lib//libgcc_s.a failed
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/libgcc_s.so failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/libgcc_s.a failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/libgcc_s.so failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../lib/x86_64-poky-linux/gcc/libgcc_s.a failed attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/../lib/libgcc_s.so succeeded
-lgcc_s (/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/../lib/libgcc_s.so)
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/x86_64-poky-linux/4.7.2/crtend.o succeeded /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/x86_64-poky-linux/4.7.2/crtend.o
attempt to open /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/../lib/crtn.o succeeded /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/usr/lib/../lib/crtn.o
ld-linux-x86-64.so.2 needed by /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/libc.so.6
found ld-linux-x86-64.so.2 at /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/tmp/sysroots/qemux86-64/lib/ld-linux-x86-64.so.2
[lizj@suika x86-64-yocto-1.3]$ echo $?
Signature · 2 lines
Best regards. Li Zhijian
Hi,Laurentiu
I think it could be something wrong with binutils(2.23.1 or later)
there is different behavior at binutils-2.23.1/ld/ldfile.c(ldfile_open_file_search) from binutils-2.22
If both --sysroot directory and -L directory include libc.so , ld don't work
In my case, there are double libc.so(/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/libc.so and tmp/sysroots/qemux86-64/usr/lib/libc.so)
ld will link tmp/sysroots/qemux86-64/usr/lib/libc.so(ld always searchs -L directory at first) then link /lib/libc.so.6 specified at tmp/sysroots/qemux86-64/usr/lib/libc.so instead of append sysroot directory path before /lib/libc.so.6
here is a sample method reproduce it
lizj@suika x86-64-yocto-1.3]$ source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux
[lizj@suika x86-64-yocto-1.3]$ echo $CC
x86_64-poky-linux-gcc -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux
[lizj@suika x86-64-yocto-1.3]$ $LD --version
GNU ld (GNU Binutils) 2.23.1.20121113
[lizj@suika x86-64-yocto-1.3]$ mkdir -p fake_rootfs/usr/lib
[lizj@suika x86-64-yocto-1.3]$ cp /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/libc.so fake_rootfs/usr/lib/
[lizj@suika x86-64-yocto-1.3]$ ls fake_rootfs/usr/lib/
libc.so
[lizj@suika x86-64-yocto-1.3]$ $CC -o test test.c -L ./fake_rootfs/usr/lib/test.c: In function 'main':
test.c:3:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default] /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible /lib/libc.so.6 when searching for /lib/libc.so.6 /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find /lib/libc.so.6 /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible /usr/lib/libc_nonshared.a when searching for /usr/lib/libc_nonshared.a /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find /usr/lib/libc_nonshared.a
collect2: error: ld returned 1 exit status
-------------------------------------------------------------------------
It seems that ld don‘t really reasonable to do like that,which binutils-2.22 can handle correctly Does poky mind this behavior
以上
Signature · 2 lines
Best regards. Li Zhijian
Quoted 27 lines · Laurentiu Palcu
Hi,
Quoted 9 lines · Li Zhijian
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
III) compile a simple C program
# cat test.c int main () { printf("hello world\n"); return 0; } # source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux # $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lmOK, it looks like something strange happens in your setup.
To debug it, let's add '-Wl,--verbose' at the end of your command and you should be able to see where the linker is looking for libraries. Also, the linker script will be printed.
You should see it try your directory first tmp/sysroots/qemux86-64/usr/lib/, and then fall through the default ones with the sysroot prefix added and, at the end, the system ones:
/lib:/usr/lib.Thanks,
Laurentiu
Hi Li Zhijian,
Quoted 14 lines · Li Zhijian
Hi,Laurentiu
I think it could be something wrong with binutils(2.23.1 or later)
there is different behavior at binutils-2.23.1/ld/ldfile.c(ldfile_open_file_search) from binutils-2.22If both --sysroot directory and -L directory include libc.so , ld don't work
In my case, there are double libc.so(/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/libc.so and tmp/sysroots/qemux86-64/usr/lib/libc.so)ld will link tmp/sysroots/qemux86-64/usr/lib/libc.so(ld always searchs -L directory at first) then link
/lib/libc.so.6specified at tmp/sysroots/qemux86-64/usr/lib/libc.so instead of append sysroot directory path before/lib/libc.so.6here is a sample method reproduce it
Quoted 7 lines
lizj@suika x86-64-yocto-1.3]$ source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux
[lizj@suika x86-64-yocto-1.3]$ echo $CC
x86_64-poky-linux-gcc -m64 --sysroot=/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux [lizj@suika x86-64-yocto-1.3]$ $LD --version
GNU ld (GNU Binutils) 2.23.1.20121113
[lizj@suika x86-64-yocto-1.3]$ mkdir -p fake_rootfs/usr/lib
[lizj@suika x86-64-yocto-1.3]$ cp /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-poky-linux/usr/lib/libc.so fake_rootfs/usr/lib/
This libc.so is actually a linker script with the following contents:
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */OUTPUT_FORMAT(elf64-x86-64)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED (/lib/ld-linux-x86-64.so.2 ) )
So, the /lib/libc.so.6 and /usr/lib/libc_nonshared.a will be searched until no undefined references are created. So, it looks like this linker script overrides the --sysroot behavior. To be honest (even though I'm not an expert in binutils), I think this is right behavior. I don't know why this works with the previous binutils...
Thanks,
Laurentiu
Quoted 55 lines
[lizj@suika x86-64-yocto-1.3]$ ls fake_rootfs/usr/lib/
libc.so
[lizj@suika x86-64-yocto-1.3]$ $CC -o testtest.c-L ./fake_rootfs/usr/lib/test.c: In function 'main':
test.c:3:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default] /yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/lib/libc.so.6when searching for/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/lib/libc.so.6/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: skipping incompatible/usr/lib/libc_nonshared.awhen searching for/usr/lib/libc_nonshared.a/yocto/fnst/lizj/build_yocto/x86-64-yocto-1.3/toolchain-1.3-tcmode-default/sysroots/x86_64-pokysdk-linux/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/4.7.2/ld: cannot find/usr/lib/libc_nonshared.a
collect2: error: ld returned 1 exit status
-------------------------------------------------------------------------It seems that ld don‘t really reasonable to do like that,which binutils-2.22 can handle correctly Does poky mind this behavior
以上
Signature · 2 lines
Best regards. Li ZhijianQuoted 27 lines · Laurentiu Palcu
Hi,
Quoted 9 lines · Li Zhijian
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
III) compile a simple C program
# cat test.c int main () { printf("hello world\n"); return 0; } # source toolchain-1.3-tcmode-default/environment-setup-x86_64-poky-linux # $CC -o test test.c -L tmp/sysroots/qemux86-64/usr/lib/ -lmOK, it looks like something strange happens in your setup.
To debug it, let's add '-Wl,--verbose' at the end of your command and you should be able to see where the linker is looking for libraries. Also, the linker script will be printed.
You should see it try your directory first tmp/sysroots/qemux86-64/usr/lib/, and then fall through the default ones with the sysroot prefix added and, at the end, the system ones:
/lib:/usr/lib.Thanks,
Laurentiu