使用臂无 - EABI-GCC编译和链接库liba.a错误 [英] Compiling using arm-none-eabi-gcc and linking library liba.a error

查看:3506
本文介绍了使用臂无 - EABI-GCC编译和链接库liba.a错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个64位的Linux机器上编译在C Hello World程序。我使用的是GCC ARM嵌入式工具链交叉编译与爱特梅尔AT91SAM9G20处理器FOX G20 V主板我的计划。

I am compiling a hello world program in C on a 64-bit Linux machine. I am using a GCC ARM embedded toolchain to cross compile my program on a FOX G20 V board with an ATMEL AT91SAM9G20 processor.

在第一次拿,我编译因为程序不承认的printf,返回等功能(标准C函数)时,有一些错误。所以,我决定做的功能,我相信在libc.a库(纠正我,如果我错了)的定义之间的联系,通过执行臂无 - EABI - 海合会-o你好hello.c中的libc.a 但结果仍然导致错误:

On the first take, I had a few errors when compiling because the program didn't recognize the printf, return etc. functions (the standard C functions). So I decided to make the link between the functions, which I believe are defined in the libc.a library (correct me if I'm wrong), by doing arm-none-eabi-gcc -o hello hello.c libc.a but the outcome still results in errors:

libc.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x16): undefined reference to `_exit'
libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
libc.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text._write_r+0x10): undefined reference to `_write'
libc.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text._close_r+0xc): undefined reference to `_close'
libc.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text._fstat_r+0xe): undefined reference to `_fstat'
libc.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty'
libc.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text._lseek_r+0x10): undefined reference to `_lseek'
libc.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text._read_r+0x10): undefined reference to `_read'
collect2: error: ld returned 1 exit status

我,为什么程序仍即使我已经链接的库的应用程序不能识别的标准功能真的不确定。如果你有什么理由,为什么,或者我怎么能解决这个问题的解决方案,我将非常感激。

I'm really unsure as to why the program still does not recognize the standard functions even though I've linked the library to the application. If anyone has a reason as to why, or a solution as to how I can fix this problem, I would be very grateful.

更新

我这里从下载 glibc库。我已经编译和创建从我在找到的 syscalls.c 库静态库newlib-2.1.0 / libgloss /手臂,当我的图书馆链接到我的应用程序code,我还是得到同样的错误。

I've downloaded the glibc library from here. I've compiled and created a static library from the syscalls.c library that I found in newlib-2.1.0/libgloss/arm and when I link the library to my application code, I still get the same error.

推荐答案

尝试执行这样的:

arm-none-eabi-gcc --specs=rdimon.specs -lgcc -lc -lm -lrdimon -o hello hello.c

您工具似乎提供了librdimon.a,它提供了基本的标准C函数库。

Your toolkit seems to provide the librdimon.a, a library which provides the basic standard C functions.

这篇关于使用臂无 - EABI-GCC编译和链接库liba.a错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆