GCC cross compilation tool for fedora - gcc

I need to compile a code with gcc for ARMv7-A architecture on x86 system, how can i install tools on fedora??
gcc-arm-linux-gnueabi package is not available in fedora and sudo dnf install gcc-arm-linux-gnueabi did not work.

Arm provides prebuilt GNU cross-toolchains which is available from developer.arm.com.
For A-profile cores - https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a
For R and M profile cores - https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm.
Hope that helps.

Related

What is the better way to build arm64 binaries?

I have a number C/C++ project which must be compiled for arm64 (aarch64) Linux platform, then packet into both RPM and DEB packages, then published. Creating and publishing Linux software for arm64.
How to build aarch64 binaries using amd64 Linux host system?
I have the following linux
katya7#katya7-comp:~$ cat /etc/os-release
NAME="KDE neon"
VERSION="5.25"
ID=neon
ID_LIKE="ubuntu debian"
PRETTY_NAME="KDE neon User - 5.25"
VARIANT="User Edition"
VARIANT_ID=user
VERSION_ID="20.04"
HOME_URL="https://neon.kde.org/"
SUPPORT_URL="https://neon.kde.org/"
BUG_REPORT_URL="https://bugs.kde.org/"
LOGO=start-here-kde-neon
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
Have you tried cross compiling? There is a nice blog post on how to do cross compiling for aarch64 on a build platform with a different architecture. https://jensd.be/1126/linux/cross-compiling-for-arm-or-aarch64-on-debian-or-ubuntu

cross-compile for ARM64, understanding make TARGET=aarch64

I'm trying to cross-compile a library for ARM64, I'm using Ubuntu 18.04 x86_64 host system for a build
and the way I'm doing the cross-compile as
sudo apt-get update
sudo apt-get install crossbuild-essential-arm64
and do the make
make -j 4 TARGET=aarch64
wonder what a compiler is invoked? Is it possible to set the latest gcc from ARM?
FYI. I'm trying to follow TensorFlow cross-compile for ARM64 and set the latest GNU Toolchain for ARM64.

Cross compile windows 64 bit .exe from linux

I know that if I want to compile a 32 bit .exe for windows on Linux I can just install and use the mingw32 package (e.g. apt-get install mingw32) on linux. What if I want to compile a windows .exe that is 64 bit? Is there tools or a method to do this?
It looks like my answer lies with the Mingw-w64 project which is available for host OSes Linux, Darwin & Windows
I know this question is very old and already has an accepted answer but I will post this answer the way I do it now. It is pretty simple and straightforward and I hope it helps anyone landing here:
To cross-compile windows applications from a Linux machine you just need to install mingw-w64 C and C++ compiler. On debian based system you just do this:
sudo apt install -y gcc-mingw-w64 g++-mingw-w64
That will install the gcc (the c compiler) and g++ (the c++ compiler) for both 64 and 32 bit cross-compilation
After that, if you need a 64-bit application just do:
x86_64-w64-mingw32-g++ hello.c -o hello.exe
And if you need a 32-bit application just do:
i686-w64-mingw32-g++ hello.c -o hello.exe
Simple as that!
It's also possible to install MinGW from MSYS2. The main advantages are:
Usually up-to-date MinGW, regardless of what your Linux distribution ships.
A lot of prebuilt libraries.
Several MinGW flavors are provided: x32 and x64, with different C runtimes, etc.
You can't install MSYS2 on Linux directly, but it's possible with Quasi-MSYS2.
Install Clang (and LLD):
On Ubuntu:
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh
rm llvm.sh
Clang can cross-compile to Windows using MSYS2 libraries. Alternatively, you can run MSYS2 MinGW in Wine, but it's slower.
Install dependencies:
sudo apt install make wget tar zstd gpg wine
Wine is optional.
Install Quasi-MSYS2 and any desired MSYS2 packages:
git clone https://github.com/HolyBlackCat/quasi-msys2
cd quasi-msys2/
# Optionally, choose MSYS2 flavor, see full list at: https://www.msys2.org/docs/environments/
# echo MINGW64 >msystem.txt
make install _gcc _gdb
Then:
env/shell.sh opens a shell with the correct environment variables set up.
win-clang++ hello.cpp invokes Clang with flags for cross-compilation.
./a.exe runs the resulting app in Wine, if it's installed.
Full disclosure: I'm the developer of quasi-msys2.

How can I easily install arm-elf-gcc on OS X?

Please let me know if this should be on Server Fault...
I've got some code I want to compile which requires arm-elf-gcc. I'm not an embedded programmer, so all this is new to me. My development machine is a Mac and I use fink pretty often, so I'd love to be able to install it that way. However, fink doesn't know of any package with that name. I see that gnuarm.org has some binaries for OS X but their packages seem to also include a bunch of stuff (e.g. gcc) I already have. Am I correct in believing that I need to install binutils, newlib and a file called t-arm-elf?
MacPorts supports arm-elf-gcc.
$ port search arm-elf
arm-elf-binutils #2.20.51.0.2 (cross, devel)
FSF Binutils for arm-elf cross development
arm-elf-gcc #4.3.2 (cross, devel)
gcc cross-compilers for arm-elf, with newlib runtime library.
arm-elf-gcc3 #3.4.6 (cross, devel)
gcc 3.x cross-compilers for arm-elf, with newlib runtime library.
Found 3 ports.
Once you install MacPorts, all it would take is:
$ sudo port install arm-elf-gcc

Steps to compile darwin for arm on ubuntu gcc

Has anyone got the steps to compile darwin libraries on gcc for arm on ubuntu?
There is a site that provides patches for and arm darwin kernel.
Darwin on ARM develops and provides patches for the Apple Darwin-xnu kernel sources so that it can be cross-compiled to run on an ARM processor.
This ubuntu forum entry shows how to install the arm-linux-gcc cross compiler.
Put the two together and you should get what you asked for.
https://github.com/tpoechtrager/osxcross
step by step install it ref to https://enigma-dev.org/docs/wiki/index.php?title=CrossCompileLinuxOSX

Resources