Cross-compile from arm to x86 - c

Is there a cross-compile tool like mingw-w64 that will compile code on a Linux ARM system for a Linux x86 system?
I have a BeagleBone Black that is running Debian wheezy that I would like to use to as a build server. It should just sit in the corner and each night build the code from certain repositories.
I have run some tests and found that I can get it to build the windows versions using mingw-w64. However, when I looked at what I thought would be the Linux build I noticed that it was building for ARM. I figure it should be possible to build the Linux versions, but I can't find a cross-compiler.

Related

How to use GCC from gcc_9.3.0-1ubuntu2_amd64.deb without installing the package?

I need to build a library from C sources for Arm aarch64 architecture and Linux Ubuntu x86 64 using GCC toolchain - my host work machine is Ubuntu 20.04 too.
For Arm there are GCC toolchains available for download at developer.arm-com.
What I do for Arm is:
download the zipped toolchain
unzip it to a /temp directory
build the library telling the underlying build system to use GCC from /temp/gcc
I would like to do the same for Linux x86 64, so, instead of Arm, target Linux Ubuntu x86 64. I don't want to use the GCC natively installed on the system.
Where do I find the GCC toolchain targeting Ubuntu x86 64 architecture?
I have found the https://packages.ubuntu.com/focal/amd64/gcc/download page. There I got the gcc_9.3.0-1ubuntu2_amd64.deb package. Can I "temporarily unzip" the deb, in order to use GCC without installing it on the system? Is there a zip instead of only deb?

GDB stuck at “Configuring GDB Aborting configuring GDB”

I've installed (OSX Mojave 10.14.6.) Eclipse CDT and GNU MCU Eclipse plugin and finaly GNU Tools for ARM. My goal is to build and debug ARM code using GDB (arm-none-eabi-gdb).
I've created a Hello World project for Arm, which builds ok - but, debugging seems not to work with GDB (that comes with the Arm package). GDB gets stuck:
I have set the proper paths in Eclipse to arm-none-eabi-gdb.
I have signed the arm-none-eabi-gdb (with the same certificate that I used to sign GDB installed via brew into /usr/local/bin/gdb the day before - and it worked!).
I have also tried running Eclipse as root from command line.
Nothing helps.
The message is "Configuring GDB Aborting configuring GDB".
What to do?
Probably what is going on here is that you built to a given target (ARM based) and you're trying to run it (with gdb) on your mac (x86).
You'll need an emulator or QEMU to properly run on your mac or maybe a real board.

Install gcc in 32 bit ARM architecture

I've installed BuildRoot, to set a SoftetherVPN.
Well, my problem is that I necessary need to install GCC, in a 32-bit ARM Architecture, (obviously I've downloaded the 32 bit version).
I looked all over the internet, because of many problems:
My first idea was to install GCC using command sudo apt-get or sudo yum, but I can only find it in Debian Linux (Buildroot kernel, and its toolchain are very reduced).
At this point I tried to cross-compiling GCC but with no results, because it produced in shell output Library errors. And I also tried to paste those missing libraries yet achieve very little.
You could download some GCC cross-compiler. For example, if your PC is running some Debian-like Linux distribution -perhaps Ubuntu- you might install some gcc-7-arm-linux-gnueabi or similar (gcc-7-arm-linux-gnueabihf ...) package.
The SDK for your board is likely to provide some cross-GCC & cross-binutils.
You could build some cross binutils then some GCC cross-compiler from their source code (this is a bit more tricky).
Your cross-compiler would compile (for ARM) on your Linux-running PC, not on your ARM circuit board.

Build C executable for Raspberry Pi on Windows or Linux

I have to design a C executable (no GUI) that is supposed to run on Raspberry PI. I'm familiar with design using IDE like Visual Studio or Eclipse (with CDT plugin). If i use Raspberry PI as a design machine, I think I have no chance to use a standard IDE. I should use makefiles and gcc compiler only.
Is there any chance to develop Raspberry PI executable using Visual Studio (for Windows) or Eclipse (for both Windows and Linux).
You can specify to eclipse projects with Makefiles. You can also specify a compilation toolchain.
So yes, you can develop and compile for Raspberry Pi or for other plateforms using Eclipse.
For getting toolchain and other tools for Rasp Pi you can find things here.
In Eclipse, you create a new or import a project choosing Makefile Project with Existing Code then add your toolchain.
If you have a newer Pi like the 4, you should be able to run eclipse directly from the Pi desktop. You can download via:
sudo apt-get install eclipse
This will be a stripped-down version and will likely run quite slow, so I agree compiling on a more powerful remote machine is better...
Is there any chance to develop Raspberry PI executable using Visual Studio (for Windows) or Eclipse (for both Windows and Linux).
Yes, this is called cross-compiling. You can set up a cross-compile toolchain for the raspberry pi on windows or linux and configure your Eclipse CDT project to build with the toolchain. You can even set up remote debugging.
This website has good information and a step-by-step guide for windows using cygwin.
This looks like a good guide for linux.
Edit:
Just realized you asked for Visual Studio on Windows. I don't think there is Visual Studio support for this. The example I pointed to sets up cygwin so you have an emulated linux environment. You could also set up a VM using free VM software and install a linux environment that way, and run eclipse CDT from there. This is what I did when setting up a cross compiling environment for the Raspi.

Porting to ARM processor - dependancies

Am attempting to port some code to a Debian install on an ARM processor. Am having trouble finding 'libmygcc.a' - is this a compiled file or a library I need to install? I have it on a linux(x86) box but am not clear where it originated.
OpenSSL is next. Sigh.
libmygcc.a is a library for mysql, so you would have to compile mysql for your ARM target

Resources