Build Newlib

本文详细介绍了Newlib库的下载及编译流程,包括通过FTP获取源码、配置编译环境、解决常见编译错误等步骤,并提供了具体的配置示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://sourceware.org/newlib/

1.Download source code (2 ways)

  1.git clone

  2.ftp(Recommended)

    ftp://sourceware.org/pub/newlib/index.html

    version : android-7.0/prebuilts/gcc/linux-x86/arm/gcc-none-eabi-4.8q3/arm_none_eabi/include/newlib.h

    eg: newlib-2.1.0.tar.gz;

2.build

       1.untar

  1 $tar –xf  newlib-2.1.0.tar.gz
  2 $cd       newlib-2.1.0/

  2.create newlib-2.1.0/build to build

          create newlib-2.1.0/out to install

  1 $mkdir build
  2 $mkdir out
  3 $cd build/

       3.generate Makefile

  1 $../configure      --prefix=/home/user_name/xxx/…/newlib-2.1.0/out
                        --target=arm-none-eabi 

 

  4.compile(errors need to be fixed)

  1 $make

 

  5.copy libc.a to out/    

  1 $make install

 

[compile errors]

(红色字体为添加,中划线为删除)

1.set PATH (use android bins: arm-none-eabi-gcc…)

~/.bashrc

PATH=${PATH}:…/android/prebuilts/gcc/linux-x86/arm/gcc-arm-none-eabi-4_8-2014q3/bin

CC=arm-none-eabi-gcc

LD=arm-none-eabi-ld

 

2.armv6-m need lo register

newlib-2.1.0/newlib/libc/sys/arm/trap.S

#if !(defined(__thumb2__)||(defined(__ARM_ARCH_6M__)

 

3.No rule to make target libgloss/arm/config/default.mh

newlib-2.1.0/libgloss/arm/cpu-init/Makefile.in

objtype = @objtype@

host_makefile_frag = $(srcdir)/../../config/default.mh

Makefile: Makefile.in ../config.status  @host_makefile_frag_path@

Makefile: Makefile.in ../config.status  ${host_makefile_frag_path}

           $(SHELL) ../config.status–file cpu-init/Makefile

 

4.disable variable size enums

after../configure …

newlib-2.1.0/build/Makefile

CFLAGS_FOR_TARGET                 = –g –02 –fno-short-enums

CXXFLAGS_FOR_TARGET            = –g –02 –fno-short-enums

转载于:https://www.cnblogs.com/altc/p/8761571.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值