You are not logged in.

#1 2017-03-15 20:24:02

Adam_h94
Member
Registered: 2017-03-03
Posts: 14

[SOLVED] Cross Compiling with arm-none-eabi-gcc

Hi everybody, I started to write some script for my raspberry, but, because of performance gap, I decided to use C instead of python. The point is that i do not have a GUI installed and in any case it will be near impossible to use a IDE on a first generation raspberry. I wanted to use Eclipse on my laptop to compile for ARM.
I've installed arm-none-eabi-gcc pakage using pacman, but it doesn't compile even a simple Hello World.

arm-none-eabi-gcc test.c -o test 

generate these errors

/usr/lib/gcc/arm-none-eabi/6.3.0/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
/usr/lib/gcc/arm-none-eabi/6.3.0/../../../../arm-none-eabi/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0x18): undefined reference to `_sbrk'
/usr/lib/gcc/arm-none-eabi/6.3.0/../../../../arm-none-eabi/lib/libc.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text._write_r+0x24): undefined reference to `_write'
/usr/lib/gcc/arm-none-eabi/6.3.0/../../../../arm-none-eabi/lib/libc.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text._close_r+0x18): undefined reference to `_close'
/usr/lib/gcc/arm-none-eabi/6.3.0/../../../../arm-none-eabi/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text._lseek_r+0x24): undefined reference to `_lseek'
/usr/lib/gcc/arm-none-eabi/6.3.0/../../../../arm-none-eabi/lib/libc.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text._read_r+0x24): undefined reference to `_read'
/usr/lib/gcc/arm-none-eabi/6.3.0/../../../../arm-none-eabi/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text._fstat_r+0x20): undefined reference to `_fstat'
/usr/lib/gcc/arm-none-eabi/6.3.0/../../../../arm-none-eabi/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text._isatty_r+0x18): undefined reference to `_isatty'
collect2: error: ld returned 1 exit status

PS: I duplicate the thread in  Other Architectures but i do not know how to close it.

Last edited by Adam_h94 (2017-03-16 00:55:04)

Offline

#2 2017-03-15 21:21:23

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,793

Re: [SOLVED] Cross Compiling with arm-none-eabi-gcc

I dust binned the other thread.  In the future, please use the report link on the thread and ask the moderators to move it for you.   Thanks.

I am not much on setting up cross compilers, and I am not a huge fan of large IDEs like eclipse.  I would consider using emacs with auto complete and gdb on the target.  Others here will suggest Vim.
The problems you are encountering are because  you using arm-none.  You should be using arm-linux (I think).   The none target does not know about Linux kernel calls .

http://stackoverflow.com/questions/1379 … ux-gnueabi

Last edited by ewaller (2017-03-15 21:29:49)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2017-03-15 21:25:37

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: [SOLVED] Cross Compiling with arm-none-eabi-gcc

I cross compile on Arch ARM (master) to my x86_64 box all the time.  See: https://wiki.archlinux.org/index.php/Distcc#Arch_ARM


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#4 2017-03-16 00:54:10

Adam_h94
Member
Registered: 2017-03-03
Posts: 14

Re: [SOLVED] Cross Compiling with arm-none-eabi-gcc

Thanks a lot for the hints. Finally i installed arm-linux-gnueabihf-gcc, and now everything works fine.

Offline

Board footer

Powered by FluxBB