You are not logged in.

#1 2018-11-14 11:09:09

armoon
Member
Registered: 2018-11-14
Posts: 4

arm-none-eabi header pakage missing

Hello friends

I would like to install arm-none-eabi-gcc package on my X86 machine to cross compile the kernel and user applications.
so I installed following package.

[amoon@moonT420 ~]$  sudo pacman -S arm-none-eabi-gcc arm-none-eabi-binutils
warning: arm-none-eabi-gcc-8.2.0-1 is up to date -- reinstalling
warning: arm-none-eabi-binutils-2.31.1-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (2) arm-none-eabi-binutils-2.31.1-1  arm-none-eabi-gcc-8.2.0-1

But end I am trying to cross compile hello world program it failed to build with missing header file.

[amoon@moonT420 tmp]$ uname -a
Linux moonT420 4.19.1-arch1-1-ARCH #1 SMP PREEMPT Sun Nov 4 16:49:26 UTC 2018 x86_64 GNU/Linux
[amoon@moonT420 tmp]$
[amoon@moonT420 tmp]$
[amoon@moonT420 tmp]$ arm-none-eabi-gcc helloworld.c -o helloworld-arm -static
helloworld.c:1:10: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
          ^~~~~~~~~

compilation terminated.

So my guess is arm-none-eabi-gcc is missing in the pacman update.

I am able to build arm64 code on X86 arch with no errors. smile

[amoon@moonT420 tmp]# aarch64-linux-gnu-gcc helloworld.c -o helloworld-arm64

[amoon@moonT420 tmp]$ file helloworld-arm64
helloworld-arm64: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=5f5dededcecdfa834472bf7ebf7d3198b14db69d, not stripped

Last edited by armoon (2018-11-16 03:32:47)

Offline

#2 2018-11-14 12:40:44

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 6,424

Re: arm-none-eabi header pakage missing

$ pacman -Fs stdio.h
core/gcc 8.2.1+20180831-1
    usr/include/c++/8.2.1/tr1/stdio.h
core/glibc 2.28-4
    usr/include/bits/stdio.h
    usr/include/stdio.h
extra/bind-tools 9.13.2-1
    usr/include/isc/stdio.h
extra/libbsd 0.9.1-1
    usr/include/bsd/stdio.h
community/aarch64-linux-gnu-gcc 8.2.0-1
    usr/aarch64-linux-gnu/include/c++/8.2.0/tr1/stdio.h
community/aarch64-linux-gnu-glibc 2.28-1
    usr/aarch64-linux-gnu/usr/include/bits/stdio.h
    usr/aarch64-linux-gnu/usr/include/stdio.h
community/arm-none-eabi-gcc 8.2.0-1
    usr/arm-none-eabi/include/c++/8.2.0/tr1/stdio.h
community/arm-none-eabi-newlib 3.0.0.20180226-2
    usr/arm-none-eabi/include/ssp/stdio.h
    usr/arm-none-eabi/include/stdio.h
    usr/arm-none-eabi/include/sys/stdio.h
community/avr-libc 2.0.0-1
    usr/avr/include/stdio.h
community/dietlibc 0.33-5
    opt/diet/include/stdio.h
community/emscripten 1.38.12-1
    usr/lib/emscripten/system/include/libc/stdio.h
    usr/lib/emscripten/system/include/libcxx/stdio.h
community/gcc54 5.4.1-1
    usr/lib/gcc/x86_64-pc-linux-gnu/5.4.1/include/c++/tr1/stdio.h
community/gcc7 7.3.1+20180814-1
    usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/include/c++/tr1/stdio.h
community/marisa 0.2.5-2
    usr/include/marisa/stdio.h
community/musl 1.1.20-1
    usr/lib/musl/include/stdio.h
community/riscv64-linux-gnu-gcc 8.2.0-1
    usr/riscv64-linux-gnu/include/c++/8.2.0/tr1/stdio.h
community/riscv64-linux-gnu-glibc 2.28-1
    usr/riscv64-linux-gnu/usr/include/bits/stdio.h
    usr/riscv64-linux-gnu/usr/include/stdio.h
community/sdcc 3.7.0-5
    usr/share/sdcc/include/pic16/stdio.h
    usr/share/sdcc/include/stdio.h
multilib/dev86 0.16.21-2
    usr/lib/bcc/include/stdio.h
multilib/wine 3.16-1
    usr/include/wine/msvcrt/stdio.h
multilib/wine-staging 3.15-1
    usr/include/wine/msvcrt/stdio.h
multilib/wine-staging-nine 3.15-1
    usr/include/wine/msvcrt/stdio.h
$ 

It's present in many packages, maybe you need the ones in arm-none-eabi-newlib ?


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#3 2018-11-14 17:25:20

armoon
Member
Registered: 2018-11-14
Posts: 4

Re: arm-none-eabi header pakage missing

Hi

thanks I install the missing package arm-none-eabi-newlib but new problem.

[amoon@moonT420 tmp]$ arm-none-eabi-gcc hello.c -O hello
/usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: hello: in function `__data_start':
:(.data+0x0): multiple definition of `__dso_handle'; /usr/lib/gcc/arm-none-eabi/8.2.0/crtbegin.o:(.data.__dso_handle+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: hello: in function `_start':
:(.text+0xd0): multiple definition of `_mainCRTStartup'; /usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/lib/crt0.o:(.text+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: hello: in function `_init':
:(.init+0x0): multiple definition of `_init'; /usr/lib/gcc/arm-none-eabi/8.2.0/crti.o:(.init+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: hello: in function `_start':
:(.text+0xd0): multiple definition of `_start'; /usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/lib/crt0.o:(.text+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: hello: in function `main':
:(.text+0x1d4): multiple definition of `main'; /tmp/ccRCzT5r.o:hello.c:(.text+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: hello: in function `_fini':
:(.fini+0x0): multiple definition of `_fini'; /usr/lib/gcc/arm-none-eabi/8.2.0/crti.o:(.fini+0x0): first defined here
collect2: error: ld returned 1 exit status

I cannot cross compile the kernel unless I download the pre-compiled linaro toolchain and used this for arm arch.:)

Best Regards
-Anand

Last edited by armoon (2018-11-16 03:33:33)

Offline

#4 2018-11-15 11:17:54

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 6,424

Re: arm-none-eabi header pakage missing

Those look like linking problems that are usually solved by changes to the sourcecode.

I do think you should try cross-compiling a kernel now, preferably from a PKGBUILD.


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#5 2018-11-15 13:37:09

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 8,404
Website

Re: arm-none-eabi header pakage missing

armoon, please use code tags when pasting terminal output into your posts. It makes things more readable (as Lone_Wolf has demonstrated above) and prevents random emojis appearing in the middle of the output.


Sakura:-
Mobo: MSI X299 TOMAHAWK ARCTIC // Processor: Intel Core i7-7820X 3.6GHz // GFX: nVidia GeForce GTX 970 // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 5x 1TB HDD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2018-11-15 18:32:41

armoon
Member
Registered: 2018-11-14
Posts: 4

Re: arm-none-eabi header pakage missing

Thanks for your suggestion, I have updated above. I have got cross compilation working after setting up cross compilation tool chain from below.

[url]https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads/8-2-2018-08[/url]

But I still feel the header package is missing for arm-none-eabi.

Last edited by armoon (2018-11-16 03:34:07)

Offline

#7 2018-11-16 00:17:48

loqs
Member
Registered: 2014-03-06
Posts: 6,370

Re: arm-none-eabi header pakage missing

You updated your posts to use quote tags not code tags.

Offline

#8 2018-12-03 04:52:57

armoon
Member
Registered: 2018-11-14
Posts: 4

Re: arm-none-eabi header pakage missing

Yep successfully cross compile the kernel using arm-none-eabi- for arm odroid c1. smile

Offline

#9 2018-12-03 08:02:41

anatolik
Developer
Registered: 2012-09-27
Posts: 428

Re: arm-none-eabi header pakage missing

armoon wrote:

thanks I install the missing package arm-none-eabi-newlib but new problem.

[amoon@moonT420 tmp]$ arm-none-eabi-gcc hello.c -O hello
/usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: hello: in function `__data_start':
:(.data+0x0): multiple definition of `__dso_handle'; /usr/lib/gcc/arm-none-eabi/8.2.0/crtbegin.o:(.data.__dso_handle+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: hello: in function `_start':
:(.text+0xd0): multiple definition of `_mainCRTStartup'; /usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/lib/crt0.o:(.text+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: hello: in function `_init':
:(.init+0x0): multiple definition of `_init'; /usr/lib/gcc/arm-none-eabi/8.2.0/crti.o:(.init+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: hello: in function `_start':
:(.text+0xd0): multiple definition of `_start'; /usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/lib/crt0.o:(.text+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: hello: in function `main':
:(.text+0x1d4): multiple definition of `main'; /tmp/ccRCzT5r.o:hello.c:(.text+0x0): first defined here
/usr/lib/gcc/arm-none-eabi/8.2.0/../../../../arm-none-eabi/bin/ld: hello: in function `_fini':
:(.fini+0x0): multiple definition of `_fini'; /usr/lib/gcc/arm-none-eabi/8.2.0/crti.o:(.fini+0x0): first defined here
collect2: error: ld returned 1 exit status

I cannot cross compile the kernel unless I download the pre-compiled linaro toolchain and used this for arm arch.:)

Remember that arm-none-eabi-* is bare metal toolchain. Bare metal here means that your end program is going to run on a hardware without any operating system. That how firmware for microcontrollers work for example.

Now in your example you use stdio.h header that is part of libc. You need a libc for your bare metal app, and Arch provides *-newlib for this. So your guess about this package was correct.

But you also need specify newlib flag '--specs=nano.specs' that tells what exactly libc implementation need to be used.

Offline

Board footer

Powered by FluxBB