From: Li Zhijian <lizhijian@cn.fujitsu.com>
To: Laurentiu Palcu <laurentiu.palcu@intel.com>
Cc: Yocto list discussion <yocto@yoctoproject.org>, poky@yoctoproject.org
Subject: Re: [poky] Is this a bug of binutils
Date: Fri, 20 Sep 2013 17:56:25 +0800 [thread overview]
Message-ID: <523C1BC9.5070303@cn.fujitsu.com> (raw)
In-Reply-To: <20130920085039.GB14107@lpalcu-linux>
at 2013-9-20 16:50, Laurentiu Palcu wrote:
> On Fri, Sep 20, 2013 at 11:43:31AM +0300, Laurentiu Palcu wrote:
>> Hi,
>>
>> On Fri, Sep 20, 2013 at 02:45:24PM +0800, Li Zhijian wrote:
>>> 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
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 <raj.khem@gmail.com>
Date: Wed Aug 8 10:33:41 2012 -0700
tcmode-default.inc: Use binutils 2.23.1
...skip...
commit 0333796a6b167dd754806700d7f771dd4a74e4ab
Author: Khem Raj <raj.khem@gmail.com>
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...
--
Best regards.
Li Zhijian
>>> 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
>> Technically, 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
>>
>>> 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"
>>>
>>> --
>>> Best regards.
>>> Li Zhijian (8555)
>>>
>>>
>>> _______________________________________________
>>> yocto mailing list
>>> yocto@yoctoproject.org
>>> https://lists.yoctoproject.org/listinfo/yocto
>> _______________________________________________
>> poky mailing list
>> poky@yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/poky
>
next prev parent reply other threads:[~2013-09-20 9:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-20 6:45 Is this a bug of binutils Li Zhijian
2013-09-20 8:43 ` [yocto] " Laurentiu Palcu
2013-09-20 8:43 ` Laurentiu Palcu
2013-09-20 8:50 ` [yocto] " Laurentiu Palcu
2013-09-20 8:50 ` [poky] " Laurentiu Palcu
2013-09-20 9:56 ` Li Zhijian [this message]
2013-09-20 10:02 ` [yocto] " Laurentiu Palcu
2013-09-20 10:02 ` [poky] " Laurentiu Palcu
2013-09-20 10:25 ` Li Zhijian
2013-09-20 11:00 ` [yocto] " Laurentiu Palcu
2013-09-20 11:00 ` [poky] " Laurentiu Palcu
2013-09-23 2:34 ` Li Zhijian
2013-09-23 2:44 ` Li Zhijian
2013-09-26 3:57 ` Li Zhijian
2013-09-26 7:36 ` [yocto] " Laurentiu Palcu
2013-09-26 7:36 ` [poky] " Laurentiu Palcu
2013-09-20 9:40 ` Li Zhijian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=523C1BC9.5070303@cn.fujitsu.com \
--to=lizhijian@cn.fujitsu.com \
--cc=laurentiu.palcu@intel.com \
--cc=poky@yoctoproject.org \
--cc=yocto@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.