I've seen the about cross compilers reply at How do I cross-compile C code on Windows for a binary to also be run on Unix (Solaris/HPUX/Linux)?
I would like to know how can Y compile for SPARC on a x86 machine?
Where can i find a good cross compiler? I also need to compile for HP OS.
gcc is fully capable of this. Sun's compiler may be capable, but I'm more familiar with gcc. First, you should get comfortable with building gcc, and also decide if you need just the C compiler or if you need C++ or other languages.
Once you've built gcc for the host you are on, you can then rebuild gcc to include a target for the target machine you want to cross compile for.
When building a cross compiler, the three things you must get correct are the build, host, and target.
build: the machine you are building on
host: the machine that you are building for
target: and the machine that GCC will produce code for
For a cross compiler, build and host will be the same, and target will be different. For example, here's how to tell the compiler to build a compiler to cross compile from Solaris x86 to Solaris Sparc:
./configure --build=x86_64-sun-solaris2.10 --host=x86_64-sun-solaris2.10 --target=sparc-sun-solaris2.10
You can then build additional compiler for each target you need to cross compile to.
Compiling 32 bit and 64 bit executables on a platform which runs both is quite easy. Anything else, will be a bit trickier. gcc on the Mac is built with several targets, and Apple has made it quite easy to create binaries for multiple platforms. All iPhone apps are compiled on x86 and target the ARM processor. If you can get the compiler built for the targets you want, then the cross compiling is usually fairly easy to do.
Related
I'm taking a class for assembly x86 and I haven't figured out how to get it running on my current version of vs code. I was wondering if someone can explain how to do this or link to a tutorial they found.
Some extra things that may be helpful: Computer is an m1 mac, I have the necessary things installed to run c++ and python, vs code is the 2022 version.
I was wondering where to get Cross GCC for mac, and how to install it.
I have installed the eclipse IDE on mac, and am able to run it, however it asks for a compiler path. To my knowledge I don't have a c++ compiler and I would like to know where to get one from.
I was trying to play with several tiny operating systems in an emulator but got stuck with Contiki in QEMU. Ideally the compiled executable should be run as a kernel in QEMU. For all OS's I was playing with I used this simple command to run executables in QEMU:
qemu-system-platform -nographic -kernel compiled_executable
In the case of Contiki, QEMU freezes regardless of any target platform the executables are compiled for, even for target platform "native", which according to the documentation, is built with "x86 gcc".
I also tried ARM-based platforms with the same freezing issues. If I specify a correct CPU model (e.g. cortex-m3 for cc2538dk), I received a segmentation fault instead.
I am wondering if I was missing any steps to cause the QEMU to freeze. Does it mean that the compiled executable cannot be treated as kernels (yet), unless I provide some QEMU-specific codes to initialize QEMU as a "board" for Contiki?
The native platform is used to build a "natively" (i.e. on Linux or other OS) executable image of Contiki - an userland app, rather than an OS kernel.
I am currently using the 32 bit codesourcery ARM toolchain for the 32 bit Windows. It's working fine, however I want to know whether a 64 bit codesourcery ARM toolchain is available?
Sourcery CodeBench is a 32-bit application, but runs on 64-bit host systems with 32-bit host libraries.
The information comes from the bottom of the web pages for specific target platforms. Here's the page for ARM GNU/Linux targets:
http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/platforms/arm-gnulinux
I strongly recommend against using any Sourcery CodeBench compilers for cross-compiling ARM code on Windows. There are way too many issues with using the windows environment and their tools. But if you do insist, much of the details can be found in the SamyGo wikientry. Moreover, there is a whole range of home cooked ARM cross-compilers on the XDA forums. Like HERE and HERE. Good Luck.
I am looking for an iOS library that enables solving LP, IP, BIP, MIP for an application I am developing. I've found GLPK but have no idea how to compile it for iOS, and after searching the web for some time, I did not find anything interesting...
I'd appreciate if someone can help me how to compile GLPK for iOS or either knows of some open source LP solver for iOS.
I used GMP (GNU Multiple Precision Arithmetic Library) for iOS development, what is basically a C based static library for various mathematical purpose. I had to do calculation on a big matrix, so I needed a library that support arbitrary precision. I installed it with MacPorts. MacPorts is a terminal based package management system on Mac, like yum or apt on Debian. After you installed the appropriate static library as I installed GMPL with "sudo port install gmp", after that you can check out in Xcode the static library under "Link Binary With Library" section. Press the "Add Other.." button, go the the /opt/local/lib folder, this is the default installation folder for MacPorts, and check out your static library. Add some header to your code, and voila, you can do your computations.
In the picture below you can see libgsl as well, that is the GNU Scientific Library, I would recommend it too.