$CC Statically compiled applications

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

$CC Statically compiled applications

4,143 次查看
lixuhui112
Contributor I

hello everyone:

     I want to use meta-toolchain Statically compiled applications ,but I encountered some problems

Iuse

arm-linux-gnueabi-gcc -o hello hello.c -static

is ok ,but I use

source /opt/poky/1.7/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi

$CC -o hello hello.c -static

/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: cannot find -lc

collect2: error: ld returned 1 exit status

Are meta-toolchain missing static library? And how can I build SDK it contains the static library

标签 (1)
标记 (1)
0 项奖励
回复
3 回复数

2,489 次查看
BiyongSUN
NXP Employee
NXP Employee

Next time, please check and raise such kind of questions to Yocto forum.

Here is the link of Yocto document.

Yocto Project Application Developer's Guide

Note

By default, this toolchain does not build static binaries. If you want to use the toolchain to build these types of libraries, you need to be sure your image has the appropriate static development libraries. Use the IMAGE_INSTALL variable inside your local.conf file to install the appropriate library packages. Following is an example using glibc static development libraries:      IMAGE_INSTALL_append = " glibc-staticdev"

0 项奖励
回复

2,489 次查看
lixuhui112
Contributor I

I add IMAGE_INSTALL_append = " glibc-staticdev" in build-x11/conf/local.config,and rebuild meta-toolchain

$ bitbake meta-toolchain

and install the SDK , but  I use

source /opt/poky/1.7/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi

$CC -o hello hello.c -static

/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/ld: cannot find -lc

collect2: error: ld returned 1 exit status

it also return the same error

0 项奖励
回复

2,489 次查看
BiyongSUN
NXP Employee
NXP Employee

We have done the test and listed below.

As suggest before, please check and raise such kind of questions to Yocto forum.

This topic  is not the scope of i.mx forum.

ls -1
environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
hello.c
site-config-cortexa9hf-vfp-neon-poky-linux-gnueabi
sysroots
version-cortexa9hf-vfp-neon-poky-linux-gnueabi

source  environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
$CC -static -o hello hello.c

file hello
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=f05292a5baa8be157f5e5d4def47d650b0aad273, not stripped

To confirm the toolchian information:
arm-poky-linux-gnueabi-readelf -a hello|grep poky

46: 00000000     0 FILE    LOCAL  DEFAULT  ABS /opt/poky/1.7/
53: 00000000     0 FILE    LOCAL  DEFAULT  ABS /opt/poky/1.7/

0 项奖励
回复